SPF-UiO / spbm

The Student Personnel Booking Manager, by and for the Student Cellar Pub Personnel Organsiation at the University of Oslo.
5 stars 4 forks source link

Linting and consistent formatting #19

Open thor opened 5 years ago

thor commented 5 years ago

There's a lot of room for code improvement, even with the high amounts of things that have been fixed.

Thus, we should look at things like:

Or maybe packages of them, like:

Code analysis and formatters too:

Tool Category Description
Mccabe Analytical Checks McCabe complexity
Radon Analytical Analyzes code for various metrics (lines of code, complexity, and so on)
Black Formatter Formats Python code without compromise
Isort Formatter Formats imports by sorting alphabetically and separating into sections
susannmt commented 5 years ago

I think linting, for instance using pylint, sounds like a good idea. I am personally not a big fan of black, because it changes the code. I see the attraction, you then don't have to memorize all formatting rules, and the code will be formatted the same way a 100%. It will also make it quick and easy to format the existing code. However, I think you "lose ownership" a bit, and it is as you write "without compromise".

As for type annotation, I think that it is very useful for function/method input/output arguments, but my experience with enforcing mypy is that it makes the code a bit cluttered with types, since they must be added for every local variable also.

I'm not familiar with the other things you list here, but from a quick search pylama looks really cool and easy to use. I suggest trying it out for a bit. With things like these, one just have to agree on a norm and go with it.