diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7511840 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_size = 2 +max_line_length = 120 + +[*.py] +indent_size = 4 + +[*.md] +# Markdown line length is handled by rumdl +max_line_length = off diff --git a/.github/config/.rumdl.toml b/.github/config/.rumdl.toml new file mode 100644 index 0000000..066c5b4 --- /dev/null +++ b/.github/config/.rumdl.toml @@ -0,0 +1,5 @@ +[MD013] +enabled = true +line-length = 120 +code-blocks = false +tables = false diff --git a/.github/config/.taplo.toml b/.github/config/.taplo.toml new file mode 100644 index 0000000..9198340 --- /dev/null +++ b/.github/config/.taplo.toml @@ -0,0 +1,3 @@ +[formatting] +column_width = 120 +indent_string = " " diff --git a/.github/config/.yamllint.yml b/.github/config/.yamllint.yml new file mode 100644 index 0000000..483f3d4 --- /dev/null +++ b/.github/config/.yamllint.yml @@ -0,0 +1,8 @@ +extends: relaxed + +rules: + document-start: disable + # Line length is owned by the repo's root .editorconfig. + line-length: disable + # Keep indentation checks in yamllint so YAML structure issues still fail lint. + indentation: enable diff --git a/.github/config/flint.toml b/.github/config/flint.toml new file mode 100644 index 0000000..35f3edc --- /dev/null +++ b/.github/config/flint.toml @@ -0,0 +1,6 @@ +[settings] +# Generated or JSONC files flint should ignore. +exclude = [".vscode/launch.json", "**/supported-libraries.yaml"] + +[checks.renovate-deps] +exclude_managers = ["github-actions", "github-runners"] diff --git a/.github/config/lychee.toml b/.github/config/lychee.toml index 666f924..4f72fdc 100644 --- a/.github/config/lychee.toml +++ b/.github/config/lychee.toml @@ -11,5 +11,5 @@ include_fragments = true exclude = [ # Google Docs links are often rate-limited - "https://docs.google.com/.*" + "https://docs.google.com/.*", ] diff --git a/.github/config/super-linter.env b/.github/config/super-linter.env deleted file mode 100644 index 4eb5ef3..0000000 --- a/.github/config/super-linter.env +++ /dev/null @@ -1,30 +0,0 @@ -# testdata/ contains generated files; launch.json has JSONC comments; supported-libraries.yaml is generated -FILTER_REGEX_EXCLUDE=(renovate-tracked-deps\.json|\.vscode/launch\.json|supported-libraries\.yaml) -IGNORE_GITIGNORED_FILES=true -LOG_LEVEL=ERROR - -# Keys MUST be sorted alphabetically — dotenv-linter enforces this in CI. - -# --- Allow-list: only these linters run --- -# (switching from deny-list to allow-list for clarity and performance) -# Note: Go linting is handled by lint:go task (mise-pinned golangci-lint) - -VALIDATE_BASH=true -VALIDATE_EDITORCONFIG=true -VALIDATE_GITHUB_ACTIONS=true -VALIDATE_GIT_MERGE_CONFLICT_MARKERS=true -VALIDATE_JSON_PRETTIER=true -VALIDATE_MARKDOWN=true -VALIDATE_MARKDOWN_PRETTIER=true -VALIDATE_RENOVATE=true -VALIDATE_SHELL_SHFMT=true -VALIDATE_SPELL_CODESPELL=true -VALIDATE_YAML_PRETTIER=true - -# --- Autofix --- -FIX_JSON_PRETTIER=true -FIX_MARKDOWN=true -FIX_MARKDOWN_PRETTIER=true -FIX_SHELL_SHFMT=true -FIX_SPELL_CODESPELL=true -FIX_YAML_PRETTIER=true diff --git a/.github/renovate-tracked-deps.json b/.github/renovate-tracked-deps.json index 5a5c60c..631c2b3 100644 --- a/.github/renovate-tracked-deps.json +++ b/.github/renovate-tracked-deps.json @@ -31,16 +31,23 @@ }, "mise.toml": { "mise": [ + "actionlint", + "aqua:owenlamont/ryl", + "biome", + "editorconfig-checker", + "github:grafana/flint", + "github:koalaman/shellcheck", "go", "golangci-lint", "lychee", "node", "npm:renovate", + "pipx:codespell", + "ruff", + "rumdl", + "shfmt", + "taplo", "uv" - ], - "regex": [ - "ghcr.io/super-linter/super-linter", - "grafana/flint" ] } } diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 5c76a6a..8f846e7 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -3,7 +3,7 @@ extends: [ "config:best-practices", "config:recommended", - "github>grafana/flint", + "github>grafana/flint#v0.21.0", ], automerge: true, labels: ["dependencies"], diff --git a/AGENTS.md b/AGENTS.md index bba916a..679710d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -33,19 +33,14 @@ mise run generate ```bash # Auto-fix and verify (recommended dev workflow) -mise run fix +mise run lint:fix # Verify only (same command used in CI) mise run lint -# Go linting only -mise run lint:go - -# Format Go code -mise run fmt ``` -Lint tasks are sourced from [grafana/flint](https://github.com/grafana/flint). +Linting is powered by [grafana/flint](https://github.com/grafana/flint). ## Architecture @@ -54,7 +49,9 @@ Lint tasks are sourced from [grafana/flint](https://github.com/grafana/flint). - **`main.go`** — Entry point. Parses CLI args, runs checks, optional web server on `:8080` - **`checks/checks.go`** — Orchestrator: always runs env checks first, then routes to component-specific checkers - **`checks/env/`** — Common OTel environment variable validation -- **`checks/sdk/`** — Language-specific SDK checkers, each in its own subpackage (`go/`, `js/`, `java/`, `python/`, `dotnet/`, `rubyChecker.go`, `phpChecker.go`) +- **`checks/sdk/`** — Language-specific SDK checkers, each in its own + subpackage (`go/`, `js/`, `java/`, `python/`, `dotnet/`, + `rubyChecker.go`, `phpChecker.go`) - **`checks/sdk/supported/`** — Shared library support checking logic - **`checks/collector/`** — OTel Collector YAML config validation - **`checks/beyla/`** — Beyla-specific checks @@ -66,8 +63,11 @@ Lint tasks are sourced from [grafana/flint](https://github.com/grafana/flint). ### Key Patterns -- **Reporter pattern**: `ComponentReporter` accumulates checks/warnings/errors, `Reporter` aggregates multiple component reporters -- **Generated files**: `supported-libraries.yaml` files in `checks/sdk/go/` and `checks/sdk/js/` — regenerate via `mise run generate`, don't edit manually +- **Reporter pattern**: `ComponentReporter` accumulates checks/warnings/errors, + `Reporter` aggregates multiple component reporters +- **Generated files**: `supported-libraries.yaml` files in `checks/sdk/go/` + and `checks/sdk/js/` — regenerate via `mise run generate`, don't edit + manually - **Embedded resources**: Static files and templates use `//go:embed` ## CLI Usage @@ -97,5 +97,6 @@ otel-checker -language=python -components=sdk,grafana-cloud -web-server ## CI - `mise run check` (lint + test) on PRs -- Linting via flint (super-linter, lychee, golangci-lint) +- Linting via flint (shellcheck, shfmt, prettier, markdownlint, + codespell, actionlint, editorconfig, lychee, renovate-deps, gofmt) - Python scripts use uv for dependencies diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c65d79d..6913f72 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,16 +1,20 @@ # Contributing to otel-checker -Thank you for your interest in contributing to otel-checker! This document provides guidelines and instructions for contributing to this project. +Thank you for your interest in contributing to otel-checker! This document +provides guidelines and instructions for contributing to this project. ## Development Environment Setup 1. Ensure you have Go installed (1.24 or higher) 2. Clone the repository: + ```bash git clone https://github.com/yourusername/otel-checker.git cd otel-checker ``` + 3. Install dependencies: + ```bash go mod download ``` @@ -24,13 +28,13 @@ Thank you for your interest in contributing to otel-checker! This document provi /Users/maryliag/go ``` -2. Clone this repo in the go path folder, so you will have: +1. Clone this repo in the go path folder, so you will have: ```text /Users/maryliag/go/src/otel-checker ``` -3. Run +1. Run ```bash go run main.go @@ -44,20 +48,20 @@ go run main.go go build ``` -2. Install +1. Install ```bash go install ``` -3. You can confirm it was installed with: +1. You can confirm it was installed with: ```bash ❯ ls $GOPATH/bin otel-checker ``` -4. Use from any other directory +1. Use from any other directory ```bash otel-checker \ @@ -75,26 +79,28 @@ go run otel-checker \ ## Using mise -We provide a `mise.toml` file with several useful commands to simplify common development tasks. [mise](https://mise.jdx.dev/) helps ensure consistent code quality and streamlines the development workflow. +We provide a `mise.toml` file with several useful commands to simplify common +development tasks. [mise](https://mise.jdx.dev/) helps ensure consistent code +quality and streamlines the development workflow. ### Available mise Commands -| Command | Description | -| ---------------- | ----------------------------------------------- | -| `mise run build` | Builds the application using `go install` | -| `mise run test` | Runs all tests in the project | -| `mise run clean` | Removes build artifacts and cleans the Go cache | -| `mise run fmt` | Formats all Go code using `gofmt` | -| `mise run lint` | Lints the code using `golangci-lint` | -| `mise run check` | Run all checks (test and lint) | -| `mise run deps` | Updates dependencies using `go mod tidy` | +| Command | Description | +| ------------------- | ----------------------------------------------- | +| `mise run build` | Builds the application using `go install` | +| `mise run test` | Runs all tests in the project | +| `mise run clean` | Removes build artifacts and cleans the Go cache | +| `mise run lint:fix` | Auto-fix lint and formatting issues | +| `mise run lint` | Run all lints | +| `mise run check` | Run all checks (test and lint) | +| `mise run deps` | Updates dependencies using `go mod tidy` | ## Contribution Workflow 1. Create a fork of the repository 2. Create a new branch for your feature or bug fix 3. Make your changes -4. Run `mise run fmt` to format your code +4. Run `mise run lint:fix` to format your code 5. Run `mise run lint` to ensure code quality 6. Run `mise run test` to make sure all tests pass 7. Commit your changes with a descriptive message @@ -106,7 +112,7 @@ Please ensure: 1. Your code follows the project's style and conventions 2. All tests pass (`mise run test`) -3. Code is properly formatted (`mise run fmt`) +3. Code is properly formatted (`mise run lint:fix`) 4. Linting passes without issues (`mise run lint`) ## Code Review Process diff --git a/README.md b/README.md index 27930d6..6b34661 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # OTel Me If It's Right -Checker for if the implementation of OpenTelemetry instrumentation is correct by scanning the code in your repository, checking environment variables, validating your Grafana token and more. +Checker for if the implementation of OpenTelemetry instrumentation is correct +by scanning the code in your repository, checking environment variables, +validating your Grafana token and more. ## Usage @@ -69,7 +71,10 @@ These checks are automatically performed for all languages and components. - `service.instance.id` (e.g., `checkout-123`) - `service.version` (e.g., `1.2`) - For missing attributes, provides specific recommendations with example values - - Follows the [OpenTelemetry specification](https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/) for precedence (e.g., `OTEL_SERVICE_NAME` takes precedence over `service.name` in `OTEL_RESOURCE_ATTRIBUTES`) + - Follows the + [OpenTelemetry specification](https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/) + for precedence (e.g., `OTEL_SERVICE_NAME` takes precedence over + `service.name` in `OTEL_RESOURCE_ATTRIBUTES`) - Example warning: `Set OTEL_RESOURCE_ATTRIBUTES="service.namespace=shop": An optional namespace for service.name` ### Grafana Cloud @@ -116,10 +121,13 @@ Use `-components=sdk -language=dotnet` flag to check the following: Use `-components=sdk -language=java` flag to check the following: - Java version -- Prints which libraries (as discovered from a locally running maven or gradle) are supported: +- Prints which libraries (as discovered from a locally running maven or gradle) + are supported: - With `-manual-instrumentation`, the libraries for manual instrumentation are printed. - - Without `-manual-instrumentation`, it will print the libraries supported by the [Java Agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation/). - - A maven or gradle wrapper will be used if found in the current directory or a parent directory. + - Without `-manual-instrumentation`, it will print the libraries supported by + the [Java Agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation/). + - A maven or gradle wrapper will be used if found in the current directory or + a parent directory. #### Go diff --git a/biome.jsonc b/biome.jsonc new file mode 100644 index 0000000..19969b0 --- /dev/null +++ b/biome.jsonc @@ -0,0 +1,7 @@ +{ + // Keep JSON formatting aligned with the repo's two-space style. + "formatter": { + "indentStyle": "space", + "indentWidth": 2 + } +} diff --git a/checks/sdk/go/README.md b/checks/sdk/go/README.md index f9c2a5f..a4b161f 100644 --- a/checks/sdk/go/README.md +++ b/checks/sdk/go/README.md @@ -4,7 +4,9 @@ This directory contains the configuration and checker for Go libraries that can ## Supported Libraries File -The `supported-libraries.yaml` file contains information about which Go libraries are supported by OpenTelemetry instrumentation, along with their version ranges and source paths. +The `supported-libraries.yaml` file contains information about which Go +libraries are supported by OpenTelemetry instrumentation, along with their +version ranges and source paths. ### File Format @@ -32,12 +34,15 @@ go.mongodb.org/mongo-driver: ## Generating the File -The `supported-libraries.yaml` file is generated from the OpenTelemetry Go Contrib repository using the `generate_go_supported_libraries.py` script. +The `supported-libraries.yaml` file is generated from the OpenTelemetry Go +Contrib repository using the `generate_go_supported_libraries.py` script. ### Prerequisites - [Mise](https://mise.jdx.dev/) -- A local clone of the [OpenTelemetry Go Contrib repository](https://github.com/open-telemetry/opentelemetry-go-contrib) in a sibling directory to this repository. +- A local clone of the + [OpenTelemetry Go Contrib repository](https://github.com/open-telemetry/opentelemetry-go-contrib) + in a sibling directory to this repository. ### Usage @@ -71,7 +76,10 @@ To update the file: ## Implementation Details -The Go checker scans `go.mod` files in your project to identify dependencies and compares them against the supported libraries list. It checks whether your dependencies are supported by OpenTelemetry instrumentation and reports any unsupported or out-of-range versions. +The Go checker scans `go.mod` files in your project to identify dependencies +and compares them against the supported libraries list. It checks whether your +dependencies are supported by OpenTelemetry instrumentation and reports any +unsupported or out-of-range versions. ## Version Range Format diff --git a/checks/sdk/js/README.md b/checks/sdk/js/README.md index 40a7036..d5583f9 100644 --- a/checks/sdk/js/README.md +++ b/checks/sdk/js/README.md @@ -4,7 +4,9 @@ This directory contains the configuration for supported JavaScript libraries tha ## Supported Libraries File -The `supported-libraries.yaml` file contains information about which JavaScript libraries are supported by OpenTelemetry instrumentation, along with their version ranges and source paths. +The `supported-libraries.yaml` file contains information about which +JavaScript libraries are supported by OpenTelemetry instrumentation, along with +their version ranges and source paths. ### File Format @@ -30,12 +32,15 @@ amqplib: ## Generating the File -The `supported-libraries.yaml` file is generated from the OpenTelemetry JS Contrib repository using the `generate_js_supported_libraries.py` script. +The `supported-libraries.yaml` file is generated from the OpenTelemetry JS +Contrib repository using the `generate_js_supported_libraries.py` script. ### Prerequisites - [Mise](https://mise.jdx.dev/) -- A local clone of the [OpenTelemetry JS Contrib repository](https://github.com/open-telemetry/opentelemetry-js-contrib) in a sibling directory to this repository. +- A local clone of the + [OpenTelemetry JS Contrib repository](https://github.com/open-telemetry/opentelemetry-js-contrib) + in a sibling directory to this repository. ### Usage diff --git a/mise.toml b/mise.toml index c44ed87..b8d1c74 100644 --- a/mise.toml +++ b/mise.toml @@ -1,29 +1,34 @@ [tools] go = "1.26.2" -golangci-lint = "2.11.4" +node = "24.15.0" uv = "0.11.7" + +# Linters +actionlint = "1.7.10" +"aqua:owenlamont/ryl" = "0.6.0" +biome = "2.4.13" +editorconfig-checker = "v3.6.1" +"github:grafana/flint" = "0.21.0" +"github:koalaman/shellcheck" = "v0.11.0" +golangci-lint = "2.11.4" lychee = "0.22.0" "npm:renovate" = "43.141.1" -node = "24.15.0" +"pipx:codespell" = "2.4.1" +ruff = "0.15.12" +rumdl = "0.1.82" +shfmt = "v3.12.0" +taplo = "0.10.0" [env] -RENOVATE_TRACKED_DEPS_EXCLUDE="github-actions,github-runners" -# renovate: datasource=docker depName=ghcr.io/super-linter/super-linter -SUPER_LINTER_VERSION="v8.4.0@sha256:c5e3307932203ff9e1e8acfe7e92e894add6266605b5d7fb525fb371a59a26f4" +FLINT_CONFIG_DIR = ".github/config" -# Shared lint tasks from flint (https://github.com/grafana/flint) -[tasks."lint:super-linter"] -description = "Run Super-Linter on the repository" -file = "https://raw.githubusercontent.com/grafana/flint/e1e6345d09418c4c8cd68cf6ba125b1cd4555f47/tasks/lint/super-linter.sh" # v0.20.4 -[tasks."lint:links"] -description = "Check for broken links in changed files + all local links" -file = "https://raw.githubusercontent.com/grafana/flint/e1e6345d09418c4c8cd68cf6ba125b1cd4555f47/tasks/lint/links.sh" # v0.20.4 -[tasks."lint:renovate-deps"] -description = "Verify renovate-tracked-deps.json is up to date" -file = "https://raw.githubusercontent.com/grafana/flint/e1e6345d09418c4c8cd68cf6ba125b1cd4555f47/tasks/lint/renovate-deps.py" # v0.20.4 +[tasks.lint] +description = "Run all lints" +run = "flint run" -[tasks."setup:native-lint-tools"] -file = "https://raw.githubusercontent.com/grafana/flint/e1e6345d09418c4c8cd68cf6ba125b1cd4555f47/tasks/setup/native-lint-tools.sh" # v0.20.4 +[tasks."lint:fix"] +description = "Auto-fix lint issues" +run = "flint run --fix" [tasks.build] description = "Build the application" @@ -40,52 +45,27 @@ rm -f otel-checker go clean """ -[tasks.fmt] -description = "Format code" -run = "gofmt -w ." - -[tasks."lint:go"] -description = "Lint Go code" -run = "golangci-lint run" - -[tasks."lint:fast"] -description = "Run all lints except renovate-deps" -depends = ["lint:super-linter", "lint:links", "lint:go"] - -[tasks."lint"] -description = "Run all lints" -depends = ["lint:fast", "lint:renovate-deps"] - -[tasks."native-lint"] -description = "Run lints using native tools (no Docker)" -run = "NATIVE=true mise run lint:fast" - -[tasks."pre-commit"] -description = "Pre-commit hook" -depends = ["setup:native-lint-tools"] -run = "NATIVE=true mise run lint:fast" - -[tasks."setup:pre-commit-hook"] -description = "Install git pre-commit hook" -run = "mise generate git-pre-commit --write --task=pre-commit" - -[tasks.fix] -description = "Auto-fix lint issues and regenerate tracked deps" -run = "AUTOFIX=true mise run lint" - [tasks.deps] description = "Update dependencies" run = "go mod tidy" [tasks.check] description = "Run all checks" -depends = ['lint:go', 'test'] +depends = ["lint", "test"] [tasks.generate-go-supported-libraries] -run = "uv run scripts/generate_go_supported_libraries.py ../opentelemetry-go-contrib -o checks/sdk/go/supported-libraries.yaml" +run = """ +uv run scripts/generate_go_supported_libraries.py \ + ../opentelemetry-go-contrib \ + -o checks/sdk/go/supported-libraries.yaml +""" [tasks.generate-js-supported-libraries] -run = "uv run scripts/generate_js_supported_libraries.py ../opentelemetry-js-contrib -o checks/sdk/js/supported-libraries.yaml" +run = """ +uv run scripts/generate_js_supported_libraries.py \ + ../opentelemetry-js-contrib \ + -o checks/sdk/js/supported-libraries.yaml +""" [tasks.generate] depends = ["generate-go-supported-libraries", "generate-js-supported-libraries"] diff --git a/static/style.css b/static/style.css index f1f2db0..ae3eb84 100644 --- a/static/style.css +++ b/static/style.css @@ -1,28 +1,28 @@ body { - background-color: #111217; - color: #ccccdc; + background-color: #111217; + color: #ccccdc; } .header { - background-color: #191b1f; - border-bottom: 1px solid rgba(204, 204, 220, 0.15); - margin: -20px -8px 20px -8px; + background-color: #191b1f; + border-bottom: 1px solid rgba(204, 204, 220, 0.15); + margin: -20px -8px 20px -8px; - h1 { - padding: 30px 10px 20px 10px; - margin: 0 auto; - text-align: center; - } + h1 { + padding: 30px 10px 20px 10px; + margin: 0 auto; + text-align: center; + } } .checks { - color: #038103; + color: #038103; } .errors { - color: #c10303; + color: #c10303; } .warnings { - color: #ffc700; -} \ No newline at end of file + color: #ffc700; +}