Skip to content

Commit e8ba3c3

Browse files
committed
Support more modern ruff versions
* It's now called "ruff check" * Some options need to be in tool.ruff.lint section of pyproject.toml These still work for the ruff version (0.1.7) used in rubin-env 8.
1 parent 8f8c6fa commit e8ba3c3

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

pyproject.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ profile = "black"
77
line_length = 110
88

99
[tool.ruff]
10+
line-length = 110
11+
target-version = "py311"
1012
exclude = [
1113
"__init__.py",
1214
]
15+
16+
[tool.ruff.lint]
1317
ignore = [
1418
"N802",
1519
"N803",
@@ -19,22 +23,20 @@ ignore = [
1923
"N816",
2024
"N999",
2125
]
22-
line-length = 110
2326
select = [
2427
"E", # pycodestyle
2528
"F", # pyflakes
2629
"N", # pep8-naming
2730
"W", # pycodestyle
2831
]
29-
target-version = "py311"
3032
extend-select = [
3133
"RUF100", # Warn about unused noqa
3234
]
3335

34-
[tool.ruff.pycodestyle]
36+
[tool.ruff.lint.pycodestyle]
3537
max-doc-length = 79
3638

37-
[tool.ruff.pydocstyle]
39+
[tool.ruff.lint.pydocstyle]
3840
convention = "numpy"
3941

4042
[tool.pytest.ini_options]

python/lsst/sconsUtils/tests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ def runPythonLinter(self):
313313
if no suitable linter configuration was found.
314314
"""
315315
linter: str | None = None
316+
lint_options = ""
316317
root = SCons.Script.Dir("#").abspath
317318

318319
# Never want linters to look in this directory.
@@ -333,6 +334,7 @@ def runPythonLinter(self):
333334
else:
334335
if "tool" in parsed and "ruff" in parsed["tool"]:
335336
linter = "ruff"
337+
lint_options = "check"
336338

337339
# Ruff can complain about noqa in shebang line
338340
# added by sconsUtils to bin/ scripts. Need to ignore.
@@ -371,8 +373,8 @@ def runPythonLinter(self):
371373
for path in glob.glob(os.path.join(self._tmpDir, "linter-*.log*")):
372374
os.unlink(path)
373375

374-
# Specify exclude directories.
375-
lint_options = f"--extend-exclude={','.join(exclude_dirs)}"
376+
# Specify exclude directories. Append to any existing lint options.
377+
lint_options += f" --extend-exclude={','.join(exclude_dirs)}"
376378

377379
cmd = f"""
378380
@printf "%s\\n" 'Running python linter {linter}...';

0 commit comments

Comments
 (0)