-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbase-justfile
More file actions
145 lines (114 loc) · 4.13 KB
/
base-justfile
File metadata and controls
145 lines (114 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# SPDX-FileCopyrightText: 2025 Digg - Agency for Digital Government
#
# SPDX-License-Identifier: CC0-1.0
# Example justfile for a minimal project (scripts/configs/docs only) using devbase-check
# Uses all base linters, no language-specific ones
devtools_repo := env("DEVBASE_CHECK_REPO", "https://github.com/diggsweden/devbase-check")
devtools_dir := env("XDG_DATA_HOME", env("HOME") + "/.local/share") + "/devbase-check"
lint := devtools_dir + "/linters"
colors := devtools_dir + "/utils/colors.sh"
# Color variables
CYAN_BOLD := "\\033[1;36m"
GREEN := "\\033[1;32m"
BLUE := "\\033[1;34m"
NC := "\\033[0m"
# ==================================================================================== #
# DEFAULT
# ==================================================================================== #
default:
@printf "{{CYAN_BOLD}} My Project{{NC}}\n\n"
@printf "Quick start: {{GREEN}}just setup-devtools{{NC}} | {{BLUE}}just verify{{NC}}\n\n"
@just --list --unsorted
# ==================================================================================== #
# SETUP
# ==================================================================================== #
# ▪ Setup devtools (clone on first run, then delegate to devbase-check)
[group('setup')]
setup-devtools:
@[ -d "{{devtools_dir}}" ] || { mkdir -p "$(dirname "{{devtools_dir}}")" && git clone --depth 1 "{{devtools_repo}}" "{{devtools_dir}}"; }
@"{{devtools_dir}}/scripts/setup.sh" "{{devtools_repo}}" "{{devtools_dir}}"
# ▪ Force-update devtools to latest release tag (or --ref <branch/tag/sha>)
[group('setup')]
update-devtools *ARGS:
@"{{devtools_dir}}/scripts/update.sh" "{{devtools_dir}}" {{ ARGS }}
# Check required tools
[group('setup')]
check-tools: _ensure-devtools
@{{devtools_dir}}/scripts/check-tools.sh --check-devtools mise git just rumdl yamlfmt actionlint gitleaks shellcheck shfmt gommitlint reuse hadolint
# Install tools via mise
[group('setup')]
tools-install: _ensure-devtools
@mise install
# ==================================================================================== #
# VERIFY
# ==================================================================================== #
# ▪ Run all checks
[group('verify')]
verify: _ensure-devtools check-tools lint-all
#!/usr/bin/env bash
set -euo pipefail
source "{{colors}}"
just_success "All checks passed"
# ==================================================================================== #
# LINT
# ==================================================================================== #
# ▪ Run all linters (uses base linters only)
[group('lint')]
lint-all: _ensure-devtools
@just --justfile {{devtools_dir}}/justfile lint-base
# Individual linter recipes (can be run separately)
[group('lint')]
lint-commits:
@{{lint}}/commits.sh
[group('lint')]
lint-secrets:
@{{lint}}/secrets.sh
[group('lint')]
lint-yaml:
@{{lint}}/yaml.sh check
[group('lint')]
lint-markdown:
@{{lint}}/markdown.sh check
[group('lint')]
lint-shell:
@{{lint}}/shell.sh
[group('lint')]
lint-shell-fmt:
@{{lint}}/shell-fmt.sh check
[group('lint')]
lint-actions:
@{{lint}}/github-actions.sh
[group('lint')]
lint-license:
@{{lint}}/license.sh
[group('lint')]
lint-container:
@{{lint}}/container.sh
[group('lint')]
lint-xml:
@{{lint}}/xml.sh
# ==================================================================================== #
# LINT-FIX
# ==================================================================================== #
# ▪ Fix all auto-fixable issues
[group('lint-fix')]
lint-fix: _ensure-devtools lint-yaml-fix lint-markdown-fix lint-shell-fmt-fix
#!/usr/bin/env bash
set -euo pipefail
source "{{colors}}"
just_success "All auto-fixes completed"
[group('lint-fix')]
lint-yaml-fix:
@{{lint}}/yaml.sh fix
[group('lint-fix')]
lint-markdown-fix:
@{{lint}}/markdown.sh fix
[group('lint-fix')]
lint-shell-fmt-fix:
@{{lint}}/shell-fmt.sh fix
# ==================================================================================== #
# INTERNAL
# ==================================================================================== #
[private]
_ensure-devtools:
@just setup-devtools