Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SUGGESTION] Enforce Consistent Code Formatting #2368

Open
1 task done
bytexenon opened this issue Nov 16, 2024 · 0 comments
Open
1 task done

[SUGGESTION] Enforce Consistent Code Formatting #2368

bytexenon opened this issue Nov 16, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@bytexenon
Copy link
Contributor

Description

Title says it all-I REALLY think this project needs consistent and enforced formatting rules, just for contributors' sanity sake.

I get why it hasn't been enforced yet-probably because we don't want to create all that noise in git blame from formatting changes. But remember, git blame provides the -w option, which ignores commits that only change whitespace.

Additionally, the current codebase is filled with aligned variable assignments. Sure, it might make the code look nicer at first glance, but it creates a lot of noise when we add a longer variable name. Take a look at this example:

this_is_a_variable = 1
another_variable   = 2

If we want to add a longer variable, we have to modify multiple lines just to re-align them correctly:

-this_is_a_variable = 1
-another_variable   = 2
+this_is_a_variable   = 1
+another_variable     = 2
+much_longer_variable = 3

This thing alone creates a lot of unnecessary noise in the commit history, - that's why I see little to no reason to continue using the current formatting style. I suggest adopting Black as our formatter-it should create the least amount of noise while reformatting the project's files. In fact, the project was formatted once using Black in this commit, but that was almost a year ago. Since then, the project's formatting has degraded over time into the chaotic mess we have now.

That's why I think it would be a good idea to enforce consistent formatting using GitHub Actions. We could set it up to trigger on every pull request and automatically format the code using Black if it's not formatted already. This way, we'd have consistent formatting for years to come.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@bytexenon bytexenon added the enhancement New feature or request label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant