File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ variables:
1919include :
2020 - local : .gitlab/bots.yml
2121 - local : .gitlab/diff.yml
22+ - local : .gitlab/diff-warnings.yml
2223 - local : .gitlab/lint.yml
2324 - local : .gitlab/unit-tests.yml
2425 - local : .gitlab/build.yml
Original file line number Diff line number Diff line change 1+ check-revive-flags :
2+ stage : diff
3+ allow_failure : true
4+ rules :
5+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
6+ image :
7+ name : $CI_REGISTRY_GO/golang:$GO_VERSION
8+ entrypoint : [ "" ]
9+ tags :
10+ - go
11+ script :
12+ - git fetch origin ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
13+ # Parse the diff to find 'revive:disable' and track file/line info
14+ - |
15+ git diff -U0 origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}...HEAD | perl -ne '
16+ if (/^\+\+\+ b\/(.*)/) { $file = $1; }
17+ if (/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/) { $line = $1; }
18+ if (/^\+(.*revive:disable.*)/) {
19+ print "$file:$line:$1\n";
20+ $line++;
21+ } elsif (/^\+/) {
22+ $line++;
23+ }
24+ ' > found_disables.txt || true
25+
26+ - |
27+ if [ -s found_disables.txt ]; then
28+ echo "⚠️ Found 'revive:disable' in the following locations:"
29+ cat found_disables.txt
30+
31+ DESCRIPTION=$(cat found_disables.txt)
32+ junit-report add --status=failed --file=revive-check --message="revive:disable found" --description="$DESCRIPTION"
33+ exit 1
34+ else
35+ echo "✅ No 'revive:disable' tags found in the diff."
36+ junit-report add --status=ok --file=revive-check --message="clean" --description="No linter disables found."
37+ fi
38+ artifacts :
39+ when : always
40+ paths :
41+ - junit-report.xml
42+ reports :
43+ junit : junit-report.xml
You can’t perform that action at this time.
0 commit comments