Skip to content

Add linters and formatters for Python code #291

@magnusbaeck

Description

@magnusbaeck

Description

We currently have a couple of Python files in the repo and planned changes (#274, #282, #256) are likely to add additional scripts. Once we have a basic tox.ini in place for running validate.py (#265) we should extend it with a reasonable set of linters and code formatters. I suggest flake8, black, and isort.

Motivation

Keeping the Python code in the scripts tidy and consistent makes life easier for authors and reviewers.

Exemplification

N/A

Benefits

  • Reviewers won't have to pay attention to code formatting or nitpicking details that a linter could've taken care of.
  • Authors can use Black and isort to automatically fix up their code.
  • Use of a linter can prevent bugs.

Possible Drawbacks

If you disagree with the linters and code formatters you may find that you have to spend too much time fighting them with suppression directives or configuration tweaking.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions