lasp / maven_iuvs

2 stars 5 forks source link

Need to establish standards for code linting #58

Open emcangi opened 9 months ago

emcangi commented 9 months ago

Code linting varies between individual computers/programming environments, and norms can also vary between Python packages. We need to agree upon a code linting standard to avoid introducing disagreements on spacing, carriage returns, etc. that can lead to confusing commits if linting changes are accidentally made along with other content changes.

Noted by https://github.com/lasp/maven_iuvs/pull/54#discussion_r1480317550

planetarymike commented 8 months ago

What linter do you use? I'm set up to use flake8, but could switch to pylint or ruff easily, and to other with more difficulty.

emcangi commented 8 months ago

I'm on flake8 also in Sublime Text using Sublime Linter, so it should be giving us the same feedback! I've never even heard of ruff.

I think the main issues were styling choices that aren't covered by linting, and are instead left up to the individual module maintainers to establish conventions, especially where to begin docstrings, either on the same line as """ or the following line. I just personally dislike having the text start on the same line so I would compulsively change it without realizing, but this style I think is a numpy standard that many packages adopt. I could be forced to accept this relatively benign style though.

There are some other inconsistent styling things that we ignored for now that should be caught by the linter, and could be captured in one large "styling update" commit/PR:

planetarymike commented 8 months ago

If we're both using flake8, great! At that point the main thing is to not make formatting changes unless you're also making substantive changes to the content of the lines.

We do need to decide on a line length limit and enforce it; 120 characters?