diff options
| author | Herman Rimm <herman@rimm.ee> | 2024-05-05 08:26:42 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-05-29 14:23:28 +0200 |
| commit | 4514f4cf198e76bf4ca6df002ea3b38c516be5ce (patch) | |
| tree | 7f73e0951fe0ce05671da179061ae940b238ab1a /tests | |
| parent | 1d3d136bb0e2c0373f913adfe9a69be9df4a83b4 (diff) | |
scripts: lint: Add 'whole-file' option with ordering checker.
* guix/scripts/lint.scm (show-help): Describe option.
(%options): Add 'whole-file' option.
(guix-lint): Run checkers on packages defined in files.
* doc/guix.texi (Invoking guix lint): Document option.
* tests/guix-lint.sh: Define unordered package and invoke new option.
Change-Id: I52b48a9a6982d0c4a03416e3d070887c64716485
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #8796
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/guix-lint.sh | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/guix-lint.sh b/tests/guix-lint.sh index 97c2ea83fef..4a77315b3a2 100644 --- a/tests/guix-lint.sh +++ b/tests/guix-lint.sh | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # GNU Guix --- Functional package management for GNU | 1 | # GNU Guix --- Functional package management for GNU |
| 2 | # Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com> | 2 | # Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com> |
| 3 | # Copyright © 2026 Herman Rimm <herman@rimm.ee> | ||
| 3 | # | 4 | # |
| 4 | # This file is part of GNU Guix. | 5 | # This file is part of GNU Guix. |
| 5 | # | 6 | # |
| @@ -35,12 +36,20 @@ cat > "$module_dir/foo.scm"<<EOF | |||
| 35 | #:use-module (guix packages) | 36 | #:use-module (guix packages) |
| 36 | #:use-module (gnu packages base)) | 37 | #:use-module (gnu packages base)) |
| 37 | 38 | ||
| 39 | ;; This definition uses (the line number of) the hello package location | ||
| 40 | ;; instead of generating a new one. | ||
| 41 | (define-public hi hello) | ||
| 42 | |||
| 38 | (define-public dummy | 43 | (define-public dummy |
| 39 | (package (inherit hello) | 44 | (package (inherit hello) |
| 40 | (name "dummy") | 45 | (name "dummy") |
| 41 | (version "42") | 46 | (version "42") |
| 42 | (synopsis "dummy package") | 47 | (synopsis "dummy package") |
| 43 | (description "dummy package. Only used for testing purposes."))) | 48 | (description "dummy package. Only used for testing purposes."))) |
| 49 | |||
| 50 | (define-public bar | ||
| 51 | (package (inherit dummy) | ||
| 52 | (name "bar"))) | ||
| 44 | EOF | 53 | EOF |
| 45 | 54 | ||
| 46 | GUIX_PACKAGE_PATH="$module_dir" | 55 | GUIX_PACKAGE_PATH="$module_dir" |
| @@ -52,10 +61,11 @@ grep_warning () | |||
| 52 | echo $res | 61 | echo $res |
| 53 | } | 62 | } |
| 54 | 63 | ||
| 55 | # Three issues with the dummy package: | 64 | # Issues with the dummy package: |
| 56 | # 1) the synopsis starts with the package name; | 65 | # 1) the synopsis starts with the package name; |
| 57 | # 2) the synopsis starts with a lower-case letter; | 66 | # 2) the synopsis starts with a lower-case letter; |
| 58 | # 3) the description has a single space following the end-of-sentence period. | 67 | # 3) the description has a single space following the end-of-sentence period; |
| 68 | # 4) the alphabetically lesser bar package succeeds it. | ||
| 59 | 69 | ||
| 60 | out=`guix lint -c synopsis,description dummy 2>&1` | 70 | out=`guix lint -c synopsis,description dummy 2>&1` |
| 61 | test `grep_warning "$out"` -eq 3 | 71 | test `grep_warning "$out"` -eq 3 |
| @@ -69,6 +79,12 @@ test `grep_warning "$out"` -eq 1 | |||
| 69 | out=`guix lint -c description,synopsis dummy 2>&1` | 79 | out=`guix lint -c description,synopsis dummy 2>&1` |
| 70 | test `grep_warning "$out"` -eq 3 | 80 | test `grep_warning "$out"` -eq 3 |
| 71 | 81 | ||
| 82 | working_dir="$(pwd)" | ||
| 83 | cd "$module_dir" | ||
| 84 | out=`guix lint -c name -f foo.scm 2>&1` | ||
| 85 | cd "$working_dir" | ||
| 86 | test `echo "$out" | grep -E -c "breaks from alphabetical order"` -eq 1 | ||
| 87 | |||
| 72 | guix lint -c synopsis,invalid-checker dummy 2>&1 | \ | 88 | guix lint -c synopsis,invalid-checker dummy 2>&1 | \ |
| 73 | grep -q 'invalid-checker: invalid checker' | 89 | grep -q 'invalid-checker: invalid checker' |
| 74 | 90 | ||
