From e0d8b4fb2f36c890b71c5e14fd46715098c3c6f1 Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Thu, 5 Sep 2024 08:02:36 +0200 Subject: [PATCH] feat: implement a linter to check git conflicts (#6113) Implement a linter to check if files contain Git conflict markers or whitespace errors. --- .devcontainer/devcontainer.json | 10 ++ Dockerfile | 7 +- Makefile | 2 + README.md | 4 +- docs/add-new-linter.md | 1 + lib/functions/buildFileList.sh | 1 + lib/functions/linterCommands.sh | 1 + lib/globals/languages.sh | 4 +- scripts/git-merge-conflict-markers.sh | 19 ++ scripts/linterVersions.sh | 1 + ...ummary-test-linters-expect-failure-slim.md | 167 +++++++++--------- ...ry-test-linters-expect-failure-standard.md | 1 + ...ummary-test-linters-expect-success-slim.md | 167 +++++++++--------- ...ry-test-linters-expect-success-standard.md | 1 + .../super-linter/controls/super_linter.rb | 3 + .../git_merge_conflict_markers_bad_01.txt | 5 + .../git_merge_conflict_markers_bad_02.txt | 5 + .../git_merge_conflict_markers_good_01.txt | 1 + .../git_merge_conflict_markers_good_02.txt | 1 + 19 files changed, 230 insertions(+), 171 deletions(-) create mode 100755 scripts/git-merge-conflict-markers.sh create mode 100644 test/linters/git_merge_conflict_markers/git_merge_conflict_markers_bad_01.txt create mode 100644 test/linters/git_merge_conflict_markers/git_merge_conflict_markers_bad_02.txt create mode 100644 test/linters/git_merge_conflict_markers/git_merge_conflict_markers_good_01.txt create mode 100644 test/linters/git_merge_conflict_markers/git_merge_conflict_markers_good_02.txt diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bd4f3b63..0749a636 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -67,6 +67,16 @@ "source": "${localWorkspaceFolder}/dependencies/package-lock.json", "target": "/package-lock.json", "type": "bind" + }, + { + "source": "${localWorkspaceFolder}/scripts/bash-exec.sh", + "target": "/usr/bin/bash-exec", + "type": "bind" + }, + { + "source": "${localWorkspaceFolder}/scripts/git-merge-conflict-markers.sh", + "target": "/usr/bin/git-merge-conflict-markers", + "type": "bind" } ], "runArgs": ["--env-file", ".devcontainer/devcontainer.env"] diff --git a/Dockerfile b/Dockerfile index 1c6508c7..1c58647f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -383,10 +383,11 @@ COPY --from=python-builder /venvs /venvs ################# COPY --from=lintr-installer /usr/lib/R /usr/lib/R -##################### -# Install Bash-Exec # -##################### +########################################## +# Install linters implemented as scripts # +########################################## COPY --chmod=555 scripts/bash-exec.sh /usr/bin/bash-exec +COPY --chmod=555 scripts/git-merge-conflict-markers.sh /usr/bin/git-merge-conflict-markers ######################### # Install dotenv-linter # diff --git a/Makefile b/Makefile index 65640d6c..1f4d51ed 100644 --- a/Makefile +++ b/Makefile @@ -151,6 +151,8 @@ open-shell-super-linter-container: ## Open a shell in the Super-linter container -v "$(CURDIR)/dependencies/Gemfile":/Gemfile \ -v "$(CURDIR)/dependencies/package-lock.json":/package-lock.json \ -v "$(CURDIR)/dependencies/package.json":/package.json \ + -v "$(CURDIR)/scripts/bash-exec.sh":/usr/bin/bash-exec \ + -v "$(CURDIR)/scripts/git-merge-conflict-markers.sh":/usr/bin/git-merge-conflict-markers \ $(SUPER_LINTER_TEST_CONTAINER_URL) .PHONY: validate-container-image-labels diff --git a/README.md b/README.md index 93ca98f6..1449e8c9 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ Super-linter supports the following tools: | **EditorConfig** | [editorconfig-checker](https://github.com/editorconfig-checker/editorconfig-checker) | | | **.env** | [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) | | | **Gherkin** | [gherkin-lint](https://github.com/vsiakka/gherkin-lint) | | +| **Git merge conflict markers** | [Git conflict markers presence in files](https://git-scm.com/docs/git-config#Documentation/git-config.txt-mergeconflictStyle) | N/A | | **GitHub Actions** | [actionlint](https://github.com/rhysd/actionlint) | See YAML formatters | | **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) | | | **GoReleaser** | [GoReleaser](https://github.com/goreleaser/goreleaser) | See YAML formatters | @@ -95,7 +96,7 @@ Super-linter supports the following tools: | **Python3** | [pylint](https://pylint.pycqa.org/), [flake8](https://flake8.pycqa.org/en/latest/), [isort](https://pypi.org/project/isort/), [ruff](https://github.com/astral-sh/ruff) | [black](https://github.com/psf/black), [pyink](https://github.com/google/pyink) | | **R** | [lintr](https://github.com/jimhester/lintr) | | | **Raku** | [Raku](https://raku.org) | | -| **Renovate** | [renovate-config-validator](https://docs.renovatebot.com/config-validation/) | N/A | +| **Renovate** | [renovate-config-validator](https://docs.renovatebot.com/config-validation/) | See JSON formatters | | **Ruby** | [RuboCop](https://github.com/rubocop-hq/rubocop) | | | **Rust** | [Clippy](https://github.com/rust-lang/rust-clippy) | [Rustfmt](https://github.com/rust-lang/rustfmt) | | **Scala** | | [scalafmt](https://github.com/scalameta/scalafmt) | @@ -339,6 +340,7 @@ You can configure Super-linter using the following environment variables: | **VALIDATE_EDITORCONFIG** | `true` | Flag to enable or disable the linting process with the EditorConfig. | | **VALIDATE_ENV** | `true` | Flag to enable or disable the linting process of the ENV language. | | **VALIDATE_GHERKIN** | `true` | Flag to enable or disable the linting process of the Gherkin language. | +| **VALIDATE_GIT_MERGE_CONFLICT_MARKERS** | `true` | Option to enable or disable checking if files contain Git merge conflict markers. | | **VALIDATE_GITHUB_ACTIONS** | `true` | Flag to enable or disable the linting process of the GitHub Actions. | | **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. | diff --git a/docs/add-new-linter.md b/docs/add-new-linter.md index 07c0b57c..956cc121 100644 --- a/docs/add-new-linter.md +++ b/docs/add-new-linter.md @@ -157,6 +157,7 @@ new tool, it should include: Example: `ANSIBLE_FIX_MODE_OPTIONS=(--fix)` - Provide the logic to populate the list of files or directories to examine: `lib/functions/buildFileList.sh` + - Provide the logic to populate the versions file: `scripts/linterVersions.sh` - If necessary, provide elaborate logic to detect if the tool should examine a file or a directory: `lib/functions/detectFiles.sh` - If the tool needs to take into account special cases, reach out to the maintainers by creating a draft pull request and ask relevant questions diff --git a/lib/functions/buildFileList.sh b/lib/functions/buildFileList.sh index 87c3b9c3..939416d5 100755 --- a/lib/functions/buildFileList.sh +++ b/lib/functions/buildFileList.sh @@ -296,6 +296,7 @@ BuildFileArrays() { debug "Don't include ${FILE} in the list of files to lint with editorconfig-checker because the workspace doesn't contain an EditorConfig file: ${EDITORCONFIG_FILE_PATH}" fi + echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GIT_MERGE_CONFLICT_MARKERS" echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GITLEAKS" if IsAnsibleDirectory "${FILE}"; then diff --git a/lib/functions/linterCommands.sh b/lib/functions/linterCommands.sh index 8404200d..f37edf87 100755 --- a/lib/functions/linterCommands.sh +++ b/lib/functions/linterCommands.sh @@ -68,6 +68,7 @@ if [ -n "${GITLEAKS_LOG_LEVEL:-}" ]; then fi LINTER_COMMANDS_ARRAY_GITLEAKS+=(--source) LINTER_COMMANDS_ARRAY_GHERKIN=(gherkin-lint -c "${GHERKIN_LINTER_RULES}") +LINTER_COMMANDS_ARRAY_GIT_MERGE_CONFLICT_MARKERS=(git-merge-conflict-markers) LINTER_COMMANDS_ARRAY_GO=(golangci-lint run -c "${GO_LINTER_RULES}" --fast) LINTER_COMMANDS_ARRAY_GO_MODULES=(golangci-lint run --allow-parallel-runners -c "${GO_LINTER_RULES}") LINTER_COMMANDS_ARRAY_GO_RELEASER=(goreleaser check) diff --git a/lib/globals/languages.sh b/lib/globals/languages.sh index d5839fd5..95f89521 100755 --- a/lib/globals/languages.sh +++ b/lib/globals/languages.sh @@ -13,7 +13,9 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CHECKOV' 'CLANG_FORMAT' 'EDITORCONFIG' 'ENV' 'GITHUB_ACTIONS' - 'GITLEAKS' 'GHERKIN' 'GO' 'GO_MODULES' 'GO_RELEASER' 'GOOGLE_JAVA_FORMAT' + 'GITLEAKS' 'GHERKIN' + "GIT_MERGE_CONFLICT_MARKERS" + 'GO' 'GO_MODULES' 'GO_RELEASER' 'GOOGLE_JAVA_FORMAT' "GRAPHQL_PRETTIER" 'GROOVY' 'HTML' diff --git a/scripts/git-merge-conflict-markers.sh b/scripts/git-merge-conflict-markers.sh new file mode 100755 index 00000000..c6f72824 --- /dev/null +++ b/scripts/git-merge-conflict-markers.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +GIT_MERGE_CONFLICT_EXPRESSION='^(<<<<<<<|=======|>>>>>>>)' + +if [[ "$*" == "--version" ]]; then + echo "1.0.0" + exit 0 +fi + +if grep -l -E "${GIT_MERGE_CONFLICT_EXPRESSION}" "$@"; then + echo "Found Git merge conflict markers" + exit 1 +else + echo "No merge conflicts found in $*" +fi diff --git a/scripts/linterVersions.sh b/scripts/linterVersions.sh index 0fbbb4ed..66ca6c97 100755 --- a/scripts/linterVersions.sh +++ b/scripts/linterVersions.sh @@ -24,6 +24,7 @@ LINTER_NAMES_ARRAY['ENV']="dotenv-linter" LINTER_NAMES_ARRAY['GITHUB_ACTIONS']="actionlint" LINTER_NAMES_ARRAY['GITLEAKS']="gitleaks" LINTER_NAMES_ARRAY['GHERKIN']="gherkin-lint" +LINTER_NAMES_ARRAY['GIT_MERGE_CONFLICT_MARKERS']="git-merge-conflict-markers" LINTER_NAMES_ARRAY['GO']="golangci-lint" LINTER_NAMES_ARRAY['GO_MODULES']="${LINTER_NAMES_ARRAY['GO']}" LINTER_NAMES_ARRAY['GO_RELEASER']="goreleaser" diff --git a/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-failure-slim.md b/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-failure-slim.md index 5124d191..c43133e2 100644 --- a/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-failure-slim.md +++ b/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-failure-slim.md @@ -2,89 +2,90 @@ -| Language | Validation result | -| ---------------------- | ----------------- | -| ANSIBLE | Fail ❌ | -| BASH | Fail ❌ | -| BASH_EXEC | Fail ❌ | -| CHECKOV | Fail ❌ | -| CLANG_FORMAT | Fail ❌ | -| CLOUDFORMATION | Fail ❌ | -| CLOJURE | Fail ❌ | -| COFFEESCRIPT | Fail ❌ | -| CPP | Fail ❌ | -| CSS | Fail ❌ | -| CSS_PRETTIER | Fail ❌ | -| DART | Fail ❌ | -| DOCKERFILE_HADOLINT | Fail ❌ | -| EDITORCONFIG | Fail ❌ | -| ENV | Fail ❌ | -| GITHUB_ACTIONS | Fail ❌ | -| GITLEAKS | Fail ❌ | -| GHERKIN | Fail ❌ | -| GO | Fail ❌ | -| GO_MODULES | Fail ❌ | -| GO_RELEASER | Fail ❌ | -| GOOGLE_JAVA_FORMAT | Fail ❌ | -| GRAPHQL_PRETTIER | Fail ❌ | -| GROOVY | Fail ❌ | -| HTML | Fail ❌ | -| HTML_PRETTIER | Fail ❌ | -| JAVA | Fail ❌ | -| JAVASCRIPT_ES | Fail ❌ | -| JAVASCRIPT_PRETTIER | Fail ❌ | -| JAVASCRIPT_STANDARD | Fail ❌ | -| JSCPD | Fail ❌ | -| JSON | Fail ❌ | -| JSON_PRETTIER | Fail ❌ | -| JSONC | Fail ❌ | -| JSONC_PRETTIER | Fail ❌ | -| JSX | Fail ❌ | -| JSX_PRETTIER | Fail ❌ | -| KUBERNETES_KUBECONFORM | Fail ❌ | -| KOTLIN | Fail ❌ | -| LATEX | Fail ❌ | -| LUA | Fail ❌ | -| MARKDOWN | Fail ❌ | -| MARKDOWN_PRETTIER | Fail ❌ | -| NATURAL_LANGUAGE | Fail ❌ | -| OPENAPI | Fail ❌ | -| PERL | Fail ❌ | -| PHP_BUILTIN | Fail ❌ | -| PHP_PHPCS | Fail ❌ | -| PHP_PHPSTAN | Fail ❌ | -| PHP_PSALM | Fail ❌ | -| PROTOBUF | Fail ❌ | -| PYTHON_BLACK | Fail ❌ | -| PYTHON_PYLINT | Fail ❌ | -| PYTHON_FLAKE8 | Fail ❌ | -| PYTHON_ISORT | Fail ❌ | -| PYTHON_MYPY | Fail ❌ | -| PYTHON_PYINK | Fail ❌ | -| PYTHON_RUFF | Fail ❌ | -| R | Fail ❌ | -| RAKU | Fail ❌ | -| RENOVATE | Fail ❌ | -| RUBY | Fail ❌ | -| SCALAFMT | Fail ❌ | -| SHELL_SHFMT | Fail ❌ | -| SNAKEMAKE_LINT | Fail ❌ | -| SNAKEMAKE_SNAKEFMT | Fail ❌ | -| STATES | Fail ❌ | -| SQLFLUFF | Fail ❌ | -| TEKTON | Fail ❌ | -| TERRAFORM_FMT | Fail ❌ | -| TERRAFORM_TFLINT | Fail ❌ | -| TERRAFORM_TERRASCAN | Fail ❌ | -| TERRAGRUNT | Fail ❌ | -| TSX | Fail ❌ | -| TYPESCRIPT_ES | Fail ❌ | -| TYPESCRIPT_PRETTIER | Fail ❌ | -| TYPESCRIPT_STANDARD | Fail ❌ | -| VUE_PRETTIER | Fail ❌ | -| XML | Fail ❌ | -| YAML | Fail ❌ | -| YAML_PRETTIER | Fail ❌ | +| Language | Validation result | +| -------------------------- | ----------------- | +| ANSIBLE | Fail ❌ | +| BASH | Fail ❌ | +| BASH_EXEC | Fail ❌ | +| CHECKOV | Fail ❌ | +| CLANG_FORMAT | Fail ❌ | +| CLOUDFORMATION | Fail ❌ | +| CLOJURE | Fail ❌ | +| COFFEESCRIPT | Fail ❌ | +| CPP | Fail ❌ | +| CSS | Fail ❌ | +| CSS_PRETTIER | Fail ❌ | +| DART | Fail ❌ | +| DOCKERFILE_HADOLINT | Fail ❌ | +| EDITORCONFIG | Fail ❌ | +| ENV | Fail ❌ | +| GITHUB_ACTIONS | Fail ❌ | +| GITLEAKS | Fail ❌ | +| GHERKIN | Fail ❌ | +| GIT_MERGE_CONFLICT_MARKERS | Fail ❌ | +| GO | Fail ❌ | +| GO_MODULES | Fail ❌ | +| GO_RELEASER | Fail ❌ | +| GOOGLE_JAVA_FORMAT | Fail ❌ | +| GRAPHQL_PRETTIER | Fail ❌ | +| GROOVY | Fail ❌ | +| HTML | Fail ❌ | +| HTML_PRETTIER | Fail ❌ | +| JAVA | Fail ❌ | +| JAVASCRIPT_ES | Fail ❌ | +| JAVASCRIPT_PRETTIER | Fail ❌ | +| JAVASCRIPT_STANDARD | Fail ❌ | +| JSCPD | Fail ❌ | +| JSON | Fail ❌ | +| JSON_PRETTIER | Fail ❌ | +| JSONC | Fail ❌ | +| JSONC_PRETTIER | Fail ❌ | +| JSX | Fail ❌ | +| JSX_PRETTIER | Fail ❌ | +| KUBERNETES_KUBECONFORM | Fail ❌ | +| KOTLIN | Fail ❌ | +| LATEX | Fail ❌ | +| LUA | Fail ❌ | +| MARKDOWN | Fail ❌ | +| MARKDOWN_PRETTIER | Fail ❌ | +| NATURAL_LANGUAGE | Fail ❌ | +| OPENAPI | Fail ❌ | +| PERL | Fail ❌ | +| PHP_BUILTIN | Fail ❌ | +| PHP_PHPCS | Fail ❌ | +| PHP_PHPSTAN | Fail ❌ | +| PHP_PSALM | Fail ❌ | +| PROTOBUF | Fail ❌ | +| PYTHON_BLACK | Fail ❌ | +| PYTHON_PYLINT | Fail ❌ | +| PYTHON_FLAKE8 | Fail ❌ | +| PYTHON_ISORT | Fail ❌ | +| PYTHON_MYPY | Fail ❌ | +| PYTHON_PYINK | Fail ❌ | +| PYTHON_RUFF | Fail ❌ | +| R | Fail ❌ | +| RAKU | Fail ❌ | +| RENOVATE | Fail ❌ | +| RUBY | Fail ❌ | +| SCALAFMT | Fail ❌ | +| SHELL_SHFMT | Fail ❌ | +| SNAKEMAKE_LINT | Fail ❌ | +| SNAKEMAKE_SNAKEFMT | Fail ❌ | +| STATES | Fail ❌ | +| SQLFLUFF | Fail ❌ | +| TEKTON | Fail ❌ | +| TERRAFORM_FMT | Fail ❌ | +| TERRAFORM_TFLINT | Fail ❌ | +| TERRAFORM_TERRASCAN | Fail ❌ | +| TERRAGRUNT | Fail ❌ | +| TSX | Fail ❌ | +| TYPESCRIPT_ES | Fail ❌ | +| TYPESCRIPT_PRETTIER | Fail ❌ | +| TYPESCRIPT_STANDARD | Fail ❌ | +| VUE_PRETTIER | Fail ❌ | +| XML | Fail ❌ | +| YAML | Fail ❌ | +| YAML_PRETTIER | Fail ❌ | diff --git a/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-failure-standard.md b/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-failure-standard.md index 0122b866..1fb42a9c 100644 --- a/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-failure-standard.md +++ b/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-failure-standard.md @@ -27,6 +27,7 @@ | GITHUB_ACTIONS | Fail ❌ | | GITLEAKS | Fail ❌ | | GHERKIN | Fail ❌ | +| GIT_MERGE_CONFLICT_MARKERS | Fail ❌ | | GO | Fail ❌ | | GO_MODULES | Fail ❌ | | GO_RELEASER | Fail ❌ | diff --git a/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-success-slim.md b/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-success-slim.md index 9b41f8ee..4844f76b 100644 --- a/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-success-slim.md +++ b/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-success-slim.md @@ -2,89 +2,90 @@ -| Language | Validation result | -| ---------------------- | ----------------- | -| ANSIBLE | Pass ✅ | -| BASH | Pass ✅ | -| BASH_EXEC | Pass ✅ | -| CHECKOV | Pass ✅ | -| CLANG_FORMAT | Pass ✅ | -| CLOUDFORMATION | Pass ✅ | -| CLOJURE | Pass ✅ | -| COFFEESCRIPT | Pass ✅ | -| CPP | Pass ✅ | -| CSS | Pass ✅ | -| CSS_PRETTIER | Pass ✅ | -| DART | Pass ✅ | -| DOCKERFILE_HADOLINT | Pass ✅ | -| EDITORCONFIG | Pass ✅ | -| ENV | Pass ✅ | -| GITHUB_ACTIONS | Pass ✅ | -| GITLEAKS | Pass ✅ | -| GHERKIN | Pass ✅ | -| GO | Pass ✅ | -| GO_MODULES | Pass ✅ | -| GO_RELEASER | Pass ✅ | -| GOOGLE_JAVA_FORMAT | Pass ✅ | -| GRAPHQL_PRETTIER | Pass ✅ | -| GROOVY | Pass ✅ | -| HTML | Pass ✅ | -| HTML_PRETTIER | Pass ✅ | -| JAVA | Pass ✅ | -| JAVASCRIPT_ES | Pass ✅ | -| JAVASCRIPT_PRETTIER | Pass ✅ | -| JAVASCRIPT_STANDARD | Pass ✅ | -| JSCPD | Pass ✅ | -| JSON | Pass ✅ | -| JSON_PRETTIER | Pass ✅ | -| JSONC | Pass ✅ | -| JSONC_PRETTIER | Pass ✅ | -| JSX | Pass ✅ | -| JSX_PRETTIER | Pass ✅ | -| KUBERNETES_KUBECONFORM | Pass ✅ | -| KOTLIN | Pass ✅ | -| LATEX | Pass ✅ | -| LUA | Pass ✅ | -| MARKDOWN | Pass ✅ | -| MARKDOWN_PRETTIER | Pass ✅ | -| NATURAL_LANGUAGE | Pass ✅ | -| OPENAPI | Pass ✅ | -| PERL | Pass ✅ | -| PHP_BUILTIN | Pass ✅ | -| PHP_PHPCS | Pass ✅ | -| PHP_PHPSTAN | Pass ✅ | -| PHP_PSALM | Pass ✅ | -| PROTOBUF | Pass ✅ | -| PYTHON_BLACK | Pass ✅ | -| PYTHON_PYLINT | Pass ✅ | -| PYTHON_FLAKE8 | Pass ✅ | -| PYTHON_ISORT | Pass ✅ | -| PYTHON_MYPY | Pass ✅ | -| PYTHON_PYINK | Pass ✅ | -| PYTHON_RUFF | Pass ✅ | -| R | Pass ✅ | -| RAKU | Pass ✅ | -| RENOVATE | Pass ✅ | -| RUBY | Pass ✅ | -| SCALAFMT | Pass ✅ | -| SHELL_SHFMT | Pass ✅ | -| SNAKEMAKE_LINT | Pass ✅ | -| SNAKEMAKE_SNAKEFMT | Pass ✅ | -| STATES | Pass ✅ | -| SQLFLUFF | Pass ✅ | -| TEKTON | Pass ✅ | -| TERRAFORM_FMT | Pass ✅ | -| TERRAFORM_TFLINT | Pass ✅ | -| TERRAFORM_TERRASCAN | Pass ✅ | -| TERRAGRUNT | Pass ✅ | -| TSX | Pass ✅ | -| TYPESCRIPT_ES | Pass ✅ | -| TYPESCRIPT_PRETTIER | Pass ✅ | -| TYPESCRIPT_STANDARD | Pass ✅ | -| VUE_PRETTIER | Pass ✅ | -| XML | Pass ✅ | -| YAML | Pass ✅ | -| YAML_PRETTIER | Pass ✅ | +| Language | Validation result | +| -------------------------- | ----------------- | +| ANSIBLE | Pass ✅ | +| BASH | Pass ✅ | +| BASH_EXEC | Pass ✅ | +| CHECKOV | Pass ✅ | +| CLANG_FORMAT | Pass ✅ | +| CLOUDFORMATION | Pass ✅ | +| CLOJURE | Pass ✅ | +| COFFEESCRIPT | Pass ✅ | +| CPP | Pass ✅ | +| CSS | Pass ✅ | +| CSS_PRETTIER | Pass ✅ | +| DART | Pass ✅ | +| DOCKERFILE_HADOLINT | Pass ✅ | +| EDITORCONFIG | Pass ✅ | +| ENV | Pass ✅ | +| GITHUB_ACTIONS | Pass ✅ | +| GITLEAKS | Pass ✅ | +| GHERKIN | Pass ✅ | +| GIT_MERGE_CONFLICT_MARKERS | Pass ✅ | +| GO | Pass ✅ | +| GO_MODULES | Pass ✅ | +| GO_RELEASER | Pass ✅ | +| GOOGLE_JAVA_FORMAT | Pass ✅ | +| GRAPHQL_PRETTIER | Pass ✅ | +| GROOVY | Pass ✅ | +| HTML | Pass ✅ | +| HTML_PRETTIER | Pass ✅ | +| JAVA | Pass ✅ | +| JAVASCRIPT_ES | Pass ✅ | +| JAVASCRIPT_PRETTIER | Pass ✅ | +| JAVASCRIPT_STANDARD | Pass ✅ | +| JSCPD | Pass ✅ | +| JSON | Pass ✅ | +| JSON_PRETTIER | Pass ✅ | +| JSONC | Pass ✅ | +| JSONC_PRETTIER | Pass ✅ | +| JSX | Pass ✅ | +| JSX_PRETTIER | Pass ✅ | +| KUBERNETES_KUBECONFORM | Pass ✅ | +| KOTLIN | Pass ✅ | +| LATEX | Pass ✅ | +| LUA | Pass ✅ | +| MARKDOWN | Pass ✅ | +| MARKDOWN_PRETTIER | Pass ✅ | +| NATURAL_LANGUAGE | Pass ✅ | +| OPENAPI | Pass ✅ | +| PERL | Pass ✅ | +| PHP_BUILTIN | Pass ✅ | +| PHP_PHPCS | Pass ✅ | +| PHP_PHPSTAN | Pass ✅ | +| PHP_PSALM | Pass ✅ | +| PROTOBUF | Pass ✅ | +| PYTHON_BLACK | Pass ✅ | +| PYTHON_PYLINT | Pass ✅ | +| PYTHON_FLAKE8 | Pass ✅ | +| PYTHON_ISORT | Pass ✅ | +| PYTHON_MYPY | Pass ✅ | +| PYTHON_PYINK | Pass ✅ | +| PYTHON_RUFF | Pass ✅ | +| R | Pass ✅ | +| RAKU | Pass ✅ | +| RENOVATE | Pass ✅ | +| RUBY | Pass ✅ | +| SCALAFMT | Pass ✅ | +| SHELL_SHFMT | Pass ✅ | +| SNAKEMAKE_LINT | Pass ✅ | +| SNAKEMAKE_SNAKEFMT | Pass ✅ | +| STATES | Pass ✅ | +| SQLFLUFF | Pass ✅ | +| TEKTON | Pass ✅ | +| TERRAFORM_FMT | Pass ✅ | +| TERRAFORM_TFLINT | Pass ✅ | +| TERRAFORM_TERRASCAN | Pass ✅ | +| TERRAGRUNT | Pass ✅ | +| TSX | Pass ✅ | +| TYPESCRIPT_ES | Pass ✅ | +| TYPESCRIPT_PRETTIER | Pass ✅ | +| TYPESCRIPT_STANDARD | Pass ✅ | +| VUE_PRETTIER | Pass ✅ | +| XML | Pass ✅ | +| YAML | Pass ✅ | +| YAML_PRETTIER | Pass ✅ | diff --git a/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-success-standard.md b/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-success-standard.md index b7375845..2d3ee241 100644 --- a/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-success-standard.md +++ b/test/data/super-linter-summary/markdown/table/expected-summary-test-linters-expect-success-standard.md @@ -27,6 +27,7 @@ | GITHUB_ACTIONS | Pass ✅ | | GITLEAKS | Pass ✅ | | GHERKIN | Pass ✅ | +| GIT_MERGE_CONFLICT_MARKERS | Pass ✅ | | GO | Pass ✅ | | GO_MODULES | Pass ✅ | | GO_RELEASER | Pass ✅ | diff --git a/test/inspec/super-linter/controls/super_linter.rb b/test/inspec/super-linter/controls/super_linter.rb index 7f8ba160..bdc581ec 100644 --- a/test/inspec/super-linter/controls/super_linter.rb +++ b/test/inspec/super-linter/controls/super_linter.rb @@ -162,6 +162,7 @@ control "super-linter-installed-commands" do { linter_name: "eslint"}, { linter_name: "flake8"}, { 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: "git-merge-conflict-markers"}, { linter_name: "gitleaks", version_option: "version"}, { linter_name: "golangci-lint"}, { linter_name: "goreleaser"}, @@ -526,6 +527,8 @@ control "super-linter-validate-files" do "/action/lib/.automation/phpcs.xml", "/action/lib/.automation/phpstan.neon", "/action/lib/.automation/psalm.xml", + "/usr/bin/bash-exec", + "/usr/bin/git-merge-conflict-markers", "/usr/bin/helm", # needed for checkov's helm framework "/usr/bin/kustomize", # needed for checkov's kustomize checks ] diff --git a/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_bad_01.txt b/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_bad_01.txt new file mode 100644 index 00000000..1760597e --- /dev/null +++ b/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_bad_01.txt @@ -0,0 +1,5 @@ +<<<<<<< HEAD:file.txt +Hello world 1 +======= +Goodbye 1 +>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt diff --git a/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_bad_02.txt b/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_bad_02.txt new file mode 100644 index 00000000..b7d0e4e1 --- /dev/null +++ b/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_bad_02.txt @@ -0,0 +1,5 @@ +<<<<<<< HEAD:file.txt +Hello world 2 +======= +Goodbye 2 +>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt diff --git a/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_good_01.txt b/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_good_01.txt new file mode 100644 index 00000000..560fefba --- /dev/null +++ b/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_good_01.txt @@ -0,0 +1 @@ +Hello world 1 diff --git a/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_good_02.txt b/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_good_02.txt new file mode 100644 index 00000000..b64ccf45 --- /dev/null +++ b/test/linters/git_merge_conflict_markers/git_merge_conflict_markers_good_02.txt @@ -0,0 +1 @@ +Hello world 2