2024-03-23 Autonomy Linting and Formatting Meeting
Linters and Formatters
Pylint
General purpose linter
Black
Formatting for multiline and spacing
Flake8
Used for type annotations
Major Changes
Added linting and formatting to CI
Moved common Pylint disables to pyproject.toml
Tests now separated into unit tests and integration tests
Conventions not handled by linting
Underscores for numbers:
num_1
instead ofnum1
Scientific notation should be in lowercase:
1e6
instead of1E6
All empty containers should be type annotated
Duplicate calculations should be avoided (store the calculation in a variable instead)
Use
if x is None
instead ofif not x
Always exit early and avoid nested code
Use f -strings
Create method - all work is done in the create method and the constructor just assigns values
def main
and return error code instead ofimport sys
andsys.exit()
To Do:
Overhaul Python Style Convention