You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sbuild/linting.md
+20-8Lines changed: 20 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,14 @@
1
1
# Linting
2
2
3
-
The `sbuild` tool includes a built-in linter that validates SBUILD recipes before execution. It checks for required fields, correct types, and valid values.
3
+
The `sbuild` tool includes a built-in linter that validates SBUILD recipes before execution. It checks for required fields, correct types, valid values, and runs [shellcheck](https://www.shellcheck.net/) on shell scripts.
4
+
5
+
## Prerequisites
6
+
7
+
-[shellcheck](https://www.shellcheck.net/) — used to validate `x_exec.run` and `x_exec.pkgver` blocks
8
+
9
+
```bash
10
+
soar install shellcheck
11
+
```
4
12
5
13
## Installation
6
14
@@ -19,8 +27,14 @@ sbuild lint ./myapp.yaml
19
27
# Validate multiple files
20
28
sbuild lint ./packages/*.yaml
21
29
22
-
# Validate with verbose output
23
-
sbuild lint -v ./myapp.yaml
30
+
# Validate in parallel
31
+
sbuild lint -p 8 ./packages/*.yaml
32
+
33
+
# Run in pkgver mode (execute pkgver scripts)
34
+
sbuild lint -P ./myapp.yaml
35
+
36
+
# Skip shellcheck validation
37
+
sbuild lint --no-shellcheck ./myapp.yaml
24
38
```
25
39
26
40
## What It Checks
@@ -29,8 +43,8 @@ sbuild lint -v ./myapp.yaml
29
43
-**Field types**: Arrays must be arrays, strings must be strings
30
44
-**Valid values**: `pkg_type` must be a recognized format, `category` must match FreeDesktop spec
31
45
-**Name constraints**: `pkg`, `pkg_id`, `app_id` only allow `[a-zA-Z0-9+\-_.]`
32
-
-**Shell syntax**: Validation of`x_exec.pkgver` and `x_exec.run` blocks via shellcheck
33
-
-**URL format**: `src_url`, `homepage`, and `build_asset.url` entries must be valid URLs
46
+
-**Shell syntax**: Validates`x_exec.pkgver` and `x_exec.run` blocks via shellcheck
47
+
-**URL format**: `src_url`, `homepage` entries must be valid URLs
34
48
-**Host triples**: `x_exec.host` entries must match `{arch}-{os}` format
35
49
36
50
## Common Errors
@@ -64,6 +78,4 @@ The `run` block must contain actual shell commands.
64
78
Before submitting an SBUILD to soarpkgs:
65
79
66
80
1. Run `sbuild lint` — no errors
67
-
2. Check YAML syntax with [yamllint](https://www.yamllint.com/)
68
-
3. Check shell syntax with [ShellCheck](https://www.shellcheck.net/)
0 commit comments