-
Notifications
You must be signed in to change notification settings - Fork 122
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
Auto-format code #143
Comments
I think this would be a great idea. My worry about the actual implementation would be that it would make I would love to see this implemented, perhaps just after bringing the codebase "back together", like if/when we merge back As a related point, at least some of the long lines are long because they have complex interior expressions, not simply because they're, say, a long list. These should probably be rewritten or functionalized, not just formatted. |
Looks like there is a way to do this (at least locally). It doesn't work on GitHub but there is an active request for the feature.
Agree that it's best done with or after a merge/PR.
I don't disagree. For anyone who isn't sure why it helps to auto-format the code, one advantage is that it changes this view to this Because the formatted code conforms to maximum line lengths (the default is 92) I can easily have side-by-side code windows. It also removes all personal choice about if statements should look like this
or this
The benefit is that code looks the same everywhere without having to convince everyone to adopt the same style. |
PR #673 addresses this. |
Addressed on release branch |
The GenX codebase has lots of lines that are much longer than 80/92 characters. Many projects (python, julia, etc) use auto formatters to ensure that code is always formatted in a consistent way. For example, PowerSystems.jl has a github action that checks all pull requests for formatting using JuliaFormatter.jl. I do the same with Black for PRs to PowerGenome. The advantages of auto formatting code are that 1) lines don't get too long and 2) everything in the codebase has the same visual style. Respecting line length makes it easier to view two files side-by-side. A uniform visual style makes it easier to read the code without forcing everyone to learn/follow a set of code guidelines.
The text was updated successfully, but these errors were encountered: