Rapid-Design-of-Systems-Laboratory / beluga

General purpose indirect trajectory optimization
Other
25 stars 6 forks source link

Check out autopep8 or some other linter #175

Open msparapa opened 5 years ago

msparapa commented 5 years ago

Adding a linter will help us adhere to coding standards. Sean, you're already good about this, but I'm really lazy about formatting. I think autopep8 could help us (i.e. me) enforce this better.

SeanMatthewNolan commented 5 years ago

Sounds fine with me, it will limit odd out of place PEP 8 commits from me

msparapa commented 5 years ago

Looking into this further, autopep8 is a tool to automatically format code according to pep8, which we probably shouldn't do. pylint is the tool that does the check. I ran it on beluga and, in addition to every pep8 violation, I got this output

Your code has been rated at -0.97/10

🤔

It would be pretty slick if we automatically ran pylint as some sort of continuous integration test case.

SeanMatthewNolan commented 5 years ago

I volunteer to go through the code and refactor everything to match.

SeanMatthewNolan commented 5 years ago

This site recommends pycodestyle or flake8: https://realpython.com/python-pep8/#linters

Maybe we try a few before integration? Or not, they are probably all similar.

SeanMatthewNolan commented 5 years ago

@msparapa Question? Why do many of our classes use __new__ instead of __init__? I know I asked before, but I forget. It's not like we are subclassing an immutable type.

msparapa commented 5 years ago

Because I went overkill. ~80% of the classes using __new__ should just use __init__ instead.