diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..9a5c2d7 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @DoctorVin @joelrebel @mmlb diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..f8d75ee --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,40 @@ +name: lint +on: + - pull_request + - push +jobs: + Prettier: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run prettier + env: + # renovate datasource=npm depName=prettier + PRETTIER_VERSION: 3.2.5 + run: | + npx --yes prettier@$PRETTIER_VERSION --check . && exit 0 + npx prettier@$PRETTIER_VERSION --write + git diff + exit 1 + + VerifyConfig: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install go + uses: actions/setup-go@v5 + with: + go-version: "1.22" + + - name: Install golangci-lint + env: + # renovate datasource=git-tags depName=https://github.com/golangci/golangci-lint + GOLANGCI_LINT_VERSION: v1.57 + run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@$GOLANGCI_LINT_VERSION + + - name: Verify .golangci.yml file + run: golangci-lint config verify -c .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..8112468 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,93 @@ +# +# This file lives in the github.com/metal-toolbox/golangci-lint-config repo. +# +# Do not edit this file outside of this repo otherwise we will be grumpy. +# Seriously though, this is meant to help promote a "standard" config and coding style. +# If you don't like something, lets have a discussion in GitHub issues! +# + +linters-settings: + dupl: + threshold: 125 + goconst: + min-len: 2 + min-occurrences: 2 + gocritic: + enabled-tags: + - experimental + - performance + - style + disabled-checks: + - whyNoLint + - wrapperFunc + gocyclo: + min-complexity: 15 + gofumpt: + extra-rules: true + govet: + enable: + - shadow + lll: + line-length: 140 + misspell: + locale: US + revive: + confidence: 0 + +linters: + enable-all: true + disable-all: false + # Linters we don't like + # Comments help explain why its disabled or point at ones we should not disable but will take a little work + # If its not commented its likely because its just too annoying or we don't find useful + disable: + - copyloopvar # requires go >=1.22 + - cyclop + - deadcode # deprecated + - depguard + - errname # maybe should be enabled + - exhaustivestruct # deprecated + - exhaustruct + - forbidigo + - funlen + - gochecknoglobals + - gochecknoinits + - gocognit + - goconst + - godot + - godox + - golint # deprecated + - gomnd + - ifshort # deprecated + - inamedparam + - interfacebloat + - interfacer # deprecated + - intrange # requires go >=1.22 + - ireturn # should be enabled, ironlib needs some changes + - lll # not previously enabled, ironlib and mctl both fail this + - maligned # deprecated + - nestif + - nilnil + - nlreturn + - nolintlint + - nonamedreturns # should be enabled, probably + - nosnakecase # deprecated + - paralleltest + - perfsprint + - scopelint # deprecated + - structcheck # deprecated + - tagliatelle + - tenv # should be enabled + - testpackage + - testifylint # should be enabled + - thelper # should be enabled + - varcheck # deprecated + - varnamelen + - wrapcheck + - wsl + +issues: + exclude-rules: + - linters: + - stylecheck + text: "ST1016" diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..1123d2f --- /dev/null +++ b/renovate.json @@ -0,0 +1,28 @@ +{ + "extends": ["config:base", ":dependencyDashboard", ":rebaseStalePrs"], + "addLabels": ["dependencies"], + "labels": ["dependencies"], + "packageRules": [ + { + "description": "Automatically merge minor and patch-level updates", + "matchUpdateTypes": ["minor", "patch", "digest"], + "automerge": true + } + ], + "rebaseWhen": "auto", + "rollbackPrs": true, + "stabilityDays": 3, + "vulnerabilityAlerts": { + "enabled": true, + "labels": ["security"] + }, + "customManagers": [ + { + "customType": "regex", + "fileMatch": ["^.github/workflows/lint.yaml$"], + "matchStrings": [ + "# renovate: datasource=(?[a-z-.]+?) depName=(?[^\\s]+?)(?: (?:lookupName|packageName)=(?[^\\s]+?))?(?: versioning=(?[^\\s]+?))?(?: extractVersion=(?[^\\s]+?))?\\s+[A-Za-z0-9_]+?_VERSION\\s*:\\s*[\"']?(?.+?)[\"']?\\s" + ] + } + ] +}