mirror of
https://github.com/cockpit-project/cockpit.git
synced 2026-11-03 21:49:50 -09:00
test: Move static-code into common/
It conceptually fits better there, as it's shared by all external projects. That makes importing easier as it doesn't have to be enumerated separately in COCKPIT_REPO_FILES any more.
This commit is contained in:
parent
093e39c861
commit
e395923115
5 changed files with 11 additions and 11 deletions
10
HACKING.md
10
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:
|
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
|
It is highly recommended to set up a git pre-push hook, to avoid pushing PRs
|
||||||
that will fail on trivial errors:
|
that will fail on trivial errors:
|
||||||
|
|
||||||
ln -s ../../tools/git-hook-pre-push .git/hooks/pre-push
|
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:
|
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
|
Cockpit uses [ESLint](https://eslint.org/) to automatically check JavaScript
|
||||||
code style in `.js` and `.jsx` files.
|
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:
|
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
|
Cockpit uses [Stylelint](https://stylelint.io/) to automatically check CSS code
|
||||||
style in `.css` and `.scss` files.
|
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:
|
For developer convenience, the Stylelint can be started explicitly by:
|
||||||
|
|
||||||
npm run stylelint
|
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.
|
*all* (S)CSS files tracked in git.
|
||||||
|
|
||||||
Some rule violations can be automatically fixed by running:
|
Some rule violations can be automatically fixed by running:
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ distcheck-hook::
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
TESTS = \
|
TESTS = \
|
||||||
test/static-code \
|
test/common/static-code \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
clean-local::
|
clean-local::
|
||||||
|
|
|
||||||
|
|
@ -220,10 +220,10 @@ deps =
|
||||||
pytest: pytest-cov
|
pytest: pytest-cov
|
||||||
pytest: pytest-timeout
|
pytest: pytest-timeout
|
||||||
pytest: pytest-xdist
|
pytest: pytest-xdist
|
||||||
allowlist_externals = test/static-code
|
allowlist_externals = test/common/static-code
|
||||||
setenv =
|
setenv =
|
||||||
NO_QUNIT=1
|
NO_QUNIT=1
|
||||||
commands =
|
commands =
|
||||||
pytest: python3 -m pytest -opythonpath= {posargs}
|
pytest: python3 -m pytest -opythonpath= {posargs}
|
||||||
lint: test/static-code --tap
|
lint: test/common/static-code --tap
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ readonly commit="$(git rev-parse --verify "${1:-HEAD}^{commit}")"
|
||||||
tmpdir="tmp/pre-push/${commit}"
|
tmpdir="tmp/pre-push/${commit}"
|
||||||
rm -rf "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}" --)"
|
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
|
git archive --prefix="${tmpdir}/" "${commit}" -- ${changed_files} ${required_files} | tar x
|
||||||
|
|
||||||
# check that node_modules always gets updated with package.json
|
# check that node_modules always gets updated with package.json
|
||||||
|
|
@ -32,7 +32,7 @@ fi
|
||||||
cd "${tmpdir}"
|
cd "${tmpdir}"
|
||||||
git init -qb main .
|
git init -qb main .
|
||||||
git add .
|
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
|
# paranoia: make sure we delete what we think we will
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue