Skip to content
Snippets Groups Projects
Commit 6f028716 authored by Jean-Christophe Fillion-Robin's avatar Jean-Christophe Fillion-Robin
Browse files

STYLE: Add .flake8 configuration to support python script validation

Flake8 is a python source checker.

The initial configuration file adds exceptions for all errors, it will
iteratively be updated as the code is improved.

After installing flake8 with `pip install flake8`, the following shell
script was used to craft the list of exceptions:

  IFS=$'\n'
  for line in $(flake8 --exclude src/Admin/ . | cut -d":" -f4 | sort | uniq)
  do
     # Remove leading space
     line=$(echo $line | sed -e 's/^[ \t]*//')
     # Extract error code
     code=$(echo $line | cut -d" " -f1)
     echo "    # $line"
     echo "    $code,"
  done

Currently, `src/Admin/` is excluded.

Internally flake8 is wrapper around these tools:

* PyFlakes: analyzes programs and detects various errors. It works by
  parsing the source file, not importing it, so it is safe to use on
  modules with side effects. It’s also much faster.

* pycodestyle: a tool to check your Python code against some of the
  style conventions in PEP 8 (the style guide for python code).
  See https://www.python.org/dev/peps/pep-0008/

* Ned Batchelder’s McCabe script: check McCabe (or cyclomatic) complexity.
  See https://en.wikipedia.org/wiki/Cyclomatic_complexity.

To learn more about flake8. See http://flake8.pycqa.org/en/latest/
parent e0952ffa
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment