diff --git a/HACKING.md b/HACKING.md index 0ddba8e098ae..63122d32c186 100644 --- a/HACKING.md +++ b/HACKING.md @@ -180,14 +180,14 @@ down after the fact — without re-running tests — using something like: There are also static code and syntax checks which you should run often: - test/static-code + test/common/static-code It is highly recommended to set up a git pre-push hook, to avoid pushing PRs that will fail on trivial errors: ln -s ../../tools/git-hook-pre-push .git/hooks/pre-push -This calls `test/static-code` for each commit you're trying to push. +This calls `test/common/static-code` for each commit you're trying to push. You can also set up a post-commit hook to do the same, after each commit: @@ -255,7 +255,7 @@ The tests require at least `pytest` 7.0.0 or higher to run. Cockpit uses [ESLint](https://eslint.org/) to automatically check JavaScript code style in `.js` and `.jsx` files. -The linter is executed as part of `test/static-code`. +The linter is executed as part of `test/common/static-code`. For developer convenience, the ESLint can be started explicitly by: @@ -277,13 +277,13 @@ unused identifiers, and other JavaScript-related issues. Cockpit uses [Stylelint](https://stylelint.io/) to automatically check CSS code style in `.css` and `.scss` files. -The linter is executed as part of `test/static-code`. +The linter is executed as part of `test/common/static-code`. For developer convenience, the Stylelint can be started explicitly by: npm run stylelint -But note that this only covers files in `pkg/`. `test/static-code` covers +But note that this only covers files in `pkg/`. `test/common/static-code` covers *all* (S)CSS files tracked in git. Some rule violations can be automatically fixed by running: diff --git a/Makefile.am b/Makefile.am index 22fa06617601..a0c79ef0f3f0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -78,7 +78,7 @@ distcheck-hook:: # ----------------------------------------------------------------------------- TESTS = \ - test/static-code \ + test/common/static-code \ $(NULL) clean-local:: diff --git a/pyproject.toml b/pyproject.toml index ccc59c85df4c..6dd0c60ddf5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -220,10 +220,10 @@ deps = pytest: pytest-cov pytest: pytest-timeout pytest: pytest-xdist -allowlist_externals = test/static-code +allowlist_externals = test/common/static-code setenv = NO_QUNIT=1 commands = pytest: python3 -m pytest -opythonpath= {posargs} - lint: test/static-code --tap + lint: test/common/static-code --tap """ diff --git a/test/static-code b/test/common/static-code similarity index 100% rename from test/static-code rename to test/common/static-code diff --git a/tools/git-hook-post-commit b/tools/git-hook-post-commit index 7d84cbdd6f8a..73d7368e697e 100755 --- a/tools/git-hook-post-commit +++ b/tools/git-hook-post-commit @@ -14,9 +14,9 @@ readonly commit="$(git rev-parse --verify "${1:-HEAD}^{commit}")" tmpdir="tmp/pre-push/${commit}" rm -rf "tmp/pre-push/${commit}" -# unpack all of the changed files, plus the test/static-code from that commit +# unpack all of the changed files, plus the test/common/static-code from that commit changed_files="$(git diff-tree --no-commit-id --no-renames --diff-filter=d --name-only -r "${commit}" --)" -required_files="$(git cat-file -p "${commit}":test/static-code | sed -n 's/^# requires: //p') test/static-code" +required_files="$(git cat-file -p "${commit}":test/common/static-code | sed -n 's/^# requires: //p') test/common/static-code" git archive --prefix="${tmpdir}/" "${commit}" -- ${changed_files} ${required_files} | tar x # check that node_modules always gets updated with package.json @@ -32,7 +32,7 @@ fi cd "${tmpdir}" git init -qb main . git add . - WITH_PARTIAL_TREE=1 test/static-code + WITH_PARTIAL_TREE=1 test/common/static-code ) # paranoia: make sure we delete what we think we will