|
| 1 | + |
| 2 | +# https://bandit.readthedocs.io/en/latest/config.html |
| 3 | +# Skip test B101 because of issue https://github.com/PyCQA/bandit/issues/457 |
| 4 | +[tool.bandit] |
| 5 | +tests = [] |
| 6 | +skips = ["B101"] |
| 7 | + |
| 8 | + |
| 9 | +# https://github.com/psf/black#configuration |
| 10 | +[tool.black] |
| 11 | +line-length = 120 |
| 12 | + |
| 13 | + |
| 14 | +# https://github.com/commitizen-tools/commitizen |
| 15 | +# https://commitizen-tools.github.io/commitizen/bump/ |
| 16 | +[tool.commitizen] |
| 17 | +bump_message = """bump: release $current_version → $new_version |
| 18 | +
|
| 19 | +Automatically generated by Commitizen. |
| 20 | +""" |
| 21 | +tag_format = "v$major.$minor.$patch$prerelease" |
| 22 | +update_changelog_on_bump = true |
| 23 | +version_files = [ |
| 24 | + "src/package/__init__.py:__version__", |
| 25 | +] |
| 26 | +major_version_zero = false |
| 27 | +version = "2.16.0" |
| 28 | + |
| 29 | + |
| 30 | +# https://github.com/pytest-dev/pytest-cov |
| 31 | +# https://github.com/nedbat/coveragepy |
| 32 | +[tool.coverage.report] |
| 33 | +fail_under = 100 |
| 34 | +show_missing = true |
| 35 | + |
| 36 | +[tool.coverage.run] |
| 37 | +branch = true |
| 38 | +omit = [ |
| 39 | + "src/package/__main__.py", |
| 40 | +] |
| 41 | + |
| 42 | + |
| 43 | +# https://pycqa.github.io/isort/ |
| 44 | +[tool.isort] |
| 45 | +profile = "black" |
| 46 | +multi_line_output = 3 |
| 47 | +line_length = 120 |
| 48 | +skip_gitignore = true |
| 49 | + |
| 50 | + |
| 51 | +# https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml |
| 52 | +[tool.mypy] |
| 53 | +# mypy_path = |
| 54 | +# exclude = |
| 55 | +show_error_codes = true |
| 56 | +show_column_numbers = true |
| 57 | +pretty = true |
| 58 | +show_traceback = true |
| 59 | +check_untyped_defs = true |
| 60 | +incremental = false |
| 61 | +strict = true |
| 62 | +warn_return_any = true |
| 63 | +warn_redundant_casts = true |
| 64 | +warn_unreachable = true |
| 65 | +warn_unused_configs = true |
| 66 | +warn_unused_ignores = true |
| 67 | +disallow_any_explicit = true |
| 68 | +disallow_untyped_calls = true |
| 69 | +disallow_untyped_defs = true |
| 70 | +disallow_incomplete_defs = true |
| 71 | +disallow_untyped_decorators = true |
| 72 | +# disable_error_code = |
| 73 | +# allow_redefinition = |
| 74 | + |
| 75 | +[[tool.mypy.overrides]] |
| 76 | +module = [ |
| 77 | + "pytest.*", |
| 78 | +] |
| 79 | +ignore_missing_imports = true |
| 80 | + |
| 81 | + |
| 82 | +# https://pylint.pycqa.org/en/latest/user_guide/configuration/index.html |
| 83 | +[tool.pylint.main] |
| 84 | +fail-under = 10.0 |
| 85 | +suggestion-mode = true |
| 86 | +load-plugins = [ |
| 87 | + "perflint", # A Linter for performance anti-patterns. |
| 88 | + "pylint.extensions.bad_builtin", |
| 89 | + "pylint.extensions.broad_try_clause", |
| 90 | + "pylint.extensions.check_elif", |
| 91 | + "pylint.extensions.code_style", |
| 92 | + "pylint.extensions.comparison_placement", |
| 93 | + "pylint.extensions.confusing_elif", |
| 94 | + "pylint.extensions.consider_refactoring_into_while_condition", |
| 95 | + "pylint.extensions.consider_ternary_expression", |
| 96 | + "pylint.extensions.dict_init_mutate", |
| 97 | + # "pylint.extensions.docparams", |
| 98 | + # "pylint.extensions.docstyle", |
| 99 | + "pylint.extensions.dunder", |
| 100 | + "pylint.extensions.empty_comment", |
| 101 | + "pylint.extensions.for_any_all", |
| 102 | + "pylint.extensions.magic_value", |
| 103 | + # "pylint.extensions.mccabe", |
| 104 | + "pylint.extensions.no_self_use", |
| 105 | + "pylint.extensions.overlapping_exceptions", |
| 106 | + "pylint.extensions.private_import", |
| 107 | + "pylint.extensions.redefined_loop_name", |
| 108 | + "pylint.extensions.redefined_variable_type", |
| 109 | + "pylint.extensions.set_membership", |
| 110 | + "pylint.extensions.typing", |
| 111 | + "pylint.extensions.while_used", |
| 112 | +] |
| 113 | +disable = [ |
| 114 | + "fixme", |
| 115 | + "line-too-long", # Replaced by Flake8 Bugbear B950 check. |
| 116 | + "too-few-public-methods", |
| 117 | + "too-many-ancestors", |
| 118 | + "too-many-arguments", |
| 119 | + "too-many-boolean-expressions", |
| 120 | + "too-many-branches", |
| 121 | + "too-many-instance-attributes", |
| 122 | + "too-many-lines", |
| 123 | + "too-many-locals", |
| 124 | + "too-many-nested-blocks", |
| 125 | + "too-many-positional-arguments", |
| 126 | + "too-many-public-methods", |
| 127 | + "too-many-return-statements", |
| 128 | + "too-many-statements", |
| 129 | + "too-many-try-statements", |
| 130 | +] |
| 131 | + |
| 132 | +[tool.pylint.MISCELLANEOUS] |
| 133 | +notes = [ |
| 134 | + "FIXME", |
| 135 | + "TODO", |
| 136 | + "BUGBUG", |
| 137 | +] |
| 138 | + |
| 139 | +[tool.pylint.FORMAT] |
| 140 | +max-line-length = 120 |
| 141 | + |
| 142 | + |
| 143 | +# https://docs.pytest.org/en/latest/reference/customize.html#configuration-file-formats |
| 144 | +# https://docs.pytest.org/en/latest/reference/reference.html#configuration-options |
| 145 | +# https://docs.pytest.org/en/latest/reference/reference.html#command-line-flags |
| 146 | +# |
| 147 | +# To integrate Hypothesis into pytest and coverage, we use its native plugin: |
| 148 | +# https://hypothesis.readthedocs.io/en/latest/details.html#the-hypothesis-pytest-plugin |
| 149 | +# |
| 150 | +# To discover tests in documentation, we use doctest and the doctest-plus plugin which |
| 151 | +# adds multiple useful options to control tests in documentation. More details at: |
| 152 | +# https://docs.python.org/3/library/doctest.html |
| 153 | +# https://github.com/scientific-python/pytest-doctestplus |
| 154 | +# |
| 155 | +# To avoid failing pytest when no tests were dicovered, we need an extra plugin: |
| 156 | +# https://docs.pytest.org/en/latest/reference/exit-codes.html |
| 157 | +# https://github.com/yashtodi94/pytest-custom_exit_code |
| 158 | +[tool.pytest.ini_options] |
| 159 | +minversion = "7.0" |
| 160 | +addopts = """-vv -ra --tb native --durations 0 \ |
| 161 | + --hypothesis-show-statistics --hypothesis-explain --hypothesis-verbosity verbose \ |
| 162 | + --doctest-modules --doctest-continue-on-failure --doctest-glob '*.rst' --doctest-plus \ |
| 163 | + --suppress-no-test-exit-code \ |
| 164 | + --cov package \ |
| 165 | +""" # Consider adding --pdb |
| 166 | +# https://docs.python.org/3/library/doctest.html#option-flags |
| 167 | +doctest_optionflags = "IGNORE_EXCEPTION_DETAIL" |
| 168 | +env = [ |
| 169 | + "PYTHONDEVMODE=1", # https://docs.python.org/3/library/devmode.html |
| 170 | +] |
| 171 | +filterwarnings = [ |
| 172 | + "error", |
| 173 | + "always::DeprecationWarning", |
| 174 | + # https://docs.pytest.org/en/latest/how-to/failures.html#warning-about-unraisable-exceptions-and-unhandled-thread-exceptions |
| 175 | + "error::pytest.PytestUnraisableExceptionWarning", |
| 176 | + "error::pytest.PytestUnhandledThreadExceptionWarning", |
| 177 | +] |
0 commit comments