From f334dc40d54c7056ca371fb69b38a911d90b6300 Mon Sep 17 00:00:00 2001 From: Ryan Parman Date: Tue, 14 Nov 2023 19:08:35 -0700 Subject: [PATCH] lint: Verified that all files adhere to .editorconfig. --- .ecrc | 21 ++++++++++++++ .editorconfig | 40 +++++++++++++++++++-------- .github/workflows/govulncheck.yml | 4 +-- .github/workflows/test.yml | 21 +++++++------- .gommit.toml | 4 +-- .pre-commit-config.yaml | 7 +++++ AUTHORS | 6 ++-- CONTRIBUTING.md | 4 +-- README.md | 46 +++++++++++++++---------------- scripts/generate-authors.sh | 14 +++++++--- testing | 1 - 11 files changed, 110 insertions(+), 58 deletions(-) create mode 100644 .ecrc delete mode 100644 testing diff --git a/.ecrc b/.ecrc new file mode 100644 index 00000000..fcd6f2ce --- /dev/null +++ b/.ecrc @@ -0,0 +1,21 @@ +{ + "Exclude": [ + "\\.cache$", + "\\.dcignore$", + "\\.example$", + "\\.go$", + "\\.golangci.yml$", + "\\.goreleaser.yml$", + "\\.gotmpl$", + "\\.svg$", + "\\.terraform\\.lock\\.hcl$", + "\\.txt$", + "composer\\.lock$", + "go\\.mod$", + "go\\.sum$", + "package-lock\\.json$" + ], + "IgnoreDefaults": true, + "SpacesAfterTabs": false, + "Verbose": false +} diff --git a/.editorconfig b/.editorconfig index 419ea353..5942788b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ # Uses editorconfig to maintain consistent coding styles -# http://EditorConfig.org +# https://editorconfig.org root = true @@ -10,24 +10,42 @@ indent_size = 4 indent_style = space insert_final_newline = true max_line_length = 120 +tab_width = 4 trim_trailing_whitespace = true -[*.toml] -indent_size = 4 +[Makefile*] +indent_style = tab +max_line_length = 20000 -[*.{css,html,js,json,less,sass,scss,yaml,yml}] +# Web +[*.{css,html,js,less,sass,scss}] indent_size = 2 -[*.{tf,tfvars}] +# Configuration formats +[*.{hcl,json,toml,yaml,yml}] indent_size = 2 -indent_style = space + +[*.go] +indent_style = tab + +[*.{md,md.tmpl}] +indent_size = 2 +max_line_length = 20000 [*.py] indent_size = 4 -[*.md] -max_line_length = 0 -trim_trailing_whitespace = false +[*.sh] +indent_size = 4 +max_line_length = 120 -[Makefile*] -indent_style = tab +# Terraform files +[*.{tf,tftpl,tfvars}] +indent_size = 2 +indent_style = space + +[.yamllint] +indent_size = 2 + +[bats/*.sh] +max_line_length = 20000 diff --git a/.github/workflows/govulncheck.yml b/.github/workflows/govulncheck.yml index 74c9b9bc..90cffa8d 100644 --- a/.github/workflows/govulncheck.yml +++ b/.github/workflows/govulncheck.yml @@ -28,11 +28,11 @@ jobs: - name: Install Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ">= 1.21" + go-version: '>= 1.21' cache: true - id: govulncheck uses: golang/govulncheck-action@7da72f730e37eeaad891fcff0a532d27ed737cd4 # v1.0.1 with: - go-version-input: ">= 1.21" + go-version-input: '>= 1.21' check-latest: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e1e53616..b38b192b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,12 +37,13 @@ jobs: - name: Install Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ">= 1.21" + go-version: '>= 1.21' cache: true - name: Run mutation tests run: | - cd ./corefunc && go test -tags=mutation -count=1 -parallel=$(nproc) -timeout 30s -ooze.v=true | grep -v "^[[:lower:]]" | grep -v "^)" + cd ./corefunc && go test -tags=mutation -count=1 -parallel=$(nproc) -timeout 30s -ooze.v=true \ + | grep -v "^[[:lower:]]" | grep -v "^)" unit: runs-on: ubuntu-latest @@ -65,7 +66,7 @@ jobs: - name: Install Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ">= 1.21" + go-version: '>= 1.21' cache: true - name: Run unit tests @@ -80,12 +81,12 @@ jobs: fail-fast: false matrix: terraform_version: - - "1.1" - - "1.2" - - "1.3" - - "1.4" - - "1.5" - - "1.6" + - '1.1' + - '1.2' + - '1.3' + - '1.4' + - '1.5' + - '1.6' steps: - name: Harden Runner @@ -108,7 +109,7 @@ jobs: - name: Install Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ">= 1.21" + go-version: '>= 1.21' cache: true - name: Install Terraform diff --git a/.gommit.toml b/.gommit.toml index 3df3cb6a..a4ac2399 100644 --- a/.gommit.toml +++ b/.gommit.toml @@ -1,7 +1,7 @@ [config] exclude-merge-commits = true -check-summary-length = true -summary-length = 80 +check-summary-length = true +summary-length = 80 [matchers] all = "(?:build|ci|deps|docs|feat|fix|lint|perf|refactor|style|test)(?:\\([^\\)]*\\))?: (?:.+)" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7b3fc819..5b35505c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -90,6 +90,13 @@ repos: - repo: local hooks: + - id: editorconfig-checker + name: editorconfig-checker + description: Double-check editorconfig compliance + entry: bash -c 'editorconfig-checker' + language: system + stages: [commit, push] + - id: trufflehog name: TruffleHog description: Detect secrets in your data. diff --git a/AUTHORS b/AUTHORS index ca2a6935..d9d45411 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,6 +1,6 @@ -# File @generated by scripts/generate-authors.sh. DO NOT EDIT. -# This file lists all contributors to the repository. -# See scripts/generate-authors.sh to make modifications. + # File @generated by scripts/generate-authors.sh. DO NOT EDIT. + # This file lists all contributors to the repository. + # See scripts/generate-authors.sh to make modifications. dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Ryan Parman diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bf22f1d4..bebd75bf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -318,8 +318,8 @@ It will show you something like this: goos: darwin goarch: arm64 pkg: github.com/northwood-labs/terraform-provider-corefunc/corefunc - │ Current │ Previous │ - │ sec/op │ sec/op vs base │ + │ Current │ Previous │ + │ sec/op │ sec/op vs base │ TruncateLabel/balanced0-10 2.100n ± 1% 103.600n ± 3% +4833.33% (p=0.002 n=6) TruncateLabel/balanced3-10 2.104n ± 0% 103.750n ± 2% +4831.08% (p=0.002 n=6) TruncateLabel/balanced5-10 2.103n ± 1% 104.000n ± 1% +4845.32% (p=0.002 n=6) diff --git a/README.md b/README.md index 63098214..555f807e 100644 --- a/README.md +++ b/README.md @@ -68,27 +68,27 @@ terraform-provider-corefunc version ``` ```plain - BASIC - Version: dev - Go version: go1.21.1 - Git commit: 80ac4b1062bfeb81734e505f7fd977050bc4a3e9 - Dirty repo: true - PGO: default.pgo - Build date: 2023-09-24T23:50:26Z - OS/Arch: darwin/arm64 - System: macOS on Apple Silicon - CPU Cores: 10 - - DEPENDENCIES - github.com/chanced/caps v1.0.1 - github.com/fatih/color v1.15.0 - github.com/golang/protobuf v1.5.3 - github.com/gookit/color v1.5.4 - github.com/hashicorp/go-hclog v1.5.0 - github.com/hashicorp/go-plugin v1.5.1 - github.com/hashicorp/go-uuid v1.0.3 - github.com/hashicorp/terraform-plugin-framework v1.4.0 - github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 - github.com/hashicorp/terraform-plugin-go v0.19.0 - [...snip...] +BASIC +Version: dev +Go version: go1.21.1 +Git commit: 80ac4b1062bfeb81734e505f7fd977050bc4a3e9 +Dirty repo: true +PGO: default.pgo +Build date: 2023-09-24T23:50:26Z +OS/Arch: darwin/arm64 +System: macOS on Apple Silicon +CPU Cores: 10 + +DEPENDENCIES +github.com/chanced/caps v1.0.1 +github.com/fatih/color v1.15.0 +github.com/golang/protobuf v1.5.3 +github.com/gookit/color v1.5.4 +github.com/hashicorp/go-hclog v1.5.0 +github.com/hashicorp/go-plugin v1.5.1 +github.com/hashicorp/go-uuid v1.0.3 +github.com/hashicorp/terraform-plugin-framework v1.4.0 +github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 +github.com/hashicorp/terraform-plugin-go v0.19.0 +[...snip...] ``` diff --git a/scripts/generate-authors.sh b/scripts/generate-authors.sh index 6af3f5ed..6a8c0e28 100755 --- a/scripts/generate-authors.sh +++ b/scripts/generate-authors.sh @@ -4,12 +4,18 @@ set -e # see also ".mailmap" for how email addresses and names are deduplicated OUT="${1:-.}" { - cat <<- 'EOH' + # editorconfig-checker-disable + cat <<- 'EOF' # File @generated by scripts/generate-authors.sh. DO NOT EDIT. # This file lists all contributors to the repository. # See scripts/generate-authors.sh to make modifications. - EOH + EOF + # editorconfig-checker-enable + echo + + # shellcheck disable=2312 git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf -} > "$OUT/AUTHORS" -cat "$OUT/AUTHORS" + +} > "${OUT}/AUTHORS" +cat "${OUT}/AUTHORS" diff --git a/testing b/testing deleted file mode 100644 index a788ffb2..00000000 --- a/testing +++ /dev/null @@ -1 +0,0 @@ -2023-11-01