diff --git a/.github/config/flint.toml b/.github/config/flint.toml new file mode 100644 index 0000000..ace835e --- /dev/null +++ b/.github/config/flint.toml @@ -0,0 +1,5 @@ +[checks.lychee] +check_all_local = true + +[settings] +setup_migration_version = 2 diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 3aa2f0d..b5055b2 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,6 +1,7 @@ { $schema: 'https://docs.renovatebot.com/renovate-schema.json', extends: [ + "github>grafana/flint#v0.21.0", 'config:best-practices', 'helpers:pinGitHubActionDigestsToSemver', 'customManagers:githubActionsVersions', @@ -66,17 +67,6 @@ }, ], customManagers: [ - { - // keep SHA-pinned raw.githubusercontent.com URLs in mise.toml up to date - customType: 'regex', - datasourceTemplate: 'github-tags', - managerFilePatterns: [ - '/^mise\\.toml$/', - ], - matchStrings: [ - 'https://raw\\.githubusercontent\\.com/(?[^/]+/[^/]+)/(?[a-f0-9]{40})/.*#\\s*(?v\\S+)', - ], - }, { customType: 'regex', datasourceTemplate: 'docker', diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml index 5647003..717f519 100644 --- a/.github/workflows/build-pull-request.yml +++ b/.github/workflows/build-pull-request.yml @@ -16,14 +16,14 @@ jobs: with: cache-read-only: true - link-check: - uses: ./.github/workflows/reusable-link-check.yml + lint: + uses: ./.github/workflows/reusable-lint-check.yml required-status-check: if: always() needs: - common - - link-check # wait for link check to complete, but don't require it to pass for merging + - lint # wait for lint to complete, but don't require it to pass for merging runs-on: ubuntu-latest steps: # The reusable workflow success depends on all its jobs passing diff --git a/.github/workflows/reusable-link-check.yml b/.github/workflows/reusable-lint-check.yml similarity index 64% rename from .github/workflows/reusable-link-check.yml rename to .github/workflows/reusable-lint-check.yml index 8ea8754..11e5eaf 100644 --- a/.github/workflows/reusable-link-check.yml +++ b/.github/workflows/reusable-lint-check.yml @@ -1,4 +1,4 @@ -name: Reusable - Link check +name: Reusable - Lint check on: workflow_call: @@ -7,7 +7,7 @@ permissions: contents: read jobs: - link-check: + lint-check: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -16,16 +16,18 @@ jobs: - uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1 - - name: Link check for pull requests + - name: Lint for pull requests if: github.event_name == 'pull_request' env: GITHUB_TOKEN: ${{ github.token }} - GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_BASE_REF: ${{ github.base_ref }} + GITHUB_HEAD_REF: ${{ github.head_ref }} PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} - run: mise run lint:links + run: mise run lint - - name: Link check for pushes and scheduled workflows + - name: Lint for pushes and scheduled workflows if: github.event_name != 'pull_request' env: GITHUB_TOKEN: ${{ github.token }} - run: mise run lint:links --full + run: mise run lint --full diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dc2fa4e..985849e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,5 +36,5 @@ generate semantic conventions classes from the release contents. ## Style guide -This repository follows the OpenTelemetry Java -repository's [style guide](https://github.com/open-telemetry/opentelemetry-java/blob/main/CONTRIBUTING.md#style-guideline). +This repository follows the OpenTelemetry Java repository's +[coding patterns](https://github.com/open-telemetry/opentelemetry-java/blob/main/docs/knowledge/README.md). diff --git a/mise.toml b/mise.toml index 0b7292e..bc5aaf8 100644 --- a/mise.toml +++ b/mise.toml @@ -1,17 +1,17 @@ [tools] + +# Linters +"github:grafana/flint" = "0.21.0" lychee = "0.23.0" -[settings] -# Only install tools explicitly defined in the [tools] section above -idiomatic_version_file_enable_tools = [] +[tasks.lint] +description = "Run link checks" +raw_args = true +run = "flint run" -# Windows configuration for file-based tasks -# Based on: https://github.com/jdx/mise/discussions/4461 -windows_executable_extensions = ["sh"] -windows_default_file_shell_args = "bash" -use_file_shell_for_executable_tasks = true +[tasks."lint:fix"] +description = "Auto-fix lint issues" +run = "flint run --fix" -# Pick the tasks you need from flint (https://github.com/grafana/flint) -[tasks."lint:links"] -description = "Check for broken links in changed files + all local links" -file = "https://raw.githubusercontent.com/grafana/flint/feab606ce514fbbf2722cc26aeafa39956383cf3/tasks/lint/links.sh" # v0.21.0 +[env] +FLINT_CONFIG_DIR = ".github/config"