Skip to content

Commit bb8cd30

Browse files
committed
ci: migrate to flint v2 for linting
Replace the v1-era remote bash task and separate markdown lint job with flint v2, which runs all checks (lychee, markdownlint-cli2, google-java-format, ktlint, license-header) from a single binary. - Add flint, google-java-format, ktlint to mise.toml - Create .github/config/flint.toml with license-header check for *.java and *.kt (mirrors spotless config); excludes gradlew, spotless.license.java, CHANGELOG.md, licenses/licenses.md - Add ktlint editorconfig overrides to .editorconfig (mirrors the editorConfigOverride() calls in otel.spotless-conventions.gradle.kts) - Replace reusable-link-check.yml + reusable-markdown-lint-check.yml with a single reusable-lint-check.yml running `mise run lint` - Spotless remains authoritative for formatting; flint provides fast local feedback and CI link/markdown/license checking Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent 64d55bf commit bb8cd30

9 files changed

Lines changed: 53 additions & 67 deletions

File tree

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,3 +761,16 @@ ij_properties_spaces_around_key_value_delimiter = false
761761
[{*.yaml, *.yml}]
762762
ij_yaml_keep_indents_on_empty_lines = false
763763
ij_yaml_keep_line_breaks = true
764+
765+
# ktlint overrides (mirrors otel.spotless-conventions.gradle.kts)
766+
[{*.kt, *.kts}]
767+
max_line_length = 160
768+
continuation_indent_size = 2
769+
ktlint_standard_no-wildcard-imports = disabled
770+
ktlint_standard_package-name = disabled
771+
ktlint_standard_max-line-length = disabled
772+
ktlint_standard_trailing-comma-on-call-site = disabled
773+
ktlint_standard_trailing-comma-on-declaration-site = disabled
774+
ktlint_standard_wrapping = disabled
775+
ktlint_standard_property-naming = disabled
776+
ktlint_standard_function-literal = disabled

.github/config/flint.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[settings]
2+
exclude = "gradlew|buildscripts/spotless\\.license\\.java|CHANGELOG\\.md|licenses/licenses\\.md"
3+
4+
[checks.license-header]
5+
text = """
6+
/*
7+
* Copyright The OpenTelemetry Authors
8+
* SPDX-License-Identifier: Apache-2.0
9+
*/"""
10+
patterns = ["**/*.java", "**/*.kt"]

.github/workflows/build-daily.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ jobs:
2525
muzzle:
2626
uses: ./.github/workflows/reusable-muzzle.yml
2727

28-
link-check:
29-
uses: ./.github/workflows/reusable-link-check.yml
30-
31-
markdown-lint-check:
32-
uses: ./.github/workflows/reusable-markdown-lint-check.yml
28+
lint:
29+
uses: ./.github/workflows/reusable-lint-check.yml
3330

3431
publish-snapshots:
3532
environment: protected

.github/workflows/build-pull-request.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,11 @@ jobs:
4040
with:
4141
cache-read-only: true
4242

43-
# this is not a required check to avoid blocking pull requests if external links break
44-
markdown-check:
43+
lint:
4544
# release branches are excluded because the README.md javaagent download link has to be updated
4645
# on release branches before the release download has been published
4746
if: "!startsWith(github.ref_name, 'release/') && !startsWith(github.base_ref, 'release/')"
48-
uses: ./.github/workflows/reusable-link-check.yml
49-
50-
markdown-lint-check:
51-
uses: ./.github/workflows/reusable-markdown-lint-check.yml
47+
uses: ./.github/workflows/reusable-lint-check.yml
5248

5349
required-status-check:
5450
# test-latest-deps is not included in the required status checks
@@ -63,7 +59,7 @@ jobs:
6359
needs:
6460
- common
6561
- muzzle
66-
- markdown-lint-check
62+
- lint
6763
runs-on: ubuntu-latest
6864
if: always()
6965
steps:
@@ -73,7 +69,7 @@ jobs:
7369
!startsWith(github.base_ref, 'release/') &&
7470
(
7571
needs.muzzle.result != 'success' ||
76-
needs.markdown-lint-check.result != 'success'
72+
needs.lint.result != 'success'
7773
)
7874
)
7975
run: exit 1 # fail

.github/workflows/build.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,8 @@ jobs:
3434
if: "!startsWith(github.ref_name, 'release/')"
3535
uses: ./.github/workflows/reusable-muzzle.yml
3636

37-
link-check:
38-
# release branches are excluded to avoid unnecessary maintenance if external links break
39-
# (and also because the README.md javaagent download link has to be updated on release branches
40-
# before the release download has been published)
37+
lint:
38+
# release branches are excluded because the README.md javaagent download link has to be updated
39+
# on release branches before the release download has been published
4140
if: "!startsWith(github.ref_name, 'release/')"
42-
uses: ./.github/workflows/reusable-link-check.yml
43-
44-
markdown-lint-check:
45-
# release branches are excluded
46-
if: "!startsWith(github.ref_name, 'release/')"
47-
uses: ./.github/workflows/reusable-markdown-lint-check.yml
41+
uses: ./.github/workflows/reusable-lint-check.yml
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Reusable - Link check
1+
name: Reusable - Lint check
22

33
on:
44
workflow_call:
@@ -7,7 +7,7 @@ permissions:
77
contents: read
88

99
jobs:
10-
link-check:
10+
lint-check:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -16,16 +16,16 @@ jobs:
1616

1717
- uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
1818

19-
- name: Link check for pull requests
19+
- name: Lint for pull requests
2020
if: github.event_name == 'pull_request'
2121
env:
2222
GITHUB_TOKEN: ${{ github.token }}
2323
GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
2424
PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
25-
run: mise run lint:links
25+
run: mise run lint
2626

27-
- name: Link check for pushes and scheduled workflows
27+
- name: Lint for pushes and scheduled workflows
2828
if: github.event_name != 'pull_request'
2929
env:
3030
GITHUB_TOKEN: ${{ github.token }}
31-
run: mise run lint:links --full
31+
run: mise run lint

.github/workflows/reusable-markdown-lint-check.yml

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

.mise/tasks/lint/markdown.sh

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

mise.toml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
[tools]
2+
"cargo:https://github.com/grafana/flint" = "rev:113b8cd5910bfd58881cd520daf02040d25b640e"
23
lychee = "0.23.0"
34
markdownlint-cli2 = "0.22.0"
5+
"github:google/google-java-format" = "1.35.0"
6+
"github:pinterest/ktlint" = "1.8.0"
7+
8+
[env]
9+
FLINT_CONFIG_DIR = ".github/config"
410

511
[settings]
612
# Only install tools explicitly defined in the [tools] section above
@@ -12,7 +18,11 @@ windows_executable_extensions = ["sh"]
1218
windows_default_file_shell_args = "bash"
1319
use_file_shell_for_executable_tasks = true
1420

15-
# Pick the tasks you need from flint (https://github.com/grafana/flint)
16-
[tasks."lint:links"]
17-
description = "Check for broken links in changed files + all local links"
18-
file = "https://raw.githubusercontent.com/grafana/flint/eded4cd370c729289a6de327a1a26831e10a39b9/tasks/lint/links.sh" # v0.20.2
21+
[tasks.lint]
22+
run = "flint run"
23+
24+
[tasks."lint:fix"]
25+
run = "flint run --fix"
26+
27+
[tasks."lint:pre-commit"]
28+
run = "flint run --fix --fast-only"

0 commit comments

Comments
 (0)