Skip to content

Commit

Permalink
Narrow scope with per-file-ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed Mar 10, 2023
1 parent c8c2436 commit 3693370
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from typing import Dict, List, Match, Optional, Pattern, Sequence, Set, Tuple

# autogenerated by setuptools_scm
from ._version import __version__ as VERSION
from ._version import __version__ as VERSION # noqa: N812

word_regex_def = "[\\w\\-'’`]+"
# While we want to treat characters like ( or " as okay for a starting break,
Expand Down Expand Up @@ -228,7 +228,7 @@ def open_with_chardet(self, filename: str) -> Tuple[List[str], str]:
break
self.encdetector.close()
encoding = self.encdetector.result["encoding"]
assert encoding is not None
assert encoding is not None # noqa: S101

try:
f = open(filename, encoding=encoding, newline="")
Expand Down Expand Up @@ -556,14 +556,14 @@ def parse_options(
import tomllib # type: ignore[import]
except ModuleNotFoundError:
try:
import tomli as tomllib
import tomli as tomllib # type: ignore[no-redef]
except ImportError as e:
if tomllib_raise_error:
raise ImportError(
f"tomllib or tomli are required to read pyproject.toml "
f"but could not be imported, got: {e}"
) from None
tomllib = None
tomllib = None # type: ignore[assignment]
if tomllib is not None:
for toml_file in toml_files:
with open(toml_file, "rb") as f:
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,9 @@ addopts = "--cov=codespell_lib -rs --cov-report= --tb=short --junit-xml=junit-re

[tool.ruff]
extend-ignore = [
"A003",
"ANN101",
"ANN401",
"B904",
"N802",
"N812",
"PLW2901",
"S101",
]
line-length = 88
select = [
Expand All @@ -137,6 +132,11 @@ target-version = "py37"
[tool.ruff.mccabe]
max-complexity = 45

[tool.ruff.per-file-ignores]
"codespell_lib/_codespell.py" = ["A003"]
"codespell_lib/tests/test_*" = ["S101"]
"codespell_lib/tests/test_basic.py" = ["ANN401", "N802"]

[tool.ruff.pylint]
allow-magic-value-types = ["bytes", "int", "str",]
max-args = 12
Expand Down

0 comments on commit 3693370

Please sign in to comment.