From 9d49b8959a969a6fe8c72fa570cbfc4b4c7ebfc4 Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Tue, 6 Aug 2024 09:37:42 -0700 Subject: [PATCH] Chore: Move linting from coala to pre-commit Issue-ID: LF-Jira RELENG-4799 Change-Id: I561f1c3165e36cbb9f49b2312ab00cfc6ac9f7f6 Signed-off-by: Eric Ball --- .coafile | 53 ------------------------------------------------- .pre-commit-config.yaml | 17 ++++++++++++++++ tox.ini | 18 +++++++---------- 3 files changed, 24 insertions(+), 64 deletions(-) delete mode 100644 .coafile create mode 100644 .pre-commit-config.yaml diff --git a/.coafile b/.coafile deleted file mode 100644 index 5191c49..0000000 --- a/.coafile +++ /dev/null @@ -1,53 +0,0 @@ -[all] -ignore = .tox/**, - .git/**, - .gitignore, - .gitreview, - .gitmodules, - **.sw?, - **.orig - -[all.GitCommit] -bears = GitCommitBear -ignore_length_regex = Signed-off-by, - Also-by, - Co-authored-by, - http://, - https:// - -[all.reStructuredText] -bears = SpaceConsistencyBear -files = docs/**.rst -use_spaces = true -ignore = .git/**, - .tox/**, - src/type3_AndroidCloud/**, - src/foundation/** - -[all.ShellCheck] -bears = ShellCheckBear,SpaceConsistencyBear -files = **.sh -shell = bash -use_spaces = true -ignore = src/type3_AndroidCloud/**, - src/foundation/** - -[all.YAML] -bears = YAMLLintBear -files = **.yaml, **.yml -use_spaces = true -ignore_length_regex = ^.*https?:// -yamllint_config = .yamllint.conf -ignore = src/use_cases/**, - src/type3_AndroidCloud/**, - src/foundation/** - - -[all.Python] -bears = PyLintBear -files = **.py -use_spaces = true -pylint_disable = E0401, W0401, C0111 -ignore = src/use_cases/**, - src/type3_AndroidCloud/**, - src/foundation/** diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..569a97b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +--- +# To simplify and beautify the long regex for exclude, newlines (which will be +# parsed into spaces) are followed by '*', in order to allow the regex to read +# this whitespace as "0 or more spaces". +exclude: >- + src/use_cases/seba_on_arm/src_repo/.*| + *\.git.* +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + + - repo: https://github.com/jorisroovers/gitlint + rev: v0.19.1 + hooks: + - id: gitlint diff --git a/tox.ini b/tox.ini index 0e89eb8..1bb1153 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ minversion = 1.6 envlist = docs, docs-linkcheck, - coala, + pre-commit skipsdist = true passenv = TOX_WORK_DIR toxworkdir = {env:TOX_WORK_DIR:/tmp/v} @@ -20,21 +20,17 @@ deps = -rdocs/requirements.txt commands = sphinx-build -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html echo "Generated docs available in {toxinidir}/docs/_build/html" -whitelist_externals = echo +allowlist_externals = echo [testenv:docs-linkcheck] deps = -rdocs/requirements.txt commands = sphinx-build -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck -[testenv:coala] +[testenv:pre-commit] basepython = python3 -install_command = python -m pip install --no-cache-dir {opts} {packages} -whitelist_externals = rm +allowlist_externals = rm deps = - coala - coala-bears - pygments~=2.3.1 - requests~=2.21.0 + pre-commit commands = - rm -rf src/use_cases/seba_on_arm/src_repo/ - coala --non-interactive + pre-commit install + pre-commit run --all-files -- 2.16.6