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"
|
"E1", "E4", "E5", "W2", "W5"
|
||||||
]
|
]
|
||||||
builtins = ["gdb"]
|
builtins = ["gdb"]
|
||||||
|
extend-include = ["*.configure"]
|
||||||
exclude = [
|
exclude = [
|
||||||
# These paths should be triaged and either fixed or moved to the list below.
|
# These paths should be triaged and either fixed or moved to the list below.
|
||||||
"devtools/shared",
|
"devtools/shared",
|
||||||
@@ -36,7 +37,6 @@ exclude = [
|
|||||||
"layout/reftests/w3c-css",
|
"layout/reftests/w3c-css",
|
||||||
"layout/style",
|
"layout/style",
|
||||||
"media/libdav1d/generate_source.py",
|
"media/libdav1d/generate_source.py",
|
||||||
"moz.configure",
|
|
||||||
"netwerk/dns/prepare_tlds.py",
|
"netwerk/dns/prepare_tlds.py",
|
||||||
"netwerk/protocol/http/make_incoming_tables.py",
|
"netwerk/protocol/http/make_incoming_tables.py",
|
||||||
"python/l10n/fluent_migrations",
|
"python/l10n/fluent_migrations",
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import re
|
|||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from mozlint import result
|
from mozlint import result
|
||||||
|
|
||||||
@@ -66,19 +65,7 @@ def lint(paths, config, log, **lintargs):
|
|||||||
if not paths:
|
if not paths:
|
||||||
return {"results": results, "fixed": fixed}
|
return {"results": results, "fixed": fixed}
|
||||||
|
|
||||||
# Currently ruff only lints non `.py` files if they are explicitly passed
|
args = ["ruff", "check", "--force-exclude"] + paths
|
||||||
# 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
|
|
||||||
|
|
||||||
if config.get("exclude"):
|
if config.get("exclude"):
|
||||||
args.append(f"--extend-exclude={','.join(config['exclude'])}")
|
args.append(f"--extend-exclude={','.join(config['exclude'])}")
|
||||||
|
|||||||
Reference in New Issue
Block a user