Skip to content

Commit

Permalink
qualify ruff ignore rules with docs url (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlittle authored Nov 30, 2023
1 parent a84b2b4 commit a6f53e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,49 @@ lint.ignore = [
# ruff --select="ALL" --statistics src/geovista/<subpackage>

# flake8-boolean-trap (FBT)
# https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt
# NOTE: A good thing to fix, but changes API.
"FBT001", # boolean-positional-arg-in-function-definition.
"FBT002", # boolean-default-value-in-function-definition.
"FBT003", # boolean-positional-value-in-function-call.

# Pylint (PL)
# https://docs.astral.sh/ruff/rules/#pylint-pl
"PLR0912", # Too many branches.
"PLR0913", # Too many arguments in function definition.
"PLR0915", # Too many statements.
"PLR2004", # Magic value used in comparison, consider replacing with a constant.
"PLW0603", # Using the global statement to update is discouraged.

# flake8-self (SLF)
# https://docs.astral.sh/ruff/rules/#flake8-self-slf
"SLF001", # Private member accessed.

# flake8-todos (TD)
# https://docs.astral.sh/ruff/rules/#flake8-todos-td
"TD003", # Missing issue link on the line following this TODO.
]

[lint.extend-per-file-ignores]
"conftest.py" = [
# flake8-annotations (ANN)
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ANN001", # Missing type annotation for function argument.
"ANN201", # Missing return type annotation for public function.
]
"src/geovista/geoplotter.py" = [
# flake8-annotations (ANN)
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ANN401", # Dynamically typed expressions (typing.Any).
]
"test_*.py" = [
# flake8-annotations (ANN)
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ANN001", # Missing type annotation for function argument.
"ANN201", # Missing return type annotation for public funciton.
]
"test_slice_lines.py" = [
# eradicate (ERA)
# https://docs.astral.sh/ruff/rules/#eradicate-era
"ERA001", # Found commented-out code.
]
15 changes: 12 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,33 +116,38 @@ ignore = [
# NOTE: Non-permanent exclusions should be added to ".ruff.toml".

# flake8-annotations (ANN)
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ANN101", # Missing type annotation for 'self' in method.
"ANN102", # Missing type annotation for 'cls' in classmethod.

# flake8-commas (COM)
# https://docs.astral.sh/ruff/rules/#flake8-commas-com
"COM812", # Trailing comma missing.
"COM819", # Trailing comma prohibited.

# pydocstyle (D)
# https://docs.astral.sh/ruff/rules/undocumented-magic-method/
"D105", # Missing docstring in magic method.

# flake8-fixme (FIX)
# https://docs.astral.sh/ruff/rules/line-contains-todo/
"FIX002", # Line contains TODO, consider resolving the issue.

# flake8-implicit-str-concat (ISC)
"ISC001", # Implicitly concatenate string literals on one line.

# pep8-naming
# https://docs.astral.sh/ruff/rules/#pep8-naming-n
"N806", # Variable name in function should be lowercase.
"N999", # Invalid module name.

# pandas-vet (PD)
# https://docs.astral.sh/ruff/rules/#pandas-vet-pd
"PD",

# Ruff-specific rules (RUF)
# https://docs.astral.sh/ruff/rules/collection-literal-concatenation/
"RUF005", # Consider {expression} instead of concatenation.

# flake8-bandit (S)
# https://docs.astral.sh/ruff/rules/assert/
"S101", # Use of assert detected.
]
preview = false
Expand All @@ -163,15 +168,19 @@ max-complexity = 26

[tool.ruff.lint.per-file-ignores]
"src/geovista/cli.py" = [
# https://docs.astral.sh/ruff/rules/print/
"T201", # flake8-print: print found.
]
"src/geovista/examples/*.py" = [
# https://docs.astral.sh/ruff/rules/typing-only-third-party-import/
"TCH002", # flake8-type-checking: Move 3rd-party import into a type checking block.
]
"src/geovista/examples/earthquakes.py" = [
# https://docs.astral.sh/ruff/rules/line-too-long/
"E501", # pycodestyle: Line too long.
]
"src/geovista/examples/earthquakes_wink1.py" = [
# https://docs.astral.sh/ruff/rules/line-too-long/
"E501", # pycodestyle: Line too long.
]

Expand Down

0 comments on commit a6f53e5

Please sign in to comment.