-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Closed
Labels
Description
To prevent endless issues when running the linters locally (say, on specific versions of bash, or system tools having certain names, or a certain implementation of sed
, etc) , as well as for maintainability/reviewability, it's preferred for linter scripts to be written in Python.
Here is a list of scripts, feel free to pick up any that haven't been ported:
-
test/lint/check-doc.py
(added in [travis] Fail when documentation is outdated #7280, was always Python) -
test/lint/git-subtree-check.sh
(in progress in lint: convert git-subtree-check.sh to Python #25039) -
test/lint/lint-all.sh
(ported in tests: Portlint-all.sh
tolint-all.py
#24982) -
test/lint/lint-assertions.sh
(ported in lint: Converting lint-assertions.sh to lint-assertions.py #24856) -
test/lint/lint-circular-dependencies.sh
(ported in lint: Convert lint-circular-dependencies.sh to Python #24915) -
test/lint/lint-cpp.sh
(removed in lint: remove boost::bind lint #24785) -
test/lint/lint-files.py
(added in test: add new python linter to check file names and permissions #21740, was always Python) -
test/lint/lint-format-strings.sh
(ported in lint: convert format strings linter test to python #24802) -
test/lint/lint-git-commit-check.sh
(ported in lint: Convert lint-git-commit-check.sh to Python #24853) -
test/lint/lint-include-guards.sh
(ported in lint: Convert lint-include-guards.sh to Python #24902) -
test/lint/lint-includes.sh
(ported in lint: Convert lint-includes.sh to Python #24895) -
test/lint/lint-locale-dependence.sh
(ported in lint: Convert lint-locale-dependence.sh to Python #24932) -
test/lint/lint-logs.sh
(ported in lint: Convert lint-logs.sh to Python #24849) -
test/lint/lint-python-dead-code.py
(ported in lint: Convert Python dead code linter test to Python #24778) -
test/lint/lint-python-mutable-default-parameters.sh
(ported in lint: convert lint-python-mutable-default-parameters.sh to Python #24800) -
test/lint/lint-python.sh
(ported in lint: Convert Python linter to Python #24794) -
test/lint/lint-python-utf8-encoding.sh
(ported in lint: Convert lint-python-utf8-encoding.sh to Python #24916) -
test/lint/lint-qt.sh
(removed in lint: remove qt SIGNAL/SLOT lint #24790) -
test/lint/lint-shell-locale.sh
(ported in lint: convert shell locale linter test to Python #24929) -
test/lint/lint-shell.sh
(ported in test: port 'lint-shell.sh' to python #24840) -
test/lint/lint-spelling.py
(ported in lint: convert spellchecking lint test to python #24766) -
test/lint/lint-submodule.sh
(ported in lint: convert submodule linter test to Python #24803) -
test/lint/lint-tests.sh
(ported in lint: convert lint-tests.sh to python #24815) -
test/lint/lint-whitespace.sh
(ported in lint: Convert lint-whitespace.sh to Python #24844) -
test/lint/run-lint-format-strings.py
(added in build: Add format string linter #13705, was always Python)
Although I try to keep this post up to date, before starting on a linter, please first do a github search in PRs to see if a PR for that already exists.
Guidelines
- Don't forget to update
test/README.md
when the name of a script changes. - Avoid
shell=true
on subprocess calls. Remember that the point here is to avoid shell ambiguities. - If possible, avoid calling out to subprocesses at all and use what Python APIs provide (say,
grep
sed
awk
sha256sum
). An exception if this would introduce further dependencies that need to be installed. These are OK to use subprocess for:git
subcommands includinggit grep
—the alternative would be to require an extra dependency on a Python git module, also,git
can be assumed to be the same implementation everywhere- Other scripts in the source tree.
- External linters (
vulture
,codespell
, etc) that provide only a command-based interface.
- Some further recommendations about Python usage here: lint: convert spellchecking lint test to python #24766 (review)
Useful skills:
- Python
- Being able to read shell script
Want to work on this issue?
For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.
darosior and Eunoia1729brunoerg, darosior, Eunoia1729, Kvaciral and vincenzopalazzo