Skip to content

Flake8 code check

Raphael Delhome requested to merge rde-flake8-linter into master

This MR introduces flake8 as an on-the-fly linter to verify the produced Python code. It will enforce us to respect the Python PEP8, so as to maintain good quality standards in the project.

Concretely, we will have a pre-commit hook that will verify the modified modules, and prevent us for committing wrongly formatted code. As an example:

12:29 $ git commit -m "test"
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

foo.py:1:1: F401 'numpy as np' imported but unused

After fixing this alerts, one will be able to commit properly:

12:30 $ git commit -m "test"
flake8...................................................................Passed
[rde-flake8-linter 5004dba] test
 1 file changed, 2 insertions(+)
 create mode 100644 foo.py

How to install this commit hook? -> make dev-install

Related issue: #42 (closed)

Edited by Raphael Delhome

Merge request reports