diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..9780bff --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,33 @@ +name: Lint + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: lint-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: gdzig-zlint + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup mise + uses: jdx/mise-action@v2 + with: + install: false + cache: true + cache_save_post: true + + - name: Lint + run: mise exec -- gdzig-zlint . diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..9608027 --- /dev/null +++ b/mise.toml @@ -0,0 +1,6 @@ +[tools] +"github:gdzig/gdzig-zlint" = "0.6.1" + +[tasks.lint] +description = "Run gdzig-zlint with the repository rules" +run = "gdzig-zlint ." diff --git a/zlint.json b/zlint.json new file mode 100644 index 0000000..9189285 --- /dev/null +++ b/zlint.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://raw.githubusercontent.com/DonIsaac/zlint/refs/tags/v0.10.0/zlint.schema.json", + "ignore": [ + "vendor/**", + "zig-out/**", + "zig-pkg/**", + ".zig-cache/**", + "**/src/linter/rules/snapshots/**" + ], + "rules": { + "gdzig-imports-sorted": [ + "warn", + { + "std_modules": [ + "std", + "builtin" + ] + } + ], + "gdzig-imports-placement": [ + "warn", + { + "position": "bottom" + } + ], + "gdzig-file-name-case": "warn", + "gdzig-import-alias-case": "warn", + "gdzig-tests-last": "warn", + "gdzig-trailing-comma": "warn", + "gdzig-public-docs": "warn", + "gdzig-inferred-initializers": "warn", + "gdzig-testing-usage": "warn", + "homeless-try": "error", + "no-unresolved": "off", + "unused-decls": "off", + "unsafe-undefined": "off", + "avoid-as": "off", + "no-print": "off", + "suppressed-errors": "off", + "line-length": [ + "warn", + { + "max_length": 120 + } + ], + "empty-file": "off" + } +}