Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support GoReleaser #5505

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ FROM ghcr.io/terraform-linters/tflint:v0.50.3 as tflint
FROM ghcr.io/yannh/kubeconform:v0.6.4 as kubeconfrm
FROM golang:1.22.2-alpine as golang
FROM golangci/golangci-lint:v1.57.2 as golangci-lint
FROM goreleaser/goreleaser:v1.25.1 as goreleaser
FROM hadolint/hadolint:v2.12.0-alpine as dockerfile-lint
FROM hashicorp/terraform:1.7.5 as terraform
FROM koalaman/shellcheck:v0.10.0 as shellcheck
Expand Down Expand Up @@ -276,6 +277,11 @@ COPY --from=golang /usr/local/go/pkg/ /usr/lib/go/pkg/
COPY --from=golang /usr/local/go/src/ /usr/lib/go/src/
COPY --from=golangci-lint /usr/bin/golangci-lint /usr/bin/

######################
# Install GoReleaser #
######################
COPY --from=goreleaser /usr/bin/goreleaser /usr/bin/

#####################
# Install Terraform #
#####################
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Super-linter supports the following tools:
| **Gherkin** | [gherkin-lint](https://github.com/vsiakka/gherkin-lint) |
| **GitHub Actions** | [actionlint](https://github.com/rhysd/actionlint) |
| **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) |
| **GoReleser** | [GoReleser](https://github.com/goreleaser/goreleaser) |
| **Groovy** | [npm-groovy-lint](https://github.com/nvuillam/npm-groovy-lint) |
| **HTML** | [HTMLHint](https://github.com/htmlhint/HTMLHint) |
| **Java** | [checkstyle](https://checkstyle.org) / [google-java-format](https://github.com/google/google-java-format) |
Expand Down Expand Up @@ -274,6 +275,7 @@ You can configure super-linter using the following environment variables:
| **VALIDATE_GITLEAKS** | `true` | Flag to enable or disable the linting process of the secrets. |
| **VALIDATE_GO** | `true` | Flag to enable or disable the linting process of the individual Golang files. Set this to `false` if you want to lint Go modules. See the `VALIDATE_GO_MODULES` variable. |
| **VALIDATE_GO_MODULES** | `true` | Flag to enable or disable the linting process of Go modules. Super-linter considers a directory to be a Go module if it contains a file named `go.mod`. |
| **VALIDATE_GO_RELEASER** | `true` | Flag to enable or disable the linting process of the GoReleaser config file. |
| **VALIDATE_GOOGLE_JAVA_FORMAT** | `true` | Flag to enable or disable the linting process of the Java language. (Utilizing: google-java-format) |
| **VALIDATE_GROOVY** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_HTML** | `true` | Flag to enable or disable the linting process of the HTML language. |
Expand Down
2 changes: 2 additions & 0 deletions lib/functions/buildFileList.sh
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ BuildFileArrays() {
elif [ "${FILE_TYPE}" == "xml" ] ||
[ "${FILE_TYPE}" == "xsd" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-XML"
elif [[ "${FILE}" =~ .?goreleaser.+ya?ml ]]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GO_RELEASER"
elif [ "${FILE_TYPE}" == "yml" ] || [ "${FILE_TYPE}" == "yaml" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-YAML"
if DetectActions "${FILE}"; then
Expand Down
1 change: 1 addition & 0 deletions lib/functions/linterCommands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ LINTER_COMMANDS_ARRAY_GHERKIN=(gherkin-lint -c "${GHERKIN_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_GO=(golangci-lint run -c "${GO_LINTER_RULES}" --fast)
# Consume the input as we do with ANSIBLE
LINTER_COMMANDS_ARRAY_GO_MODULES=(golangci-lint run --allow-parallel-runners -c "${GO_LINTER_RULES}" "&& echo \"Linted: {}\"")
LINTER_COMMANDS_ARRAY_GO_RELEASER=(goreleaser check)
LINTER_COMMANDS_ARRAY_GOOGLE_JAVA_FORMAT=(java -jar /usr/bin/google-java-format --dry-run --set-exit-if-changed)
LINTER_COMMANDS_ARRAY_GROOVY=(npm-groovy-lint -c "${GROOVY_LINTER_RULES}" --failon warning --no-insight)
LINTER_COMMANDS_ARRAY_HTML=(htmlhint --config "${HTML_LINTER_RULES}")
Expand Down
2 changes: 1 addition & 1 deletion lib/linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ fi
LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CHECKOV' 'CLANG_FORMAT'
'CLOUDFORMATION' 'CLOJURE' 'COFFEESCRIPT' 'CPP' 'CSHARP' 'CSS' 'DART'
'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV' 'GITHUB_ACTIONS'
'GITLEAKS' 'GHERKIN' 'GO' 'GO_MODULES' 'GOOGLE_JAVA_FORMAT' 'GROOVY' 'HTML' 'JAVA'
'GITLEAKS' 'GHERKIN' 'GO' 'GO_MODULES' 'GO_RELEASER' 'GOOGLE_JAVA_FORMAT' 'GROOVY' 'HTML' 'JAVA'
'JAVASCRIPT_ES' "${JAVASCRIPT_STYLE_NAME}" 'JSCPD' 'JSON' 'JSONC' 'JSX'
'KUBERNETES_KUBECONFORM' 'KOTLIN' 'LATEX' 'LUA' 'MARKDOWN'
'NATURAL_LANGUAGE' 'OPENAPI' 'PERL' 'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN'
Expand Down
1 change: 1 addition & 0 deletions scripts/linterVersions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ LINTER_NAMES_ARRAY['GITLEAKS']="gitleaks"
LINTER_NAMES_ARRAY['GHERKIN']="gherkin-lint"
LINTER_NAMES_ARRAY['GO']="golangci-lint"
LINTER_NAMES_ARRAY['GO_MODULES']="${LINTER_NAMES_ARRAY['GO']}"
LINTER_NAMES_ARRAY['GO_RELEASER']="goreleaser"
LINTER_NAMES_ARRAY['GOOGLE_JAVA_FORMAT']="google-java-format"
LINTER_NAMES_ARRAY['GROOVY']="npm-groovy-lint"
LINTER_NAMES_ARRAY['HTML']="htmlhint"
Expand Down
1 change: 1 addition & 0 deletions test/inspec/super-linter/controls/super_linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
{ linter_name: "gherkin-lint", expected_exit_status: 1}, # expect a return code = 1 because this linter doesn't support a "get linter version" command
{ linter_name: "gitleaks", version_option: "version"},
{ linter_name: "golangci-lint"},
{ linter_name: "goreleaser"},
{ linter_name: "google-java-format", version_command: "java -jar /usr/bin/google-java-format --version"},
{ linter_name: "hadolint"},
{ linter_name: "htmlhint"},
Expand Down
2 changes: 2 additions & 0 deletions test/linters/go_releaser/.goreleaser_bad_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brews:
- folder: test
2 changes: 2 additions & 0 deletions test/linters/go_releaser/.goreleaser_good_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brews:
- directory: test