Skip to content
Snippets Groups Projects
  • Jean-Christophe Fillion-Robin's avatar
    38cf81e5
    STYLE: Add .flake8 configuration to support python script validation · 38cf81e5
    Jean-Christophe Fillion-Robin authored
    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/
    
    
    Former-commit-id: 6f028716
    38cf81e5
    History
    STYLE: Add .flake8 configuration to support python script validation
    Jean-Christophe Fillion-Robin authored
    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/
    
    
    Former-commit-id: 6f028716