Skip to content

Commit 7b41b95

Browse files
committed
review: workflow_dispatch
1 parent 7e3919a commit 7b41b95

File tree

3 files changed

+107
-105
lines changed

3 files changed

+107
-105
lines changed

.github/new-linter-checklist.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
In order for a pull request adding a linter to be reviewed, the linter and the PR must follow some requirements.
2+
3+
- [ ] The CLA must be signed
4+
5+
### Pull Request Description
6+
7+
- [ ] It must have a link to the linter repository.
8+
- [ ] It must provide a short description of the linter.
9+
10+
### Linter
11+
12+
- [ ] It must not be a duplicate of another linter or a rule of a linter. (the team will help to verify that)
13+
- [ ] It must have a valid license (AGPL is not allowed) and the file must contain the required information by the license, ex: author, year, etc.
14+
- [ ] The linter repository must have a CI and tests.
15+
- [ ] It must use [`go/analysis`](https://golangci-lint.run/contributing/new-linters/).
16+
- [ ] It must have a valid tag, ex: `v1.0.0`, `v0.1.0`.
17+
- [ ] It must not contain `init()`.
18+
- [ ] It must not contain `panic()`.
19+
- [ ] It must not contain `log.fatal()`, `os.exit()`, or similar.
20+
- [ ] It must not modify the AST.
21+
- [ ] It must not have false positives/negatives. (the team will help to verify that)
22+
- [ ] It must have tests inside golangci-lint.
23+
- [ ] It must use Go <= 1.21
24+
25+
### The Linter Tests Inside Golangci-lint
26+
27+
- [ ] They must have at least one std lib import.
28+
- [ ] They must have integration tests without configuration (default).
29+
- [ ] They must have integration tests with configuration (if the linter has a configuration).
30+
31+
### `.golangci.next.reference.yml`
32+
33+
- [ ] The file `.golangci.next.reference.yml` must be updated.
34+
- [ ] The file `.golangci.reference.yml` must NOT be edited.
35+
- [ ] The linter must be added to the lists of available linters (alphabetical case-insensitive order).
36+
- `enable` and `disable` options
37+
- [ ] If the linter has a configuration, the exhaustive configuration of the linter must be added (alphabetical case-insensitive order)
38+
- The values must be different from the default ones.
39+
- The default values must be defined in a comment.
40+
- The option must have a short description.
41+
42+
### Others Requirements
43+
44+
- [ ] The files (tests and linter) inside golangci-lint must have the same name as the linter.
45+
- [ ] The `.golangci.yml` of golangci-lint itself must not be edited and the linter must not be added to this file.
46+
- [ ] The linters must be sorted in the alphabetical order (case-insensitive) in the `lintersdb/builder_linter.go` and `.golangci.next.reference.yml`.
47+
- [ ] The load mode (`WithLoadMode(...)`):
48+
- if the linter uses `goanalysis.LoadModeSyntax` -> no `WithLoadForGoAnalysis()` in `lintersdb/builder_linter.go`
49+
- if the linter uses `goanalysis.LoadModeTypesInfo`, it requires `WithLoadForGoAnalysis()` in `lintersdb/builder_linter.go`
50+
- [ ] The version in `WithSince(...)` must be the next minor version (`v1.X.0`) of golangci-lint.
51+
- [ ] `WithURL()` must contain the URL of the repository.
52+
53+
### Recommendations
54+
55+
- [ ] The file `jsonschema/golangci.next.jsonschema.json` should be updated.
56+
- [ ] The file `jsonschema/golangci.jsonschema.json` must NOT be edited.
57+
- [ ] The linter repository should have a readme and linting.
58+
- [ ] The linter should be published as a binary. (useful to diagnose bug origins)
59+
- [ ] The linter repository should have a `.gitignore` (IDE files, binaries, OS files, etc. should not be committed)
60+
- [ ] A tag should never be recreated.
61+
62+
---
63+
64+
The golangci-lint team will edit this comment to check the boxes before and during the review.
65+
66+
The code review will start after the completion of those checkboxes (except for the specific items that the team will help to verify).
67+
68+
The reviews should be addressed as commits (no squash).
69+
70+
If the author of the PR is a member of the golangci-lint team, he should not edit this message.
71+
72+
**This checklist does not imply that we will accept the linter.**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Add new linter checklist
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
pr:
7+
description: PR number
8+
required: true
9+
type: number
10+
11+
permissions:
12+
pull-requests: write
13+
14+
jobs:
15+
add-comment:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Add checklist
20+
run: |
21+
# This is just safety to not spam with new comments if the tag is
22+
# removed and added back multiple times maliciously. It will reset the
23+
# checklist but the previous values will be in the edit history.
24+
comment_exist=$(gh pr view "$NUMBER" \
25+
--json comments \
26+
--jq '.comments[].author | select(.login=="github-actions") | .login' \
27+
| wc -l)
28+
[ "$comment_exist" -gt 0 ] && edit_last="--edit-last"
29+
30+
# Comment on the PR with the checklist.
31+
gh pr comment "$NUMBER" --body "$(cat .github/new-linter-checklist.md)" $edit_last
32+
env:
33+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
GH_REPO: ${{ github.repository }}
35+
NUMBER: ${{ inputs.pr }}

.github/workflows/new_linter_checklist.yaml

-105
This file was deleted.

0 commit comments

Comments
 (0)