Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also skip bin directory with ruff #117

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions python/lsst/sconsUtils/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ def runPythonLinter(self):
linter: str | None = None
root = SCons.Script.Dir("#").abspath

# Never want linters to look in this directory.
exclude_dirs = ["tests/.tests"]

pyproject = os.path.join(root, "pyproject.toml")
if os.path.exists(pyproject):
try:
Expand All @@ -331,6 +334,10 @@ def runPythonLinter(self):
if "tool" in parsed and "ruff" in parsed["tool"]:
linter = "ruff"

# Ruff can complain about noqa in shebang line
# added by sconsUtils to bin/ scripts. Need to ignore.
exclude_dirs.append("bin")

if linter is None:
flake8_cfg = os.path.join(root, "setup.cfg")
if os.path.exists(os.path.join(root, ".flake8")):
Expand Down Expand Up @@ -364,9 +371,8 @@ def runPythonLinter(self):
for path in glob.glob(os.path.join(self._tmpDir, "linter-*.log*")):
os.unlink(path)

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

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