Skip to content

Commit 9a9f843

Browse files
committed
Replace linting setup with flint
Adopt grafana/flint v0.2.0 to consolidate lint tasks previously sourced from grafana/docker-otel-lgtm and opentelemetry-java-contrib into a single set of reusable tasks. - Replace 9 lint tasks in mise.toml with 4 flint-based tasks - Merge super-linter.yml and lint-rest.yml into unified lint.yml workflow - Add Renovate custom manager for flint SHA-pinned URL tracking - Update CONTRIBUTING.md and CLAUDE.md lint command references - Clean up .editorconfig stale path references Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent 8c229df commit 9a9f843

7 files changed

Lines changed: 41 additions & 62 deletions

File tree

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ max_line_length = 120
1818
indent_size = 4
1919
max_line_length = 120
2020

21-
[{.mise/tasks/build-release.sh,.mise/tasks/lint/super-linter.sh,.mise/tasks/lint/links-in-modified-files.sh,.github/workflows/multi-version-test.yml,.github/workflows/lint-rest.yml}]
21+
[{.mise/tasks/build-release.sh,.github/workflows/multi-version-test.yml}]
2222
max_line_length = 200

.github/renovate.json5

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,12 @@
4040
managerFilePatterns: ["/^mise\\.toml$/"],
4141
matchStrings: ['# renovate: datasource=(?<datasource>[a-z-]+?)(?: depName=(?<depName>.+?))?(?: packageName=(?<packageName>.+?))?(?: versioning=(?<versioning>[a-z-]+?))?\\s.+?_VERSION="?(?<currentValue>[^@"]+?)(?:@(?<currentDigest>sha256:[a-f0-9]+))?"?\\s'],
4242
},
43+
{
44+
customType: "regex",
45+
description: "Update flint version in raw.githubusercontent.com URLs (pinned to SHA)",
46+
managerFilePatterns: ["/^mise\\.toml$/"],
47+
matchStrings: ["https://raw\\.githubusercontent\\.com/(?<depName>[^/]+/[^/]+)/(?<currentDigest>[a-f0-9]{40})/.*#\\s*(?<currentValue>v\\S+)"],
48+
datasourceTemplate: "github-tags",
49+
},
4350
],
4451
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Lint What Super Linter Can't
2+
name: Lint
33

44
on:
55
pull_request:
@@ -8,16 +8,20 @@ permissions: {}
88

99
jobs:
1010
lint:
11+
runs-on: ubuntu-24.04
12+
1113
permissions:
1214
contents: read
13-
runs-on: ubuntu-24.04
15+
1416
steps:
15-
- name: Check out
17+
- name: Checkout code
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1619
with:
1720
persist-credentials: false
18-
fetch-depth: 0 # needed for merge-base used in lint:links-in-modified-files
19-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20-
- uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
21+
fetch-depth: 0
22+
23+
- name: Setup mise
24+
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
2125

2226
- name: Remap main branch URLs to PR branch for link checking
2327
env:
@@ -27,8 +31,8 @@ jobs:
2731
sed -i "/^remap = \[$/a\ \"https://github.com/prometheus/client_java/blob/main/(.*) https://github.com/${PR_HEAD_REPO}/blob/${GITHUB_HEAD_REF}/\$1\"," .github/config/lychee.toml
2832
sed -i "/^remap = \[$/a\ \"https://github.com/prometheus/client_java/tree/main/(.*) https://github.com/${PR_HEAD_REPO}/tree/${GITHUB_HEAD_REF}/\$1\"," .github/config/lychee.toml
2933
30-
- name: Lint for pull requests
34+
- name: Lint
3135
env:
3236
GITHUB_TOKEN: ${{ github.token }}
3337
GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
34-
run: mise run lint:rest-ci
38+
run: mise run lint

.github/workflows/super-linter.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

CLAUDE.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ Pre-built instrumentations: `prometheus-metrics-instrumentation-jvm`, `-caffeine
9191

9292
### Non-Java Files (Markdown, YAML, JSON, shell scripts, etc.)
9393

94-
- **ALWAYS** run `mise run lint:super-linter` after modifying non-Java files
94+
- **ALWAYS** run `mise run lint` after modifying non-Java files
95+
(runs super-linter + link checking + BOM check)
96+
- `mise run fix` auto-fixes lint issues
9597
- Super-linter will **auto-fix** many issues (formatting, trailing whitespace, etc.)
9698
- It only reports ERROR-level issues (configured via `LOG_LEVEL=ERROR` in `.github/super-linter.env`)
9799
- Common issues caught:
@@ -107,7 +109,8 @@ Pre-built instrumentations: `prometheus-metrics-instrumentation-jvm`, `-caffeine
107109
mise run build
108110

109111
# After modifying non-Java files (run BEFORE committing)
110-
mise run lint:super-linter
112+
mise run lint
113+
# or to auto-fix: mise run fix
111114
```
112115

113116
## Testing

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ Run `./mvnw spotless:apply` to format the code (only changed files) before commi
2121

2222
Or run all the linters:
2323

24-
`mise run lint:super-linter`
24+
`mise run lint`
25+
26+
To autofix linting issues:
27+
28+
`mise run fix`
2529

2630
## Running Tests
2731

mise.toml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,38 +47,22 @@ run = "./mvnw verify"
4747
description = "build all modules without tests"
4848
run = "./mvnw install -DskipTests -Dcoverage.skip=true"
4949

50+
# Shared lint tasks from flint (https://github.com/grafana/flint)
5051
[tasks."lint:super-linter"]
51-
description = "Run Super-Linter with auto-fix on the repository"
52-
file = "https://raw.githubusercontent.com/grafana/docker-otel-lgtm/f5d39ffaf01b5bbe815b3821e4e3257db32f49e7/.mise/tasks/lint/super-linter.sh"
52+
description = "Run Super-Linter on the repository"
53+
file = "https://raw.githubusercontent.com/grafana/flint/d51085d44d29d60914eaf1d353a45a68bfccf352/tasks/lint/super-linter.sh" # v0.2.0
5354

5455
[tasks."lint:links"]
55-
file = "https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/refs/heads/main/.mise/tasks/lint/links.sh"
56+
description = "Lint links"
57+
file = "https://raw.githubusercontent.com/grafana/flint/d51085d44d29d60914eaf1d353a45a68bfccf352/tasks/lint/links.sh" # v0.2.0
5658

57-
[tasks."lint:local-links"]
58-
file = "https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/refs/heads/main/.mise/tasks/lint/local-links.sh"
59+
[tasks."lint"]
60+
description = "Run all lints"
61+
depends = ["lint:super-linter", "lint:links", "lint:bom"]
5962

60-
[tasks."lint:links-in-modified-files"]
61-
file = "https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/refs/heads/main/.mise/tasks/lint/links-in-modified-files.sh"
62-
63-
[tasks."lint:links-in-modified-files-ci"]
64-
description = "Lint links in modified files (CI configuration)"
65-
run = "mise run lint:links-in-modified-files --base origin/$GITHUB_BASE_REF --head $GITHUB_HEAD_SHA"
66-
67-
[tasks."lint:links-in-modified-files-local"]
68-
description = "Lint links in modified files (local configuration)"
69-
run = "mise run lint:links-in-modified-files --base origin/main --head HEAD"
70-
71-
[tasks."lint:rest"]
72-
description = "All lints not covered by super linter"
73-
depends = ["lint:bom", "lint:local-links", "lint:links-in-modified-files-local"]
74-
75-
[tasks."lint:rest-ci"]
76-
description = "All lints not covered by super linter (CI configuration)"
77-
depends = ["lint:bom", "lint:local-links", "lint:links-in-modified-files-ci"]
78-
79-
[tasks."lint:all"]
80-
description = "All lints"
81-
depends = ["lint:rest", "lint:super-linter"]
63+
[tasks.fix]
64+
description = "Auto-fix lint issues"
65+
run = "AUTOFIX=true mise run lint"
8266

8367
[tasks.acceptance-test]
8468
description = "Run OATs acceptance tests"

0 commit comments

Comments
 (0)