Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .flake8

This file was deleted.

140 changes: 85 additions & 55 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,6 @@ toml = ["tomli"]
requires = ["poetry-core>=1.0.7"]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 88
target-version = ['py310']
include = '\.pyi?$'
exclude = "tests/fixtures/*"

[tool.isort]
profile = "black"
extend_skip = "tests/fixtures/"

[tool.pylint.master]
max-line-length = 100
load-plugins = [
"pylint_pytest",
]

[tool.coverage.run]
branch = true
relative_files = true
Expand All @@ -109,45 +93,6 @@ exclude_also = [
show_contexts = true
skip_covered = false

[tool.pylint."messages control"]
enable = ["all"]
disable = [
# allow TODO comments
"fixme",
# allow disables
"locally-disabled",
"suppressed-message",
# covered by isort
"ungrouped-imports",
# allow classes and functions w/o docstring
"missing-docstring",
# hard number checks can be ignored, because they are covered in code reviews
"too-many-instance-attributes",
"too-many-arguments",
"too-many-locals",
"too-many-branches",
"too-few-public-methods",
"too-many-nested-blocks",
"too-many-public-methods",
# allow methods not to use self
"no-self-use",
# currently some code seems duplicated for pylint
"duplicate-code",
# we are a command line tool and don't want to show all internals
"raise-missing-from",
]

[tool.pylint.basic]
good-names = [
"_",
"i",
"setUp",
"tearDown",
"e",
"ex",
]
no-docstring-rgx = "^_"

[tool.pytest.ini_options]
addopts = "--strict-markers"
xfail_strict = true
Expand All @@ -157,3 +102,88 @@ markers = [

[tool.doc8]
max_line_length = 120

[tool.ruff]
line-length = 88
target-version = "py39"
src = ["diff_cover", "tests"]
exclude = ["tests/fixtures/*"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.ruff.lint]
select = ["ALL"]
ignore = [
# Disable all annotations
"ANN",
# allow TODO comments (equivalent to "fixme")
"FIX",

"D200", # Disables One-line docstring should fit on one line
"D205", # Disables 1 blank line required between summary line and description
"D212", # Disables Multi-line docstring summary should start at the first line
"D400", # Disables First line should end with a period
"D415", # Disables First line should end with a period, question mark, or exclamation point

# allow disables (equivalent to "locally-disabled", "suppressed-message")
"RUF100",

# covered by isort (equivalent to "ungrouped-imports")
"I",

# allow classes and functions w/o docstring (equivalent to "missing-docstring")
"D1",

# hard number checks (equivalent to "too-many-*" rules)
"C901", # complexity
"PLR0912", # too many branches
"PLR0913", # too many arguments
"PLR0914", # too many locals
"PLR0915", # too many statements
"PLR0916", # too many nested blocks
"PLR0904", # too many public methods

# duplicate code detection (equivalent to "duplicate-code")
"CPY",

# we are a command line tool (equivalent to "raise-missing-from")
"B904",

# Resolve incompatible docstring rules
"D203", # Keep D211 (no-blank-line-before-class)
"D213", # Keep D212 (multi-line-summary-first-line)

# Avoid formatter conflicts
"COM812",
]

# The equivalent of pylint's good-names
allowed-confusables = ["_"]

[tool.ruff.lint.pep8-naming]
# Allow specific names that might otherwise violate naming conventions
ignore-names = ["i", "e", "ex", "setUp", "tearDown"]

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"S101", # Disables Assert statements
"PLR2004", # Disables Magic value
"PT011", # Disables Exception is too broad
"RUF012", # Disables Mutable class attributes should be annotated with typing.ClassVar
]

[tool.ruff.lint.pydocstyle]
# Equivalent to pylint's no-docstring-rgx
ignore-decorators = ["^_"]

[tool.ruff.lint.isort]
known-first-party = ["diff_cover", "tests"]
section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]
lines-between-types = 0
lines-after-imports = 2
combine-as-imports = true
split-on-trailing-comma = false
11 changes: 5 additions & 6 deletions verify.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
COMPARE_BRANCH=${COMPARE_BRANCH:-origin/main}

black diff_cover tests --check
isort diff_cover tests --check
ruff format --check
ruff check --select I
python -m pytest -n auto --cov-context test --cov --cov-report=xml tests
git fetch origin main:refs/remotes/origin/main
diff-cover --version
diff-quality --version
diff-cover coverage.xml --include-untracked
diff-quality --violations flake8 --include-untracked
diff-quality --violations pylint --include-untracked
diff-cover coverage.xml --include-untracked --compare-branch=$COMPARE_BRANCH
diff-quality --violations ruff.check --include-untracked --compare-branch=$COMPARE_BRANCH
doc8 README.rst --ignore D001

Loading