@wneng/create-keel 0.3.2 → 0.3.3
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/templates/ci-gitee/files/pipeline.yml +150 -16
- package/src/templates/ci-gitee/fragment.yaml +1 -1
- package/src/templates/ci-github/files/ci.yml +199 -6
- package/src/templates/ci-github/fragment.yaml +1 -1
- package/src/templates/contracts-base/files/_spectral.yaml +21 -0
- package/src/templates/contracts-base/fragment.yaml +4 -1
- package/src/templates/server-go/files/_golangci.yml +41 -0
- package/src/templates/server-go/fragment.yaml +4 -1
- package/src/templates/server-java/files/checkstyle.xml +62 -0
- package/src/templates/server-java/files/pom.xml +57 -0
- package/src/templates/server-java/fragment.yaml +4 -1
- package/src/templates/server-node/files/_eslintrc.cjs +20 -0
- package/src/templates/server-node/files/_prettierrc +12 -0
- package/src/templates/server-node/files/package.json +14 -1
- package/src/templates/server-node/fragment.yaml +7 -1
- package/src/templates/server-python/files/pyproject.toml +44 -0
- package/src/templates/web-react/files/_eslintrc.cjs +34 -0
- package/src/templates/web-react/files/_prettierrc +12 -0
- package/src/templates/web-react/files/package.json +11 -1
- package/src/templates/web-react/fragment.yaml +7 -1
- package/src/templates/web-vue/files/_eslintrc.cjs +28 -0
- package/src/templates/web-vue/files/_prettierrc +12 -0
- package/src/templates/web-vue/fragment.yaml +7 -1
package/package.json
CHANGED
|
@@ -1,18 +1,152 @@
|
|
|
1
|
+
# Gitee Pipelines for <%= it.options.projectName %>
|
|
2
|
+
#
|
|
3
|
+
# Generated by `@wneng/create-keel` (Contract First + Vibe Coding).
|
|
4
|
+
#
|
|
5
|
+
# Gitee Pipelines and GitHub Actions speak different YAML dialects;
|
|
6
|
+
# this file uses the documented `stages + jobs` shape supported by
|
|
7
|
+
# Gitee. If your team migrates to GitHub Actions, regenerate with
|
|
8
|
+
# `--ci github` instead of porting by hand.
|
|
9
|
+
#
|
|
10
|
+
# Each stage runs sequentially; jobs within a stage run in parallel.
|
|
11
|
+
# Failure in any stage aborts the pipeline.
|
|
12
|
+
|
|
1
13
|
name: ci
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
14
|
+
|
|
15
|
+
stages:
|
|
16
|
+
- lint
|
|
17
|
+
- test
|
|
18
|
+
- scan
|
|
19
|
+
|
|
7
20
|
jobs:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
governance-lint:
|
|
22
|
+
stage: lint
|
|
23
|
+
image: node:20-alpine
|
|
24
|
+
script:
|
|
25
|
+
- |
|
|
26
|
+
if [ -f tools/governance-lint/index.js ]; then
|
|
27
|
+
node tools/governance-lint/index.js --strict
|
|
28
|
+
else
|
|
29
|
+
echo "tools/governance-lint/ not present; skipping"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
contract-lint:
|
|
33
|
+
stage: lint
|
|
34
|
+
image: node:20-alpine
|
|
35
|
+
script:
|
|
36
|
+
<% if (it.options.contract === 'rest' || it.options.contract === 'rest+events') { %> - npx --yes @stoplight/spectral-cli lint contracts/openapi/api.yaml
|
|
37
|
+
<% } %><% if (it.options.contract === 'rest+events' || it.options.contract === 'events-only') { %> - |
|
|
38
|
+
if [ -f contracts/asyncapi/asyncapi.yaml ]; then
|
|
39
|
+
npx --yes @stoplight/spectral-cli lint contracts/asyncapi/asyncapi.yaml
|
|
40
|
+
fi
|
|
41
|
+
<% } %> - |
|
|
42
|
+
for s in contracts/**/*.schema.json; do
|
|
43
|
+
[ -e "$s" ] || continue
|
|
44
|
+
npx --yes ajv-cli compile -s "$s"
|
|
45
|
+
done
|
|
46
|
+
|
|
47
|
+
<% if (it.options.backend === 'node') { %> server-node:
|
|
48
|
+
stage: test
|
|
49
|
+
image: node:20-alpine
|
|
50
|
+
script:
|
|
51
|
+
- cd server
|
|
52
|
+
- npm ci
|
|
53
|
+
- npm run lint --if-present
|
|
54
|
+
- npm run typecheck --if-present
|
|
55
|
+
- npm test --if-present
|
|
56
|
+
<% } %><% if (it.options.backend === 'java') { %> server-java:
|
|
57
|
+
stage: test
|
|
58
|
+
image: maven:3.9-eclipse-temurin-21
|
|
59
|
+
script:
|
|
60
|
+
- cd server
|
|
61
|
+
- mvn -B verify
|
|
62
|
+
<% } %><% if (it.options.backend === 'go') { %> server-go:
|
|
63
|
+
stage: test
|
|
64
|
+
image: golang:1.22-alpine
|
|
65
|
+
script:
|
|
66
|
+
- cd server
|
|
67
|
+
- go vet ./...
|
|
68
|
+
- go test ./...
|
|
69
|
+
<% } %><% if (it.options.backend === 'python') { %> server-python:
|
|
70
|
+
stage: test
|
|
71
|
+
image: python:3.12-slim
|
|
72
|
+
script:
|
|
73
|
+
- cd server
|
|
74
|
+
- pip install -e .[dev] || pip install -e .
|
|
75
|
+
- ruff check .
|
|
76
|
+
- ruff format --check .
|
|
77
|
+
- pytest -q
|
|
78
|
+
<% } %>
|
|
79
|
+
<% if (it.options.frontend === 'react' || it.options.frontend === 'vue') { %> web:
|
|
80
|
+
stage: test
|
|
81
|
+
image: node:20-alpine
|
|
82
|
+
script:
|
|
83
|
+
- cd web
|
|
84
|
+
- npm ci
|
|
85
|
+
- npm run lint --if-present
|
|
86
|
+
- npm run typecheck --if-present || npx tsc --noEmit
|
|
87
|
+
- npm test --if-present
|
|
88
|
+
- npm run build
|
|
89
|
+
<% } %>
|
|
90
|
+
<% if (it.options.mobile === 'flutter') { %> mobile-flutter:
|
|
91
|
+
stage: test
|
|
92
|
+
image: cirrusci/flutter:stable
|
|
93
|
+
script:
|
|
94
|
+
- cd mobile
|
|
95
|
+
- flutter pub get
|
|
96
|
+
- flutter analyze
|
|
97
|
+
- flutter test
|
|
98
|
+
<% } %><% if (it.options.mobile === 'react-native') { %> mobile-react-native:
|
|
99
|
+
stage: test
|
|
100
|
+
image: node:20-alpine
|
|
101
|
+
script:
|
|
102
|
+
- cd mobile
|
|
103
|
+
- npm ci
|
|
104
|
+
- npm run lint --if-present
|
|
105
|
+
- npm test --if-present
|
|
106
|
+
<% } %>
|
|
107
|
+
<% if (it.options.miniapp === 'wechat') { %> miniapp-wechat:
|
|
108
|
+
stage: test
|
|
109
|
+
image: node:20-alpine
|
|
110
|
+
script:
|
|
111
|
+
- cd miniapp
|
|
112
|
+
- |
|
|
113
|
+
if [ -f tsconfig.json ]; then npx tsc --noEmit; else echo "no tsconfig"; fi
|
|
114
|
+
<% } %>
|
|
115
|
+
<% if (it.options.agent === 'rust-desktop') { %> agent-rust:
|
|
116
|
+
stage: test
|
|
117
|
+
image: rust:1.78
|
|
118
|
+
script:
|
|
119
|
+
- cd agent
|
|
120
|
+
- cargo fmt --check
|
|
121
|
+
- cargo clippy --all-targets -- -D warnings
|
|
122
|
+
- cargo test
|
|
123
|
+
<% } %>
|
|
124
|
+
secret-scan:
|
|
125
|
+
stage: scan
|
|
126
|
+
image: zricethezav/gitleaks:latest
|
|
127
|
+
script:
|
|
128
|
+
- gitleaks detect --redact --no-git -v
|
|
129
|
+
|
|
130
|
+
<% if (it.options.backend === 'node' || it.options.frontend === 'react' || it.options.frontend === 'vue' || it.options.mobile === 'react-native' || it.options.miniapp === 'wechat') { %> npm-audit:
|
|
131
|
+
stage: scan
|
|
132
|
+
image: node:20-alpine
|
|
133
|
+
script:
|
|
134
|
+
<% if (it.options.backend === 'node') { %> - cd server && npm audit --audit-level=high && cd ..
|
|
135
|
+
<% } %><% if (it.options.frontend === 'react' || it.options.frontend === 'vue') { %> - cd web && npm audit --audit-level=high && cd ..
|
|
136
|
+
<% } %><% if (it.options.mobile === 'react-native') { %> - cd mobile && npm audit --audit-level=high && cd ..
|
|
137
|
+
<% } %><% } %>
|
|
138
|
+
<% if (it.options.backend === 'go') { %> go-vulncheck:
|
|
139
|
+
stage: scan
|
|
140
|
+
image: golang:1.22-alpine
|
|
141
|
+
script:
|
|
142
|
+
- cd server
|
|
143
|
+
- go install golang.org/x/vuln/cmd/govulncheck@latest
|
|
144
|
+
- govulncheck ./...
|
|
145
|
+
<% } %><% if (it.options.backend === 'python') { %> pip-audit:
|
|
146
|
+
stage: scan
|
|
147
|
+
image: python:3.12-slim
|
|
148
|
+
script:
|
|
149
|
+
- cd server
|
|
150
|
+
- pip install pip-audit
|
|
151
|
+
- pip-audit
|
|
152
|
+
<% } %>
|
|
@@ -4,14 +4,207 @@ on:
|
|
|
4
4
|
branches: [main]
|
|
5
5
|
pull_request:
|
|
6
6
|
branches: [main]
|
|
7
|
+
|
|
8
|
+
# CI for <%= it.options.projectName %>
|
|
9
|
+
#
|
|
10
|
+
# Generated by `@wneng/create-keel` (Contract First + Vibe Coding).
|
|
11
|
+
# Each job below is independent so a failure in one (e.g. server) does
|
|
12
|
+
# not skip the others. The `governance-lint` and `contract-lint` jobs
|
|
13
|
+
# are always present; per-environment jobs are conditionally included
|
|
14
|
+
# based on the project's options.
|
|
15
|
+
#
|
|
16
|
+
# Tweak version pins / cache keys / extra steps freely; do not delete
|
|
17
|
+
# governance-lint or contract-lint without an ADR.
|
|
18
|
+
|
|
7
19
|
jobs:
|
|
8
|
-
|
|
20
|
+
governance-lint:
|
|
9
21
|
runs-on: ubuntu-latest
|
|
10
22
|
steps:
|
|
11
23
|
- uses: actions/checkout@v4
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
- uses: actions/setup-node@v4
|
|
25
|
+
with:
|
|
26
|
+
node-version: '20'
|
|
27
|
+
- name: governance-lint
|
|
28
|
+
run: |
|
|
29
|
+
if [ -f tools/governance-lint/index.js ]; then
|
|
30
|
+
node tools/governance-lint/index.js --strict
|
|
31
|
+
else
|
|
32
|
+
echo "tools/governance-lint/ not present; skipping"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
secret-scan:
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
with:
|
|
40
|
+
fetch-depth: 0
|
|
41
|
+
- name: gitleaks
|
|
42
|
+
uses: gitleaks/gitleaks-action@v2
|
|
43
|
+
env:
|
|
44
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
45
|
+
|
|
46
|
+
contract-lint:
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v4
|
|
50
|
+
- uses: actions/setup-node@v4
|
|
51
|
+
with:
|
|
52
|
+
node-version: '20'
|
|
53
|
+
<% if (it.options.contract === 'rest' || it.options.contract === 'rest+events') { %> - name: spectral lint (OpenAPI)
|
|
54
|
+
run: npx --yes @stoplight/spectral-cli lint contracts/openapi/api.yaml
|
|
55
|
+
<% } %><% if (it.options.contract === 'rest+events' || it.options.contract === 'events-only') { %> - name: spectral lint (AsyncAPI)
|
|
56
|
+
run: |
|
|
57
|
+
if [ -f contracts/asyncapi/asyncapi.yaml ]; then
|
|
58
|
+
npx --yes @stoplight/spectral-cli lint contracts/asyncapi/asyncapi.yaml
|
|
59
|
+
else
|
|
60
|
+
echo "no asyncapi.yaml; skipping"
|
|
61
|
+
fi
|
|
62
|
+
<% } %> - name: json-schema validate
|
|
63
|
+
run: |
|
|
64
|
+
shopt -s nullglob
|
|
65
|
+
for s in contracts/**/*.schema.json; do
|
|
66
|
+
npx --yes ajv-cli compile -s "$s"
|
|
67
|
+
done
|
|
68
|
+
|
|
69
|
+
<% if (it.options.backend === 'node') { %> server-node:
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
defaults:
|
|
72
|
+
run:
|
|
73
|
+
working-directory: server
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/checkout@v4
|
|
76
|
+
- uses: actions/setup-node@v4
|
|
77
|
+
with:
|
|
78
|
+
node-version: '20'
|
|
79
|
+
cache: npm
|
|
80
|
+
cache-dependency-path: server/package-lock.json
|
|
81
|
+
- run: npm ci
|
|
82
|
+
- run: npm run lint --if-present
|
|
83
|
+
- run: npm run typecheck --if-present
|
|
84
|
+
- run: npm test --if-present
|
|
85
|
+
- name: dependency scan
|
|
86
|
+
run: npm audit --audit-level=high
|
|
87
|
+
<% } %><% if (it.options.backend === 'java') { %> server-java:
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
defaults:
|
|
90
|
+
run:
|
|
91
|
+
working-directory: server
|
|
92
|
+
steps:
|
|
93
|
+
- uses: actions/checkout@v4
|
|
94
|
+
- uses: actions/setup-java@v4
|
|
95
|
+
with:
|
|
96
|
+
distribution: temurin
|
|
97
|
+
java-version: '21'
|
|
98
|
+
cache: maven
|
|
99
|
+
- run: mvn -B verify
|
|
100
|
+
<% } %><% if (it.options.backend === 'go') { %> server-go:
|
|
101
|
+
runs-on: ubuntu-latest
|
|
102
|
+
defaults:
|
|
103
|
+
run:
|
|
104
|
+
working-directory: server
|
|
105
|
+
steps:
|
|
106
|
+
- uses: actions/checkout@v4
|
|
107
|
+
- uses: actions/setup-go@v5
|
|
108
|
+
with:
|
|
109
|
+
go-version: '1.22'
|
|
110
|
+
- run: go vet ./...
|
|
111
|
+
- run: go test ./...
|
|
112
|
+
- name: govulncheck
|
|
113
|
+
run: |
|
|
114
|
+
go install golang.org/x/vuln/cmd/govulncheck@latest
|
|
115
|
+
govulncheck ./...
|
|
116
|
+
<% } %><% if (it.options.backend === 'python') { %> server-python:
|
|
117
|
+
runs-on: ubuntu-latest
|
|
118
|
+
defaults:
|
|
119
|
+
run:
|
|
120
|
+
working-directory: server
|
|
121
|
+
steps:
|
|
122
|
+
- uses: actions/checkout@v4
|
|
123
|
+
- uses: actions/setup-python@v5
|
|
124
|
+
with:
|
|
125
|
+
python-version: '3.12'
|
|
126
|
+
- run: pip install -e .[dev] || pip install -e .
|
|
127
|
+
- run: ruff check .
|
|
128
|
+
- run: ruff format --check .
|
|
129
|
+
- run: mypy . || true
|
|
130
|
+
- run: pytest -q
|
|
131
|
+
- name: pip-audit
|
|
132
|
+
run: pip install pip-audit && pip-audit
|
|
133
|
+
<% } %>
|
|
134
|
+
<% if (it.options.frontend === 'react' || it.options.frontend === 'vue') { %> web:
|
|
135
|
+
runs-on: ubuntu-latest
|
|
136
|
+
defaults:
|
|
137
|
+
run:
|
|
138
|
+
working-directory: web
|
|
139
|
+
steps:
|
|
140
|
+
- uses: actions/checkout@v4
|
|
141
|
+
- uses: actions/setup-node@v4
|
|
142
|
+
with:
|
|
143
|
+
node-version: '20'
|
|
144
|
+
cache: npm
|
|
145
|
+
cache-dependency-path: web/package-lock.json
|
|
146
|
+
- run: npm ci
|
|
147
|
+
- run: npm run lint --if-present
|
|
148
|
+
- run: npm run typecheck --if-present || npx tsc --noEmit
|
|
149
|
+
- run: npm test --if-present
|
|
150
|
+
- run: npm run build
|
|
16
151
|
- name: dependency scan
|
|
17
|
-
run:
|
|
152
|
+
run: npm audit --audit-level=high
|
|
153
|
+
<% } %>
|
|
154
|
+
<% if (it.options.mobile === 'flutter') { %> mobile-flutter:
|
|
155
|
+
runs-on: ubuntu-latest
|
|
156
|
+
defaults:
|
|
157
|
+
run:
|
|
158
|
+
working-directory: mobile
|
|
159
|
+
steps:
|
|
160
|
+
- uses: actions/checkout@v4
|
|
161
|
+
- uses: subosito/flutter-action@v2
|
|
162
|
+
with:
|
|
163
|
+
channel: stable
|
|
164
|
+
- run: flutter pub get
|
|
165
|
+
- run: flutter analyze
|
|
166
|
+
- run: flutter test
|
|
167
|
+
<% } %><% if (it.options.mobile === 'react-native') { %> mobile-react-native:
|
|
168
|
+
runs-on: ubuntu-latest
|
|
169
|
+
defaults:
|
|
170
|
+
run:
|
|
171
|
+
working-directory: mobile
|
|
172
|
+
steps:
|
|
173
|
+
- uses: actions/checkout@v4
|
|
174
|
+
- uses: actions/setup-node@v4
|
|
175
|
+
with:
|
|
176
|
+
node-version: '20'
|
|
177
|
+
cache: npm
|
|
178
|
+
cache-dependency-path: mobile/package-lock.json
|
|
179
|
+
- run: npm ci
|
|
180
|
+
- run: npm run lint --if-present
|
|
181
|
+
- run: npm test --if-present
|
|
182
|
+
<% } %>
|
|
183
|
+
<% if (it.options.miniapp === 'wechat') { %> miniapp-wechat:
|
|
184
|
+
runs-on: ubuntu-latest
|
|
185
|
+
defaults:
|
|
186
|
+
run:
|
|
187
|
+
working-directory: miniapp
|
|
188
|
+
steps:
|
|
189
|
+
- uses: actions/checkout@v4
|
|
190
|
+
- uses: actions/setup-node@v4
|
|
191
|
+
with:
|
|
192
|
+
node-version: '20'
|
|
193
|
+
- name: typecheck
|
|
194
|
+
run: |
|
|
195
|
+
if [ -f tsconfig.json ]; then npx tsc --noEmit; else echo "no tsconfig"; fi
|
|
196
|
+
<% } %>
|
|
197
|
+
<% if (it.options.agent === 'rust-desktop') { %> agent-rust:
|
|
198
|
+
runs-on: ubuntu-latest
|
|
199
|
+
defaults:
|
|
200
|
+
run:
|
|
201
|
+
working-directory: agent
|
|
202
|
+
steps:
|
|
203
|
+
- uses: actions/checkout@v4
|
|
204
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
205
|
+
with:
|
|
206
|
+
components: clippy, rustfmt
|
|
207
|
+
- run: cargo fmt --check
|
|
208
|
+
- run: cargo clippy --all-targets -- -D warnings
|
|
209
|
+
- run: cargo test
|
|
210
|
+
<% } %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Spectral lint config for OpenAPI / AsyncAPI contracts.
|
|
2
|
+
#
|
|
3
|
+
# Source of truth referenced by docs/governance/integrations.md.
|
|
4
|
+
# CI runs `npx @stoplight/spectral-cli lint contracts/openapi/api.yaml`
|
|
5
|
+
# and aborts on errors.
|
|
6
|
+
|
|
7
|
+
extends:
|
|
8
|
+
- 'spectral:oas'
|
|
9
|
+
|
|
10
|
+
rules:
|
|
11
|
+
# Make these MUST-have for keel projects.
|
|
12
|
+
operation-operationId: error
|
|
13
|
+
operation-tag-defined: error
|
|
14
|
+
contact-properties: warn
|
|
15
|
+
info-contact: warn
|
|
16
|
+
info-license: warn
|
|
17
|
+
|
|
18
|
+
# Don't enforce description on every parameter — too noisy on first
|
|
19
|
+
# commit. Re-enable per project once the API stabilises.
|
|
20
|
+
operation-description: off
|
|
21
|
+
operation-parameters: warn
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: contracts-base
|
|
2
|
-
version: 1.
|
|
2
|
+
version: 1.1.0
|
|
3
3
|
appliesWhen: {}
|
|
4
4
|
priority: 10
|
|
5
5
|
files:
|
|
@@ -12,6 +12,9 @@ files:
|
|
|
12
12
|
- from: files/CHANGELOG.md
|
|
13
13
|
to: contracts/CHANGELOG.md
|
|
14
14
|
render: false
|
|
15
|
+
- from: files/_spectral.yaml
|
|
16
|
+
to: contracts/.spectral.yaml
|
|
17
|
+
render: false
|
|
15
18
|
- from: files/dictionaries/domain-models.yaml
|
|
16
19
|
to: contracts/dictionaries/domain-models.yaml
|
|
17
20
|
render: false
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# golangci-lint config for <%= it.options.projectName %>-server.
|
|
2
|
+
# Source of truth referenced by docs/03-工程规范与研发基础设施/coding-style-go.md.
|
|
3
|
+
# CI runs `golangci-lint run` and aborts on errors.
|
|
4
|
+
|
|
5
|
+
run:
|
|
6
|
+
timeout: 3m
|
|
7
|
+
tests: true
|
|
8
|
+
|
|
9
|
+
linters:
|
|
10
|
+
disable-all: true
|
|
11
|
+
enable:
|
|
12
|
+
- errcheck
|
|
13
|
+
- gosimple
|
|
14
|
+
- govet
|
|
15
|
+
- ineffassign
|
|
16
|
+
- staticcheck
|
|
17
|
+
- unused
|
|
18
|
+
- revive
|
|
19
|
+
- gofmt
|
|
20
|
+
- goimports
|
|
21
|
+
- misspell
|
|
22
|
+
- unconvert
|
|
23
|
+
- nakedret
|
|
24
|
+
|
|
25
|
+
linters-settings:
|
|
26
|
+
revive:
|
|
27
|
+
rules:
|
|
28
|
+
- name: package-comments
|
|
29
|
+
- name: exported
|
|
30
|
+
arguments: ['checkPrivateReceivers', 'sayRepetitiveInsteadOfStutters']
|
|
31
|
+
goimports:
|
|
32
|
+
local-prefixes: example.com
|
|
33
|
+
|
|
34
|
+
issues:
|
|
35
|
+
exclude-use-default: false
|
|
36
|
+
max-issues-per-linter: 0
|
|
37
|
+
max-same-issues: 0
|
|
38
|
+
exclude-rules:
|
|
39
|
+
- path: _test\.go
|
|
40
|
+
linters:
|
|
41
|
+
- errcheck
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: server-go
|
|
2
|
-
version: 1.
|
|
2
|
+
version: 1.1.0
|
|
3
3
|
appliesWhen:
|
|
4
4
|
backend: go
|
|
5
5
|
priority: 30
|
|
@@ -13,6 +13,9 @@ files:
|
|
|
13
13
|
- from: files/main.go
|
|
14
14
|
to: server/cmd/server/main.go
|
|
15
15
|
render: false
|
|
16
|
+
- from: files/_golangci.yml
|
|
17
|
+
to: server/.golangci.yml
|
|
18
|
+
render: true
|
|
16
19
|
- from: files/generated-gitkeep
|
|
17
20
|
to: server/generated/.gitkeep
|
|
18
21
|
render: false
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<!DOCTYPE module PUBLIC
|
|
3
|
+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
|
4
|
+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
|
5
|
+
<!--
|
|
6
|
+
Checkstyle config for <%= it.options.projectName %>-server.
|
|
7
|
+
Source of truth referenced by:
|
|
8
|
+
docs/03-工程规范与研发基础设施/coding-style-java.md
|
|
9
|
+
|
|
10
|
+
Tweak rules with care. CI runs `mvn verify` which invokes
|
|
11
|
+
`maven-checkstyle-plugin` and aborts on errors.
|
|
12
|
+
-->
|
|
13
|
+
<module name="Checker">
|
|
14
|
+
<property name="charset" value="UTF-8"/>
|
|
15
|
+
<property name="severity" value="error"/>
|
|
16
|
+
<property name="fileExtensions" value="java, properties, xml"/>
|
|
17
|
+
|
|
18
|
+
<module name="FileTabCharacter">
|
|
19
|
+
<property name="eachLine" value="true"/>
|
|
20
|
+
</module>
|
|
21
|
+
|
|
22
|
+
<module name="LineLength">
|
|
23
|
+
<property name="max" value="120"/>
|
|
24
|
+
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
|
25
|
+
</module>
|
|
26
|
+
|
|
27
|
+
<module name="TreeWalker">
|
|
28
|
+
<!-- Imports -->
|
|
29
|
+
<module name="AvoidStarImport"/>
|
|
30
|
+
<module name="UnusedImports"/>
|
|
31
|
+
|
|
32
|
+
<!-- Naming -->
|
|
33
|
+
<module name="PackageName">
|
|
34
|
+
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
|
|
35
|
+
</module>
|
|
36
|
+
<module name="TypeName"/>
|
|
37
|
+
<module name="MethodName"/>
|
|
38
|
+
<module name="LocalVariableName"/>
|
|
39
|
+
<module name="ConstantName"/>
|
|
40
|
+
|
|
41
|
+
<!-- Whitespace / blocks -->
|
|
42
|
+
<module name="EmptyBlock"/>
|
|
43
|
+
<module name="LeftCurly"/>
|
|
44
|
+
<module name="RightCurly"/>
|
|
45
|
+
<module name="NeedBraces"/>
|
|
46
|
+
|
|
47
|
+
<!-- JavaDoc on public types and methods -->
|
|
48
|
+
<module name="MissingJavadocType">
|
|
49
|
+
<property name="scope" value="public"/>
|
|
50
|
+
</module>
|
|
51
|
+
<module name="JavadocMethod">
|
|
52
|
+
<property name="accessModifiers" value="public"/>
|
|
53
|
+
</module>
|
|
54
|
+
|
|
55
|
+
<!-- Misc -->
|
|
56
|
+
<module name="ModifierOrder"/>
|
|
57
|
+
<module name="RedundantModifier"/>
|
|
58
|
+
<module name="MissingSwitchDefault"/>
|
|
59
|
+
<module name="EqualsHashCode"/>
|
|
60
|
+
<module name="StringLiteralEquality"/>
|
|
61
|
+
</module>
|
|
62
|
+
</module>
|
|
@@ -92,6 +92,63 @@
|
|
|
92
92
|
<groupId>org.springframework.boot</groupId>
|
|
93
93
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
94
94
|
</plugin>
|
|
95
|
+
|
|
96
|
+
<!--
|
|
97
|
+
Checkstyle: enforces naming, structure, JavaDoc rules from
|
|
98
|
+
docs/03-工程规范与研发基础设施/coding-style-java.md.
|
|
99
|
+
Aborts the build on violations during `mvn verify`.
|
|
100
|
+
-->
|
|
101
|
+
<plugin>
|
|
102
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
103
|
+
<artifactId>maven-checkstyle-plugin</artifactId>
|
|
104
|
+
<version>3.5.0</version>
|
|
105
|
+
<configuration>
|
|
106
|
+
<configLocation>checkstyle.xml</configLocation>
|
|
107
|
+
<consoleOutput>true</consoleOutput>
|
|
108
|
+
<failsOnError>true</failsOnError>
|
|
109
|
+
<linkXRef>false</linkXRef>
|
|
110
|
+
</configuration>
|
|
111
|
+
<executions>
|
|
112
|
+
<execution>
|
|
113
|
+
<id>verify-checkstyle</id>
|
|
114
|
+
<phase>verify</phase>
|
|
115
|
+
<goals>
|
|
116
|
+
<goal>check</goal>
|
|
117
|
+
</goals>
|
|
118
|
+
</execution>
|
|
119
|
+
</executions>
|
|
120
|
+
</plugin>
|
|
121
|
+
|
|
122
|
+
<!--
|
|
123
|
+
Spotless: format checker (Google Java Format AOSP style).
|
|
124
|
+
`mvn spotless:check` is wired into verify; run
|
|
125
|
+
`mvn spotless:apply` locally to auto-format.
|
|
126
|
+
-->
|
|
127
|
+
<plugin>
|
|
128
|
+
<groupId>com.diffplug.spotless</groupId>
|
|
129
|
+
<artifactId>spotless-maven-plugin</artifactId>
|
|
130
|
+
<version>2.43.0</version>
|
|
131
|
+
<configuration>
|
|
132
|
+
<java>
|
|
133
|
+
<googleJavaFormat>
|
|
134
|
+
<version>1.22.0</version>
|
|
135
|
+
<style>AOSP</style>
|
|
136
|
+
</googleJavaFormat>
|
|
137
|
+
<removeUnusedImports/>
|
|
138
|
+
<trimTrailingWhitespace/>
|
|
139
|
+
<endWithNewline/>
|
|
140
|
+
</java>
|
|
141
|
+
</configuration>
|
|
142
|
+
<executions>
|
|
143
|
+
<execution>
|
|
144
|
+
<id>verify-spotless</id>
|
|
145
|
+
<phase>verify</phase>
|
|
146
|
+
<goals>
|
|
147
|
+
<goal>check</goal>
|
|
148
|
+
</goals>
|
|
149
|
+
</execution>
|
|
150
|
+
</executions>
|
|
151
|
+
</plugin>
|
|
95
152
|
</plugins>
|
|
96
153
|
</build>
|
|
97
154
|
</project>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: server-java
|
|
2
|
-
version: 1.
|
|
2
|
+
version: 1.2.0
|
|
3
3
|
appliesWhen:
|
|
4
4
|
backend: java
|
|
5
5
|
priority: 30
|
|
@@ -19,6 +19,9 @@ files:
|
|
|
19
19
|
- from: files/application-test.yaml
|
|
20
20
|
to: server/src/test/resources/application-test.yaml
|
|
21
21
|
render: false
|
|
22
|
+
- from: files/checkstyle.xml
|
|
23
|
+
to: server/checkstyle.xml
|
|
24
|
+
render: true
|
|
22
25
|
- from: files/generated-gitkeep
|
|
23
26
|
to: server/generated/.gitkeep
|
|
24
27
|
render: false
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint configuration for the Node + TypeScript server.
|
|
3
|
+
*
|
|
4
|
+
* Source of truth referenced by:
|
|
5
|
+
* docs/03-工程规范与研发基础设施/coding-style-typescript.md
|
|
6
|
+
*/
|
|
7
|
+
module.exports = {
|
|
8
|
+
root: true,
|
|
9
|
+
env: { node: true, es2022: true },
|
|
10
|
+
parser: '@typescript-eslint/parser',
|
|
11
|
+
parserOptions: { ecmaVersion: 2022, sourceType: 'module' },
|
|
12
|
+
plugins: ['@typescript-eslint'],
|
|
13
|
+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
|
|
14
|
+
rules: {
|
|
15
|
+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
16
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
17
|
+
'@typescript-eslint/consistent-type-imports': 'warn',
|
|
18
|
+
},
|
|
19
|
+
ignorePatterns: ['dist', 'node_modules', 'generated'],
|
|
20
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/prettierrc",
|
|
3
|
+
"printWidth": 100,
|
|
4
|
+
"tabWidth": 2,
|
|
5
|
+
"useTabs": false,
|
|
6
|
+
"semi": true,
|
|
7
|
+
"singleQuote": true,
|
|
8
|
+
"trailingComma": "all",
|
|
9
|
+
"bracketSpacing": true,
|
|
10
|
+
"arrowParens": "always",
|
|
11
|
+
"endOfLine": "lf"
|
|
12
|
+
}
|