nasa / OnAIR

The On-board Artificial Intelligence Research (OnAIR) Platform is a framework that enables AI algorithms written in Python to interact with NASA's cFS. It is intended to explore research concepts in autonomous operations in a simulated environment.
58 stars 14 forks source link

add formatting and linting #139

Open dragonejt opened 1 month ago

dragonejt commented 1 month ago

This PR adds linting using Pylint and formatting using Black, and adds a GitHub Actions workflow to check linting and formatting on each new push or PR. This is functionally optional, but sets a guideline for formatting so there aren't any formatting conflicts or code smells.

Changes

Testing

dragonejt commented 3 days ago

This PR is appreciated and the concept is good.

Out of curiosity, do you have rationale behind the choices of applications? Particularly interested in why you chose Black and Pylint versus any other available options.

I chose Black and Pylint because of their popularity, support, and ruleset. Black and Pylint are probably the more popular and more supported code formatters and linters, and this is helpful when it comes to IDE integrations with VSCode and PyCharm as you can see linter violations directly in your IDE based on the linter rules you have set/unset. Black also contains a superset of the normal PEP 8 python code format standard. There is also just how mature they are, these are relatively mature tools compared to newcomers like Ruff, and that is useful because we don't want our code formatters and linters to break or have breaking changes.

This decision is purely opinion-based, and it is relatively easy to switch to a different code formatter or linter if we want to.

asgibson commented 2 days ago

Thank you for the explanation, it is much appreciated. Once the environment_dev.yml is added and used in CI, I will approve this PR.