[tox]
minversion = 2.0
envlist = py{27,35,36,37,38,39}

[testenv]
whitelist_externals =
  find
commands =
  find . -type f -name "*.pyc" -delete
  python test/alltests.py

[testenv:style]
deps =
  flake8
commands =
  flake8 {toxinidir}

[flake8]
# The following rules are ignored as they're stylistic and can be addressed at
# a later point:
#
# E101 indentation contains mixed spaces and tabs
# E111 indentation is not a multiple of four
# E114 indentation is not a multiple of four (comment)
# E115 expected an indented block (comment)
# E116 unexpected indentation (comment)
# E117 over-indented
# E121 continuation line under-indented for hanging indent
# E122 continuation line missing indentation or outdented
# E123 closing bracket does not match indentation of opening bracket's line
# E124 closing bracket does not match visual indentation
# E125 continuation line with same indent as next logical line
# E126 continuation line over-indented for hanging indent
# E127 continuation line over-indented for visual indent
# E128 continuation line under-indented for visual indent
# E129 visually indented line with same indent as next logical line
# E131 continuation line unaligned for hanging indent
# E201 whitespace after '('
# E202 whitespace before '}'
# E203 whitespace before ':'
# E211 whitespace before '('
# E221 multiple spaces before operator
# E222 multiple spaces after operator
# E225 missing whitespace around operator
# E226 missing whitespace around arithmetic operator
# E228 missing whitespace around modulo operator
# E231 missing whitespace after ','
# E241 multiple spaces after ':'
# E251 unexpected spaces around keyword / parameter equals
# E261 at least two spaces before inline comment
# E262 inline comment should start with '# '
# E265 block comment should start with '# '
# E266 too many leading '#' for block comment
# E271 multiple spaces after keyword
# E301 expected 1 blank line, found 0
# E302 expected 2 blank lines, found 1
# E303 too many blank lines (N)
# E305 expected 2 blank lines after class or function definition, found 1
# E306 expected 1 blank line before a nested definition, found 0
# E401 multiple imports on one line
# E402 module level import not at top of file
# E501 line too long (N > 79 characters)
# E502 the backslash is redundant between brackets
# E701 multiple statements on one line (colon)
# E704 multiple statements on one line (def)
# E711 comparison to None should be 'if cond is not None:'
# E713 test for membership should be 'not in'
# E721 do not compare types, use 'isinstance()'
# E722 do not use bare 'except'
# E731 do not assign a lambda expression, use a def
# E741 ambiguous variable name 'a'
# W191 indentation contains tabs
# W291 trailing whitespace
# W293 blank line contains whitespace
# W391 blank line at end of file
# W503 line break before binary operator
# W504 line break after binary operator
# F401 'foo' imported but unused
# F841 local variable 'foo' is assigned to but never used
#
# The following rules are required for Python 3 support and so are not
# disabled
#
# W605 invalid escape sequence '\ '
# W601 .has_key() is deprecated, use 'in'
# W602 deprecated form of raising exception
# F811 redefinition of unused 'foo' from line 79
#
# Similarly, the following are straight up bugs that should be addressed
# immediately:
#
# E999 SyntaxError: invalid syntax
# F404 from __future__ imports must occur at the beginning of the file
# F821 undefined name 'foo'
ignore = E101,E111,E114,E115,E116,E117,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E201,E202,E203,E211,E221,E222,E225,E226,E228,E231,E241,E251,E261,E262,E265,E266,E271,E301,E302,E303,E305,E306,E401,E402,E501,E502,E701,E704,E711,E713,E721,E722,E731,E741,W191,W291,W293,W391,W503,W504,W605,F401,F841
exclude = .venv,.tox,dist,*egg,build
max-complexity = 35
# Some rules are disabled for specific files (requires flake8 3.7.0)
#
# F821, disabled due to use of 'settings_overrides'
per-file-ignores =
  docutils/test/functional/tests/*:F821
