Skip to content

Commit d2035a5

Browse files
chore: enable ALL for ruff (#294)
* chore: enable ALL for ruff Signed-off-by: Henry Schreiner <henryfs@princeton.edu> * style: pre-commit fixes * Update src/repo_review/checks.py * fix: FBT and click not compatible Signed-off-by: Henry Schreiner <henryfs@princeton.edu> --------- Signed-off-by: Henry Schreiner <henryfs@princeton.edu> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent c6fdfb6 commit d2035a5

File tree

9 files changed

+21
-52
lines changed

9 files changed

+21
-52
lines changed

pyproject.toml

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -210,50 +210,21 @@ show-fixes = true
210210

211211

212212
[tool.ruff.lint]
213-
extend-select = [
214-
"ARG", # flake8-unused-arguments
215-
"B", # flake8-bugbear
216-
"BLE", # flake8-blind-except
217-
"C4", # flake8-comprehensions
218-
"DTZ", # flake8-datetimez
219-
"EM", # flake8-errmsg
220-
"EXE", # flake8-executable
221-
"FA", # flake8-future-annotations
222-
"FLY", # flynt
223-
"FURB", # refurb
224-
"G", # flake8-logging-format
225-
"I", # isort
226-
"ICN", # flake8-import-conventions
227-
"ISC", # flake8-implicit-str-concat
228-
"LOG", # flake8-logging
229-
"PERF", # Perflint
230-
"PGH", # pygrep-hooks
231-
"PIE", # flake8-pie
232-
"PL", # pylint
233-
"PT", # flake8-pytest-style
234-
"PTH", # flake8-use-pathlib
235-
"PYI", # flake8-pyi
236-
"Q", # flake8-quotes
237-
"RET", # flake8-return
238-
"RSE", # flake8-raise
239-
"RUF", # Ruff-specific
240-
"SIM", # flake8-simplify
241-
"SLOT", # flake8-slots
242-
"T10", # flake8-debugger
243-
"T20", # flake8-print
244-
"TC", # flake8-type-checking
245-
"TID251", # flake8-tidy-imports.banned-api
246-
"TRY", # tryceratops
247-
"UP", # pyupgrade
248-
"YTT", # flake8-2020
249-
250-
]
213+
extend-select = ["ALL"]
251214
ignore = [
252-
"ISC001", # May collide with formatter
253215
"PLR09", # Too many X
254216
"PLR2004", # Magic value in comparison
217+
"COM812", # Trailing commas teach the formatter
218+
"E501", # Line too long
219+
"S101", # Assert is used by pytest and mypy
220+
"D", # TODO
221+
"C9", # Complexity
222+
"S", # TODO
223+
"ANN401", # TODO (Any)
255224
]
256225
typing-modules = ["repo_review._compat.typing"]
226+
pydocstyle.convention = "pep257"
227+
flake8-builtins.ignorelist = ["copyright", "print"]
257228

258229
[tool.ruff.lint.flake8-tidy-imports.banned-api]
259230
"typing.Callable".msg = "Use collections.abc.Callable instead."
@@ -267,7 +238,9 @@ typing-modules = ["repo_review._compat.typing"]
267238

268239
[tool.ruff.lint.per-file-ignores]
269240
"src/repo_review/_compat/**.py" = ["TID251"]
270-
"src/**/__main__.py" = ["T20"]
241+
"src/**/__main__.py" = ["T20", "FBT001"]
242+
"tests/**.py" = ["D", "INP001", "FBT001", "ANN"]
243+
"docs/**.py" = ["INP001"]
271244

272245
[tool.coverage]
273246
report.exclude_also = [

src/repo_review/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ def rich_printer(
206206
console.print("[bold green]All checks passed [yellow](with some skips)")
207207

208208
if svg:
209-
str = console.export_svg(theme=rich.terminal_theme.DEFAULT_TERMINAL_THEME)
209+
string = console.export_svg(theme=rich.terminal_theme.DEFAULT_TERMINAL_THEME)
210210
if color:
211211
rich.print(
212-
rich.syntax.Syntax(str, lexer="xml"),
212+
rich.syntax.Syntax(string, lexer="xml"),
213213
file=sys.stderr if stderr else sys.stdout,
214214
)
215215
else:
216-
print(str, file=sys.stderr if stderr else sys.stdout)
216+
print(string, file=sys.stderr if stderr else sys.stdout)
217217

218218

219219
def display_output(

src/repo_review/checks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ def get_check_description(name: str, check: Check) -> str:
139139

140140

141141
def process_result_bool(
142-
result: str | bool | None, check: Check, name: str
142+
result: str | bool | None, # noqa: FBT001
143+
check: Check,
144+
name: str,
143145
) -> str | None:
144146
"""
145147
This converts a bool into a string given a check and name. If the result is a string

src/repo_review/families.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def collect_families(fixtures: Mapping[str, Any]) -> dict[str, Family]:
4242
4343
:param fixtures: Fully evaluated dict of fixtures.
4444
"""
45-
4645
family_functions = (
4746
ep.load()
4847
for ep in importlib.metadata.entry_points(group="repo_review.families")

src/repo_review/fixtures.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def list_all(root: Traversable) -> bool:
5454
5555
.. versionadded:: 0.8
5656
"""
57-
5857
return isinstance(root, EmptyTraversable)
5958

6059

src/repo_review/ghpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class GHPath(Traversable):
5050

5151
@staticmethod
5252
def open_url(url: str) -> io.StringIO:
53-
"This method can be overridden manually for WASM. Supports pyodide currently."
53+
"""This method can be overridden manually for WASM. Supports pyodide currently."""
5454
if sys.platform == "emscripten":
5555
import pyodide.http # noqa: PLC0415
5656

src/repo_review/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __dir__() -> list[str]:
1717

1818

1919
def get_schema(tool_name: str = "repo-review") -> dict[str, Any]:
20-
"Get the stored complete schema for repo-review settings."
20+
"""Get the stored complete schema for repo-review settings."""
2121
assert tool_name == "repo-review", "Only repo-review is supported."
2222

2323
with resources.joinpath("repo-review.schema.json").open(encoding="utf-8") as f:

src/repo_review/testing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def compute_check(name: str, /, **fixtures: Any) -> Result:
4444
4545
.. versionadded:: 0.10.5
4646
"""
47-
4847
check_functions = (
4948
ep.load() for ep in importlib.metadata.entry_points(group="repo_review.checks")
5049
)

tests/test_utilities/pyproject.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
if TYPE_CHECKING:
66
from repo_review._compat.importlib.resources.abc import Traversable
77

8-
# PP: PyProject.toml
9-
## PP0xx: Build system
10-
118

129
class General:
1310
family = "general"

0 commit comments

Comments
 (0)