Bug 1954758 - [lint] Remove ruff hack to lint non-Python files, r=linter-reviewers,sylvestre DONTBUILD
This is now supported by Ruff natively. Differential Revision: https://phabricator.services.mozilla.com/D241999
This commit is contained in:
@@ -21,6 +21,7 @@ lint.ignore = [
|
||||
"E1", "E4", "E5", "W2", "W5"
|
||||
]
|
||||
builtins = ["gdb"]
|
||||
extend-include = ["*.configure"]
|
||||
exclude = [
|
||||
# These paths should be triaged and either fixed or moved to the list below.
|
||||
"devtools/shared",
|
||||
@@ -36,7 +37,6 @@ exclude = [
|
||||
"layout/reftests/w3c-css",
|
||||
"layout/style",
|
||||
"media/libdav1d/generate_source.py",
|
||||
"moz.configure",
|
||||
"netwerk/dns/prepare_tlds.py",
|
||||
"netwerk/protocol/http/make_incoming_tables.py",
|
||||
"python/l10n/fluent_migrations",
|
||||
|
||||
@@ -9,7 +9,6 @@ import re
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from mozlint import result
|
||||
|
||||
@@ -66,19 +65,7 @@ def lint(paths, config, log, **lintargs):
|
||||
if not paths:
|
||||
return {"results": results, "fixed": fixed}
|
||||
|
||||
# Currently ruff only lints non `.py` files if they are explicitly passed
|
||||
# in. So we need to find any non-py files manually. This can be removed
|
||||
# after https://github.com/charliermarsh/ruff/issues/3410 is fixed.
|
||||
exts = [e for e in config["extensions"] if e != "py"]
|
||||
non_py_files = []
|
||||
for path in paths:
|
||||
p = Path(path)
|
||||
if not p.is_dir():
|
||||
continue
|
||||
for ext in exts:
|
||||
non_py_files.extend([str(f) for f in p.glob(f"**/*.{ext}")])
|
||||
|
||||
args = ["ruff", "check", "--force-exclude"] + paths + non_py_files
|
||||
args = ["ruff", "check", "--force-exclude"] + paths
|
||||
|
||||
if config.get("exclude"):
|
||||
args.append(f"--extend-exclude={','.join(config['exclude'])}")
|
||||
|
||||
Reference in New Issue
Block a user