@zgeoff/checks 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +66 -2
- package/dist/cli.js +2285 -0
- package/package.json +42 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Geoff Whatley
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zgeoff/checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`zgeoff-check` runs the checks that every zgeoff repo shares, so a repo runs them with one package
|
|
4
|
+
script instead of a lint script of its own. Each check is a module with a name, a file glob, and a
|
|
5
|
+
function that returns findings. The runner prints each finding as `path:line: <check>: <message>`
|
|
6
|
+
and exits 1 when it prints any. With no arguments it checks every file that git tracks, and with a
|
|
7
|
+
list of files it checks only those. It runs from any folder in the repo: it reads the config at the
|
|
8
|
+
repo root, prints each path from the root, and reads a file argument from the folder it runs in. It
|
|
9
|
+
skips a listed file that does not exist, such as one the branch deletes, so a misspelled path checks
|
|
10
|
+
nothing.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
bun add -d @zgeoff/checks
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Add the script that the pre-push baseline and the standard list of the shared pull-request checks
|
|
19
|
+
call. Both skip the check with a notice while a repo lacks the script, so adding it turns the check
|
|
20
|
+
on. A repo that sets its own list in the `BUN_CHECK_SCRIPTS` variable adds `check` to that list as
|
|
21
|
+
well:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"scripts": {
|
|
26
|
+
"check": "zgeoff-check"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The package runs on Bun.
|
|
32
|
+
|
|
33
|
+
## Checks
|
|
34
|
+
|
|
35
|
+
| Check | Files | It runs | It needs on the PATH |
|
|
36
|
+
| ------- | --------- | ------------------------------ | --------------------- |
|
|
37
|
+
| `shell` | `**/*.sh` | `shellcheck -x` and `shfmt -d` | `shellcheck`, `shfmt` |
|
|
38
|
+
|
|
39
|
+
The `shell` check runs `shfmt` with no style flags, so `shfmt` reads its style from the repo's
|
|
40
|
+
`.editorconfig`. The `shfmt` finding sits at the first line of each block that `shfmt` would change.
|
|
41
|
+
`shellcheck` follows each `source` line into the file it names, and looks for that file beside the
|
|
42
|
+
script and then from the repo root. A sourced file is followed even when the run does not list it.
|
|
43
|
+
The shared pull-request checks install `shfmt` when their list runs `check`, and the runner image
|
|
44
|
+
already has `shellcheck`.
|
|
45
|
+
|
|
46
|
+
## Exit codes
|
|
47
|
+
|
|
48
|
+
- `0`: no check found a problem.
|
|
49
|
+
- `1`: a check found at least one problem.
|
|
50
|
+
- `2`: the run could not finish, so the runner prints the reason and no findings, even when some
|
|
51
|
+
checks found problems before it stopped. That happens when the config file breaks a rule, a check
|
|
52
|
+
needs a program that the PATH lacks, git or a check's program fails, a listed file cannot be read
|
|
53
|
+
for a reason other than being absent, or the command line holds an unknown option or `--help` with
|
|
54
|
+
files.
|
|
55
|
+
|
|
56
|
+
## Turning a check off
|
|
57
|
+
|
|
58
|
+
A repo turns a check off in `zgeoff-check.json` at its root, and each entry gives the reason:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"off": [{ "check": "shell", "reason": "the scripts are vendored from another project" }]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The runner rejects an entry with no reason, with a blank reason, or with a check name it does not
|
|
67
|
+
know, and it exits 2 without running any check. A check is either on or off for the whole repo.
|