Skip to content

Commit c97b3fb

Browse files
Enforce repo-review rules (#296)
* Enforce repo-review rule PP302 PP302: Sets a minimum pytest to at least 6 Must have a `minversion=`, and must be at least 6 (first version to support `pyproject.toml` configuration). * Enforce repo-review rule PP305 PP305: Specifies xfail_strict `xfail_strict` should be set. You can manually specify if a check should be strict when setting each xfail. * Enforce repo-review rule PP306 PP306: Specifies strict config `--strict-config` should be in `addopts = [...]`. This forces an error if a config setting is misspelled. * Enforce repo-review rule PP307 PP307: Specifies strict markers `--strict-markers` should be in `addopts = [...]`. This forces all markers to be specified in config, avoiding misspellings. * Enforce repo-review rule PP308 PP308: Specifies useful pytest summary An explicit summary flag like `-ra` should be in `addopts = [...]` (print summary of all fails/errors). * Enforce pytest ≥ 7.3.2 This is the first version to support Python 3.12: https://docs.pytest.org/en/stable/changelog.html#pytest-7-3-2-2023-06-10 * Enforce repo-review rule MY104 MY104: MyPy enables ignore-without-code Must have `"ignore-without-code"` in `enable_error_code = [...]`. This will force all skips in your project to include the error code, which makes them more readable, and avoids skipping something unintended. * Enforce repo-review rule MY105 MY105: MyPy enables redundant-expr Must have `"redundant-expr"` in `enable_error_code = [...]`. This helps catch useless lines of code, like checking the same condition twice. * Enforce repo-review rule MY106 MY106: MyPy enables truthy-bool Must have `"truthy-bool"` in `enable_error_code = []`. This catches mistakes in using a value as truthy if it cannot be falsy.
1 parent bf81281 commit c97b3fb

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ libjpeg = [
4848
]
4949
test = [
5050
"mypy==0.971",
51-
"pytest==7.1.2",
52-
"pytest-cov==3.0.0",
51+
"pytest==7.4.4",
52+
"pytest-cov==4.1.0",
5353
"pytest-flake8==1.1.1",
5454
"numpy-stubs @ git+https://github.com/numpy/numpy-stubs@201115370a0c011d879d69068b60509accc7f750",
5555
]
@@ -67,12 +67,15 @@ documentation = "https://highdicom.readthedocs.io/"
6767
repository = "https://github.com/ImagingDataCommons/highdicom.git"
6868

6969
[tool.pytest.ini_options]
70-
addopts = "--doctest-modules"
70+
minversion = "7"
71+
addopts = ["--doctest-modules", "-ra", "--strict-config", "--strict-markers"]
7172
testpaths = ["tests"]
7273
log_cli_level = "INFO"
74+
xfail_strict = true
7375

7476
[tool.mypy]
7577
warn_unreachable = true
78+
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
7679

7780
[[tool.mypy.overrides]]
7881
module = "mypy-pydicom.*"

0 commit comments

Comments
 (0)