Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.4 KB

code_guidelines.md

File metadata and controls

55 lines (39 loc) · 1.4 KB

Code Style

  • Code line length: 120
  • Use double quotes as default (don't mix and match for simple quoting, checked with pylint).
  • Configuration:
    • .pylint.rc for pylint.
    • pyproject.toml for isort.
      TBD if pyproject.toml is the right approach. This is not a library and we are new to Python build systems...
    • setup.cfg for flake8.

Tooling

Install all code linting tools:

pip3 install -r test-requirements.txt

Verify

The following tests are run as GitHub action for each push on the main branch and for pull requests. They can also be run anytime on a local developer machine:

python -m pylint intg-denonavr
python -m flake8 intg-denonavr --count --show-source --statistics
python -m isort intg-denonavr/. --check --verbose 
python -m black intg-denonavr --check --verbose --line-length 120

Linting integration in PyCharm/IntelliJ IDEA:

  1. Install plugin Pylint
  2. Open Pylint window and run a scan: Check Module or Check Current File

Format Code

python -m black intg-denonavr --line-length 120

PyCharm/IntelliJ IDEA integration:

  1. Go to Preferences or Settings -> Tools -> Black
  2. Configure:
  • Python interpreter
  • Use Black formatter: On code reformat & optionally On save
  • Arguments: --line-length 120

Sort Imports

python -m isort intg-denonavr/.