summaryrefslogtreecommitdiffstats
path: root/tools/lint/python
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /tools/lint/python
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/lint/python')
-rw-r--r--tools/lint/python/l10n_lint.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/tools/lint/python/l10n_lint.py b/tools/lint/python/l10n_lint.py
index 158cb5f7e6..2ba2278d22 100644
--- a/tools/lint/python/l10n_lint.py
+++ b/tools/lint/python/l10n_lint.py
@@ -40,15 +40,14 @@ def lint_strings(name, paths, lintconfig, **lintargs):
extensions = lintconfig.get("extensions")
# Load l10n.toml configs
- l10nconfigs = load_configs(lintconfig, root, l10n_base, name)
+ l10nconfigs = load_configs(lintconfig["l10n_configs"], root, l10n_base, name)
- # Check include paths in l10n.yml if it's in our given paths
- # Only the l10n.yml will show up here, but if the l10n.toml files
- # change, we also get the l10n.yml as the toml files are listed as
- # support files.
+ # If l10n.yml is included in the provided paths, validate it against the
+ # TOML files, then remove it to avoid parsing it as a localizable resource.
if lintconfig["path"] in paths:
results = validate_linter_includes(lintconfig, l10nconfigs, lintargs)
paths.remove(lintconfig["path"])
+ lintconfig["include"].remove(mozpath.relpath(lintconfig["path"], root))
else:
results = []
@@ -60,8 +59,7 @@ def lint_strings(name, paths, lintconfig, **lintargs):
all_files.append(fileobj.path)
if fp.isfile:
all_files.append(p)
- # Filter again, our directories might have picked up files the
- # explicitly excluded in the l10n.yml configuration.
+ # Filter out files explicitly excluded in the l10n.yml configuration.
# `browser/locales/en-US/firefox-l10n.js` is a good example.
all_files, _ = pathutils.filterpaths(
lintargs["root"],
@@ -70,7 +68,8 @@ def lint_strings(name, paths, lintconfig, **lintargs):
exclude=exclude,
extensions=extensions,
)
- # These should be excluded in l10n.yml
+ # Filter again, our directories might have picked up files that should be
+ # excluded in l10n.yml
skips = {p for p in all_files if not parser.hasParser(p)}
results.extend(
result.from_config(
@@ -142,11 +141,11 @@ def strings_repo_setup(repo: str, name: str):
fh.flush()
-def load_configs(lintconfig, root, l10n_base, locale):
+def load_configs(l10n_configs, root, l10n_base, locale):
"""Load l10n configuration files specified in the linter configuration."""
configs = []
env = {"l10n_base": l10n_base}
- for toml in lintconfig["l10n_configs"]:
+ for toml in l10n_configs:
cfg = TOMLParser().parse(
mozpath.join(root, toml), env=env, ignore_missing_includes=True
)