|
| 1 | +[tool.pytest.ini_options] |
| 2 | +# Note this only works under python3. Pytest 6.0+ supports |
| 3 | +# pyproject.toml and is not available for python 2. These settings can |
| 4 | +# be adapted for pytest.ini if you are running under python2. |
| 5 | + |
| 6 | +# For use with packages: |
| 7 | +# python -m pip install pytest-cov pytest-env pytest-randomly |
| 8 | + |
| 9 | +minversion = "6.0" |
| 10 | + |
| 11 | +# Disable randomly by default. There are still a few tests that are |
| 12 | +# order dependent. Enable on cli for python3 only using: |
| 13 | +# "-p randomly" |
| 14 | +addopts = "-p no:randomly --durations=10 --strict-markers -r a -v" |
| 15 | + |
| 16 | +# Set the redis password to nothing. Can be overridden on cli using: |
| 17 | +# "-e pytest_redis_pw=mySecretPassword" |
| 18 | +env = [ |
| 19 | + "D:pytest_redis_pw=" |
| 20 | +] |
| 21 | + |
| 22 | +# Don't search random directories to find tests. |
| 23 | +testpaths = [ |
| 24 | + "test", |
| 25 | +] |
| 26 | + |
| 27 | +[tool.ruff] |
| 28 | +line-length = 128 |
| 29 | +output-format = "full" |
| 30 | + |
| 31 | +exclude = [ |
| 32 | + # ignore code imported/sourced from other places |
| 33 | + "roundup/cgi/PageTemplates/*.py", |
| 34 | + "roundup/cgi/TAL/*.py", |
| 35 | + "roundup/cgi/ZTUtils/*.py", |
| 36 | + "roundup/anypy/vendored/*.py", |
| 37 | + "dicttoxml.py" |
| 38 | +] |
| 39 | + |
| 40 | +[tool.ruff.lint] |
| 41 | +select = [ |
| 42 | + "A", # flake-8-builtins shadowing a builtin |
| 43 | + "ARG", # flake8-unused-arguments |
| 44 | + "B", # flake8-bugbear |
| 45 | + "C4", # flake8-comprehensions |
| 46 | + "C901", # McCabe complexity |
| 47 | + "COM", # flake8-commas |
| 48 | + "E", |
| 49 | + "F", # pyflakes |
| 50 | + "G", # logging format _(.... % ...) bad use _(...) % ... |
| 51 | + "I", # imports |
| 52 | + "INT", # check gettext |
| 53 | + "Q", # quoting consistancy |
| 54 | + "PERF", # performance lint |
| 55 | + "PIE794", # duplicate class field definition |
| 56 | + "PL", # pylint |
| 57 | + "RET", # check for inconistent returns |
| 58 | + "RUF", # ruff |
| 59 | + "S", # bandit - security |
| 60 | + "SIM", # simplify code |
| 61 | + "T10", # flake8-debugger |
| 62 | + "W", # pycode whitespace warnings |
| 63 | +] |
| 64 | + |
| 65 | +ignore = [ |
| 66 | + # raise from except hander with none or chaining; only python3 |
| 67 | + "B904", |
| 68 | + # ### before comments is fine |
| 69 | + "E266", |
| 70 | + # ignore double vs. single quotes |
| 71 | + "Q000", "Q001", "Q002", |
| 72 | + # do not replace x in (a,b) with x in {a,b} (set). python 3.2 |
| 73 | + # got a speedup in this; only python 3 |
| 74 | + "PLR6201", |
| 75 | + # 505: allow use of else/elif even if it could be removed. |
| 76 | + # if X: return; elif Z: return; else v -> |
| 77 | + # if X: return; if Z: return; v |
| 78 | + # 506: same but with a raise rather than return |
| 79 | + #"RET505", |
| 80 | + #"RET506", |
| 81 | + # use *list to expand; only python 3 |
| 82 | + "RUF005", |
| 83 | + # do not use contextlib.suppress rather than except: pass to suppress |
| 84 | + # exception. contextlib doesn't work in python2 and is slower |
| 85 | + "SIM105", |
| 86 | +] |
| 87 | + |
| 88 | + |
| 89 | +[tool.ruff.lint.per-file-ignores] |
| 90 | +"roundup/anypy/*.py" = ["RET505", "RET506"] |
| 91 | +"roundup/dehtml.py" = ["E501"] |
| 92 | +"roundup/rest.py" = ["E501"] |
| 93 | +"roundup/support.py" = ["E401"] |
| 94 | +"roundup/security.py" = ["E701"] |
| 95 | +"roundup/date.py" = ["E231", "E701"] |
| 96 | +"roundup/backends/back_sqlite.py" = [ "E203" ] |
| 97 | + |
| 98 | +[too.ruff.lint.pylint] |
| 99 | +max-args = 6 |
| 100 | +max-branches=20 |
| 101 | +max-statements = 100 |
| 102 | + |
| 103 | +[tool.ruff.lint.mccabe] |
| 104 | +max-complexity = 50 |
| 105 | + |
| 106 | +# |
| 107 | +#skip= |
| 108 | +# C901 |
| 109 | +# E228 |
| 110 | +# E302 |
| 111 | +# E401 |
0 commit comments