Skip to content

Commit 80c3e6a

Browse files
authored
Merge pull request #117 from lsst/tickets/DM-40138
Also skip bin directory with ruff
2 parents 1f1c806 + ce95b49 commit 80c3e6a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

python/lsst/sconsUtils/tests.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ def runPythonLinter(self):
315315
linter: str | None = None
316316
root = SCons.Script.Dir("#").abspath
317317

318+
# Never want linters to look in this directory.
319+
exclude_dirs = ["tests/.tests"]
320+
318321
pyproject = os.path.join(root, "pyproject.toml")
319322
if os.path.exists(pyproject):
320323
try:
@@ -331,6 +334,10 @@ def runPythonLinter(self):
331334
if "tool" in parsed and "ruff" in parsed["tool"]:
332335
linter = "ruff"
333336

337+
# Ruff can complain about noqa in shebang line
338+
# added by sconsUtils to bin/ scripts. Need to ignore.
339+
exclude_dirs.append("bin")
340+
334341
if linter is None:
335342
flake8_cfg = os.path.join(root, "setup.cfg")
336343
if os.path.exists(os.path.join(root, ".flake8")):
@@ -364,9 +371,8 @@ def runPythonLinter(self):
364371
for path in glob.glob(os.path.join(self._tmpDir, "linter-*.log*")):
365372
os.unlink(path)
366373

367-
# Always exclude the tests output directory. This should never be
368-
# examined.
369-
lint_options = "--extend-exclude=tests/.tests"
374+
# Specify exclude directories.
375+
lint_options = f"--extend-exclude={','.join(exclude_dirs)}"
370376

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

0 commit comments

Comments
 (0)