Skip to content

Commit 9496b96

Browse files
committed
fix: improve ui and docs
Signed-off-by: Josef Andersson <josef.andersson@digg.se>
1 parent 0957c8c commit 9496b96

File tree

11 files changed

+240
-89
lines changed

11 files changed

+240
-89
lines changed

README.md

Lines changed: 64 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ SPDX-License-Identifier: CC0-1.0
1313

1414
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/diggsweden/devbase-justkit/badge?style=for-the-badge)](https://scorecard.dev/viewer/?uri=github.com/diggsweden/devbase-justkit)
1515

16-
Reusable linting scripts for [Just](https://github.com/casey/just) task runner. Install once to `~/.local/share/devbase-justkit`, use across multiple projects.
16+
Reusable linting for [Just](https://github.com/casey/just) task runner. Install once, use across multiple projects.
1717

1818
## What it does
1919

20-
- Runs 10+ linters (shellcheck, yamlfmt, gitleaks, etc.) with one command
21-
- Skip what you don't need - no XML files? No XML linting
20+
- Runs linters (shellcheck, yamlfmt, gitleaks, etc.) with one command
21+
- Skips what you don't need - no XML files? No XML linting
2222
- Add language-specific linters (Java, Node/TypeScript) on top
2323
- Centralized linting - update once, affects all projects
2424
- No copy-paste of linter scripts and configs between projects
2525

2626
## Requirements
2727

28-
- [Just](https://github.com/casey/just) - task runner (install: `cargo install just` or see [Just installation](https://github.com/casey/just#installation))
29-
- [mise](https://mise.jdx.dev/) - tool version manager (install: `curl https://mise.run | sh` or see [mise installation](https://mise.jdx.dev/getting-started.html))
28+
- [Just](https://github.com/casey/just) - task runner
29+
- [mise](https://mise.jdx.dev/) - tool version manager
3030
- Git
3131

3232
## Quick Start
@@ -43,37 +43,38 @@ Reusable linting scripts for [Just](https://github.com/casey/just) task runner.
4343
just lint-all # Runs all linters
4444
```
4545

46-
That's it. The justfile calls scripts from `~/.local/share/devbase-justkit`.
46+
That's it.
4747

4848
### Updates
4949

5050
Run `just setup-devtools` again to check for updates:
5151

52-
- **Interactive**: Prompts "Update available: v1.2.3. Update? [y/N]"
52+
- **Interactive**: Prompts "Update available: vX.Y.Z. Update? [y/N]"
5353
- **CI/non-interactive**: Auto-updates to latest tag
5454

5555
## How it works
5656

5757
You get base linters for free. Add language-specific linters if needed.
58+
Disable base linters you dont want.
5859

5960
![lint-base composition](assets/lintbase.png)
6061

61-
- **`lint-base`** - 10 linters that work on any project (YAML, shell, secrets, etc.)
62+
- **`lint-base`** - General inters that work on most project (YAML, shell, secrets, etc.)
6263
- **`lint-all`** - Uses `lint-base`, override to add Java/Node/Python linters
63-
- **Individual recipes** - Run `just lint-yaml` or `just lint-shell` separately
64+
- **Individual recipes** - Run them seperatly, example `just lint-yaml` or `just lint-shell`.
6465

6566
### Base Linters
6667

6768
Run on every project. Skip automatically if no relevant files found:
6869

6970
| Recipe | Tool | Checks | Skips when |
7071
|--------|------|--------|------------|
71-
| `lint-commits` | conform | Commit message format | No commits to check |
72-
| `lint-secrets` | gitleaks | Secrets/credentials | Never (scans all) |
73-
| `lint-yaml` | yamlfmt | YAML formatting | Never (scans all) |
74-
| `lint-markdown` | rumdl | Markdown style | Never (scans all) |
75-
| `lint-shell` | shellcheck | Shell script bugs | No .sh files |
76-
| `lint-shell-fmt` | shfmt | Shell formatting | No .sh files |
72+
| `lint-commits` | conform | Commit message format | On default branch or no new commits |
73+
| `lint-secrets` | gitleaks | Secrets/credentials | Never (scans commits) |
74+
| `lint-yaml` | yamlfmt | YAML formatting | No .yml/.yaml files |
75+
| `lint-markdown` | rumdl | Markdown style | No .md files |
76+
| `lint-shell` | shellcheck | Shell script bugs | No .sh/.bash files |
77+
| `lint-shell-fmt` | shfmt | Shell formatting | No .sh/.bash files |
7778
| `lint-actions` | actionlint | GitHub Actions syntax | No .github/workflows/ |
7879
| `lint-license` | reuse | License compliance | Never (scans all) |
7980
| `lint-container` | hadolint | Dockerfile best practices | No Containerfile/Dockerfile |
@@ -105,33 +106,46 @@ Run on every project. Skip automatically if no relevant files found:
105106

106107
## Add language-specific linters
107108

108-
Override `lint-all` in your justfile to add Java, Node, Python, etc.:
109+
Add language-specific recipes to your justfile. The `verify.sh` script (called by `just verify`) **automatically detects** recipes with these names and includes them in the summary:
110+
111+
- Java: `lint-java-checkstyle`, `lint-java-pmd`, `lint-java-spotbugs`
112+
- Node: `lint-node-eslint`, `lint-node-format`, `lint-node-ts-types`
113+
114+
No need to override `lint-all` - just define the recipes and they're picked up automatically.
109115

110116
### Java/Maven Project
111117

112118
```just
113119
java_lint := devtools_dir + "/linters/java"
114120
115-
# Run all linters with summary (automatically detects Java linters)
116-
lint-all: _ensure-devtools
117-
@{{devtools_dir}}/scripts/verify.sh
118-
119121
# Run all Java linters together (convenience command)
122+
[group('lint')]
120123
lint-java:
121124
@{{java_lint}}/lint.sh
122125
123126
# Individual Java linters (auto-detected by verify.sh)
127+
[group('lint')]
124128
lint-java-checkstyle:
125129
@{{java_lint}}/checkstyle.sh
126130
131+
[group('lint')]
127132
lint-java-pmd:
128133
@{{java_lint}}/pmd.sh
129134
135+
[group('lint')]
130136
lint-java-spotbugs:
131137
@{{java_lint}}/spotbugs.sh
138+
139+
[group('lint')]
140+
lint-java-fmt:
141+
@{{java_lint}}/format.sh check
142+
143+
[group('fix')]
144+
lint-java-fmt-fix:
145+
@{{java_lint}}/format.sh fix
132146
```
133147

134-
When you run `just lint-all` or `just verify`, the verify script automatically detects `lint-java-checkstyle`, `lint-java-pmd`, and `lint-java-spotbugs` recipes and runs them individually with a summary table. You can also run `just lint-java` to execute all Java linters together.
148+
When you run `just verify`, the verify script automatically detects `lint-java-checkstyle`, `lint-java-pmd`, and `lint-java-spotbugs` recipes and includes them in the summary table. You can also run `just lint-java` to execute all Java linters together.
135149

136150
See [`examples/java-justfile`](examples/java-justfile) for a complete example.
137151

@@ -140,86 +154,55 @@ See [`examples/java-justfile`](examples/java-justfile) for a complete example.
140154
```just
141155
node_lint := devtools_dir + "/linters/node"
142156
143-
# Run all linters with summary (automatically detects Node linters)
144-
lint-all: _ensure-devtools
145-
@{{devtools_dir}}/scripts/verify.sh
146-
147157
# Run all Node linters together (convenience command)
158+
[group('lint')]
148159
lint-node:
149160
@{{node_lint}}/lint.sh
150161
151162
# Individual Node linters (auto-detected by verify.sh)
163+
[group('lint')]
152164
lint-node-eslint:
153165
@{{node_lint}}/eslint.sh
154166
167+
[group('lint')]
155168
lint-node-format:
156169
@{{node_lint}}/format.sh check
157170
171+
[group('lint')]
158172
lint-node-ts-types:
159173
@{{node_lint}}/types.sh
174+
175+
[group('fix')]
176+
lint-node-format-fix:
177+
@{{node_lint}}/format.sh fix
160178
```
161179

162-
When you run `just lint-all` or `just verify`, the verify script automatically detects `lint-node-*` recipes and runs them individually with a summary table. You can also run `just lint-node` to execute all Node linters together.
180+
When you run `just verify`, the verify script automatically detects `lint-node-*` recipes and includes them in the summary table. You can also run `just lint-node` to execute all Node linters together.
163181

164182
See [`examples/node-justfile`](examples/node-justfile) for a complete example.
165183

166-
### Python Project
167-
168-
```just
169-
# Extend base linters with Python linters
170-
lint-all: _ensure-devtools lint-python
171-
#!/usr/bin/env bash
172-
source "{{colors}}"
173-
just --justfile {{devtools_dir}}/justfile lint-base
174-
just_success "All linting checks completed"
175-
176-
lint-python:
177-
#!/usr/bin/env bash
178-
source "{{colors}}"
179-
just_header "Python Linting" "ruff check"
180-
ruff check .
181-
ruff format --check .
182-
just_success "Python linting passed"
183-
```
184-
185184
### Go Project
186185

187186
```just
188-
# Extend base linters with Go linters
189-
lint-all: _ensure-devtools lint-go
190-
#!/usr/bin/env bash
191-
source "{{colors}}"
192-
just --justfile {{devtools_dir}}/justfile lint-base
193-
just_success "All linting checks completed"
194-
187+
# Go linter (add to verify.sh detection if needed)
188+
[group('lint')]
195189
lint-go:
196-
#!/usr/bin/env bash
197-
source "{{colors}}"
198-
just_header "Go Linting" "golangci-lint run"
199190
go vet ./...
200191
golangci-lint run
201-
just_success "Go linting passed"
202192
```
203193

204194
### Rust Project
205195

206196
```just
207-
# Extend base linters with Rust linters
208-
lint-all: _ensure-devtools lint-rust
209-
#!/usr/bin/env bash
210-
source "{{colors}}"
211-
just --justfile {{devtools_dir}}/justfile lint-base
212-
just_success "All linting checks completed"
213-
197+
# Rust linters (add to verify.sh detection if needed)
198+
[group('lint')]
214199
lint-rust:
215-
#!/usr/bin/env bash
216-
source "{{colors}}"
217-
just_header "Rust Linting" "cargo clippy"
218200
cargo fmt --check
219201
cargo clippy -- -D warnings
220-
just_success "Rust linting passed"
221202
```
222203

204+
> **Note:** Go and Rust linters are not auto-detected by `verify.sh` yet. You can add detection in `scripts/verify.sh` following the Java/Node pattern, or run them separately with `just lint-go` / `just lint-rust`.
205+
223206
### Minimal Project (base linters only)
224207

225208
```just
@@ -239,10 +222,6 @@ lint-all: _ensure-devtools
239222
lint-java-checkstyle:
240223
@{{java_lint}}/checkstyle.sh
241224
242-
# Python linters
243-
lint-python:
244-
ruff check .
245-
246225
# Node linters
247226
lint-node-eslint:
248227
@{{node_lint}}/eslint.sh
@@ -254,25 +233,31 @@ All defined `lint-*` recipes are automatically detected and included in the summ
254233

255234
You can override any linter recipe in your project's justfile to customize behavior or skip checks.
256235

257-
### Skip a Linter
236+
### Disable or Skip a Linter
258237

259-
To skip a linter completely, override the recipe and output a message containing "Skip" or "Skipping". The verify script will mark it as skipped (yellow `-`) in the summary:
238+
Two options to disable a linter:
239+
240+
**Option 1: Hide completely** - empty recipe (no output), linter won't appear in summary:
260241

261242
```just
262-
# Skip license compliance checks
243+
[group('lint')]
263244
lint-license:
264-
@echo "Skipping license check"
245+
```
265246

266-
# Skip a Java linter
267-
lint-java-checkstyle:
268-
@echo "Skipping Checkstyle"
247+
**Option 2: Show as skipped** - output message containing "Skip", shown as skipped in summary:
248+
249+
```just
250+
[group('lint')]
251+
lint-license:
252+
@echo "Skipping license check - not required for this project"
269253
```
270254

271255
**Result in summary:**
272256

273257
```text
258+
# Option 1: not shown at all
259+
# Option 2:
274260
License reuse - skipped
275-
Java Checkstyle checkstyle - skipped
276261
```
277262

278263
### Customize a Linter

REUSE.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ version = 1
88
[[annotations]]
99
path = [
1010
"README.md",
11+
"docs/DEVELOPMENT.md",
1112
"REUSE.toml",
1213
".mise.toml",
1314
"justfile",

docs/DEVELOPMENT.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Development Guide
2+
3+
## Prerequisites - Linux
4+
5+
1. Install [mise](https://mise.jdx.dev/) (manages linting tools):
6+
7+
```bash
8+
curl https://mise.run | sh
9+
```
10+
11+
2. Activate mise in your shell:
12+
13+
```bash
14+
# For bash - add to ~/.bashrc
15+
eval "$(mise activate bash)"
16+
17+
# For zsh - add to ~/.zshrc
18+
eval "$(mise activate zsh)"
19+
20+
# For fish - add to ~/.config/fish/config.fish
21+
mise activate fish | source
22+
```
23+
24+
Then restart your terminal.
25+
26+
3. Install pipx (needed for reuse license linting):
27+
28+
```bash
29+
# Debian/Ubuntu
30+
sudo apt install pipx
31+
```
32+
33+
4. Install project tools:
34+
35+
```bash
36+
mise install
37+
```
38+
39+
5. Run quality checks:
40+
41+
```bash
42+
just verify
43+
```
44+
45+
## Prerequisites - macOS
46+
47+
1. Install [mise](https://mise.jdx.dev/) (manages linting tools):
48+
49+
```bash
50+
brew install mise
51+
```
52+
53+
2. Activate mise in your shell:
54+
55+
```bash
56+
# For zsh - add to ~/.zshrc
57+
eval "$(mise activate zsh)"
58+
59+
# For bash - add to ~/.bashrc
60+
eval "$(mise activate bash)"
61+
62+
# For fish - add to ~/.config/fish/config.fish
63+
mise activate fish | source
64+
```
65+
66+
Then restart your terminal.
67+
68+
3. Install newer bash than macOS default:
69+
70+
```bash
71+
brew install bash
72+
```
73+
74+
4. Install pipx (needed for reuse license linting):
75+
76+
```bash
77+
brew install pipx
78+
```
79+
80+
5. Install project tools:
81+
82+
```bash
83+
mise install
84+
```
85+
86+
6. Run quality checks:
87+
88+
```bash
89+
just verify
90+
```
91+
92+
## Running Tests
93+
94+
```bash
95+
just test
96+
```
97+
98+
## Available Commands
99+
100+
Run `just` to see all available commands.

0 commit comments

Comments
 (0)