fix: Make Git conflict markers check more precise

The https://github.com/super-linter/super-linter/pull/6113 introduced
new Git merge conflicts linter check, that is error prone in some
conditions (see screenshot).

This PR adjusts this check to be more precise and exact in a way that
all three markers should be found to identify check as failed.
Additionally improve Git merge conflict markers matchers.

Additionally update one good test file.
This commit is contained in:
github-actions[bot] 2024-11-18 14:15:37 +01:00 committed by George L. Yermulnik
parent 538bda9750
commit f3c34843e1
No known key found for this signature in database
11 changed files with 120 additions and 11 deletions

View file

@ -1,3 +1,3 @@
{
".": "7.1.0"
".": "7.2.0"
}

View file

@ -252,7 +252,14 @@ jobs:
- set-build-metadata
- build-container-image
- build-test-suite-matrix
# Don't fail the entire test suite when:
# - Running npm audit, so we can see test results even if there are
# vulnerable dependencies that might be unrelated to the PR
# - Running the 'test' target because it runs all the tests, including the
# ones that are allowed to fail
continue-on-error: ${{ matrix.test-case == 'npm-audit' || matrix.test-case == 'test' }}
strategy:
fail-fast: true
matrix:
test-case: ${{ fromJson(needs.build-test-suite-matrix.outputs.matrix) }}
images:

View file

@ -1,5 +1,81 @@
# Changelog
## [7.2.0](https://github.com/super-linter/super-linter/compare/v7.1.0...v7.2.0) (2024-11-17)
### 🚀 Features
* allow passing custom options to rust clippy ([#6094](https://github.com/super-linter/super-linter/issues/6094)) ([05d4d4e](https://github.com/super-linter/super-linter/commit/05d4d4e128d14b9c442efdd6617237b0e2ded1c1)), closes [#4001](https://github.com/super-linter/super-linter/issues/4001)
* implement a linter to check git conflicts ([#6113](https://github.com/super-linter/super-linter/issues/6113)) ([e0d8b4f](https://github.com/super-linter/super-linter/commit/e0d8b4fb2f36c890b71c5e14fd46715098c3c6f1))
* lint commit messages with commitlint ([#6118](https://github.com/super-linter/super-linter/issues/6118)) ([5d6e3fc](https://github.com/super-linter/super-linter/commit/5d6e3fcecc2b2906eedc2d15495fd6027bf51a9e))
* optionally remove color codes from output ([#6095](https://github.com/super-linter/super-linter/issues/6095)) ([94920ff](https://github.com/super-linter/super-linter/commit/94920ffcc743ebba42205db26cc4bad16f309498)), closes [#5540](https://github.com/super-linter/super-linter/issues/5540)
### 🐛 Bugfixes
* correctly load custom linter commands ([#6085](https://github.com/super-linter/super-linter/issues/6085)) ([ad0ff68](https://github.com/super-linter/super-linter/commit/ad0ff68c526c79ca1fd61d0225db7662571b8037)), closes [#6084](https://github.com/super-linter/super-linter/issues/6084)
### ⬆️ Dependency updates
* **bundler:** bump standard from 1.40.0 to 1.40.1 in /dependencies ([#6239](https://github.com/super-linter/super-linter/issues/6239)) ([75fb343](https://github.com/super-linter/super-linter/commit/75fb3434dd8338fac1b5616db1f5a564498370ad))
* **bundler:** bump standard from 1.41.0 to 1.41.1 in /dependencies ([#6291](https://github.com/super-linter/super-linter/issues/6291)) ([54782ec](https://github.com/super-linter/super-linter/commit/54782eccc3a321d55598c840167146057f4d13e5))
* **bundler:** bump the rubocop group across 1 directory with 3 updates ([#6348](https://github.com/super-linter/super-linter/issues/6348)) ([6e23e6e](https://github.com/super-linter/super-linter/commit/6e23e6e95389e4a4c98921307ef7a87d86203023))
* **bundler:** bump the rubocop group in /dependencies with 6 updates ([#6252](https://github.com/super-linter/super-linter/issues/6252)) ([a8920a4](https://github.com/super-linter/super-linter/commit/a8920a4c21bc416dcd1d96b70a5f76d7993c69e2))
* **docker:** bump composer/composer from 2.7.6 to 2.8.1 ([#6237](https://github.com/super-linter/super-linter/issues/6237)) ([95b56f1](https://github.com/super-linter/super-linter/commit/95b56f1a2700dfcadc3b5ebda9b7647da95f57ea))
* **docker:** bump golang from 1.23.0-alpine to 1.23.2-alpine ([#6236](https://github.com/super-linter/super-linter/issues/6236)) ([2a42244](https://github.com/super-linter/super-linter/commit/2a42244b37895c51a495f1248397bb69bea918c7))
* **docker:** bump python from 3.12.5-alpine3.20 to 3.12.7-alpine3.20 ([#6235](https://github.com/super-linter/super-linter/issues/6235)) ([c97987c](https://github.com/super-linter/super-linter/commit/c97987ce2af88ca69ee2aa614e198878c23438ff))
* **docker:** bump the docker group across 1 directory with 15 updates ([#6356](https://github.com/super-linter/super-linter/issues/6356)) ([ddabcba](https://github.com/super-linter/super-linter/commit/ddabcba0013165686703808e1b16b6d8747325af))
* **java:** bump the java-gradle group across 2 directories with 2 updates ([#6248](https://github.com/super-linter/super-linter/issues/6248)) ([fd28996](https://github.com/super-linter/super-linter/commit/fd2899662d0a9f8f1dddd571291fc11cb6dac522))
* **java:** bump the java-gradle group across 2 directories with 2 updates ([#6335](https://github.com/super-linter/super-linter/issues/6335)) ([d4402a4](https://github.com/super-linter/super-linter/commit/d4402a4727d63bb6da5ccdab177bda7186dafbbc))
* **npm:** bump @babel/eslint-parser in /dependencies ([#6261](https://github.com/super-linter/super-linter/issues/6261)) ([0891581](https://github.com/super-linter/super-linter/commit/08915817797e117d23ba88c3bd1be99a5254b031))
* **npm:** bump @babel/eslint-parser in /dependencies ([#6307](https://github.com/super-linter/super-linter/issues/6307)) ([538bda9](https://github.com/super-linter/super-linter/commit/538bda9750c98fe25cc69ce2b63fd4f6bd9327b0))
* **npm:** bump @react-native/eslint-config ([#6355](https://github.com/super-linter/super-linter/issues/6355)) ([4013f55](https://github.com/super-linter/super-linter/commit/4013f55081a5c85a7128318b612190113b919f38))
* **npm:** bump @stoplight/spectral-cli in /dependencies ([#6181](https://github.com/super-linter/super-linter/issues/6181)) ([468901b](https://github.com/super-linter/super-linter/commit/468901bc7f7f9e7382b22b11ffd07de41869d703))
* **npm:** bump @stoplight/spectral-cli in /dependencies ([#6337](https://github.com/super-linter/super-linter/issues/6337)) ([918f185](https://github.com/super-linter/super-linter/commit/918f185c8e70ebc6260790da6a3862757e760387))
* **npm:** bump @stoplight/spectral-cli in /dependencies ([#6359](https://github.com/super-linter/super-linter/issues/6359)) ([9b3e0cd](https://github.com/super-linter/super-linter/commit/9b3e0cd5f3cee32b6d11a9e68e4c6e4dfee3d786))
* **npm:** bump asl-validator from 3.8.3 to 3.8.4 in /dependencies ([#6312](https://github.com/super-linter/super-linter/issues/6312)) ([e8c508a](https://github.com/super-linter/super-linter/commit/e8c508a3b95acda635948f0a1a078f2fe89a9905))
* **npm:** bump asl-validator from 3.8.4 to 3.9.0 in /dependencies ([#6357](https://github.com/super-linter/super-linter/issues/6357)) ([f955866](https://github.com/super-linter/super-linter/commit/f95586699f5ef40fe3c167dcd3e3d035ac6c425e))
* **npm:** bump eslint from 8.57.0 to 8.57.1 in /dependencies ([#6177](https://github.com/super-linter/super-linter/issues/6177)) ([86df3f8](https://github.com/super-linter/super-linter/commit/86df3f81d2309e5cdcbd979deff9403f56c38291))
* **npm:** bump markdownlint-cli from 0.41.0 to 0.42.0 in /dependencies ([#6199](https://github.com/super-linter/super-linter/issues/6199)) ([1f9b00c](https://github.com/super-linter/super-linter/commit/1f9b00ce5a3b3ca19240d7a60e87cc8b2741626f))
* **npm:** bump next ([#6256](https://github.com/super-linter/super-linter/issues/6256)) ([6994834](https://github.com/super-linter/super-linter/commit/699483443096c24e82b7244bcc8cbe214b268f29))
* **npm:** bump next ([#6329](https://github.com/super-linter/super-linter/issues/6329)) ([9b2933b](https://github.com/super-linter/super-linter/commit/9b2933b74cb26ee0ada336629f9d5f16bd8474f6))
* **npm:** bump next from 14.2.6 to 14.2.11 in /dependencies ([#6157](https://github.com/super-linter/super-linter/issues/6157)) ([b526eff](https://github.com/super-linter/super-linter/commit/b526effb8b749bc8290f1c5ec05fdc75a1ba110b))
* **npm:** bump npm-groovy-lint from 14.6.0 to 15.0.2 in /dependencies ([#6266](https://github.com/super-linter/super-linter/issues/6266)) ([b8dc2a1](https://github.com/super-linter/super-linter/commit/b8dc2a1466f38964184658091f4c687ebcb64ac8))
* **npm:** bump renovate from 38.55.1 to 39.15.4 in /dependencies ([#6358](https://github.com/super-linter/super-linter/issues/6358)) ([3aff158](https://github.com/super-linter/super-linter/commit/3aff1585265f8327e15b9f67d31e4a86da26f958))
* **npm:** bump standard from 17.1.0 to 17.1.2 in /dependencies ([#6265](https://github.com/super-linter/super-linter/issues/6265)) ([22f5beb](https://github.com/super-linter/super-linter/commit/22f5beb605025ac85b67eca1bfc8444f10d879ee))
* **npm:** bump textlint ([#6305](https://github.com/super-linter/super-linter/issues/6305)) ([e55903c](https://github.com/super-linter/super-linter/commit/e55903c2aa70f5d4b95af8dd2d1e16d1cf3eeeef))
* **npm:** bump the eslint-plugins-configs group across 1 directory with 5 updates ([#6255](https://github.com/super-linter/super-linter/issues/6255)) ([5e252d4](https://github.com/super-linter/super-linter/commit/5e252d43ffa66a2cdebb586ebb5277199c990b7a))
* **npm:** bump the react group across 1 directory with 4 updates ([#6257](https://github.com/super-linter/super-linter/issues/6257)) ([7b76efb](https://github.com/super-linter/super-linter/commit/7b76efbd69ef471b83d5273d4b5d8b3cbd8e5e3f))
* **npm:** bump the react group across 1 directory with 4 updates ([#6332](https://github.com/super-linter/super-linter/issues/6332)) ([b9520be](https://github.com/super-linter/super-linter/commit/b9520bea7ab85daae0eb5c2407c5c0972ac09b0a))
* **npm:** bump the stylelint group across 1 directory with 7 updates ([#6340](https://github.com/super-linter/super-linter/issues/6340)) ([f9e2182](https://github.com/super-linter/super-linter/commit/f9e2182dc13159432f84a91210667289eb79cd1f))
* **npm:** bump the textlint group across 1 directory with 2 updates ([#6259](https://github.com/super-linter/super-linter/issues/6259)) ([2078ebb](https://github.com/super-linter/super-linter/commit/2078ebbcae2a1a733a3fd998bc371f6d2f88b8a2))
* **php:** bump the composer group across 1 directory with 2 updates ([#6249](https://github.com/super-linter/super-linter/issues/6249)) ([b23c022](https://github.com/super-linter/super-linter/commit/b23c02219c4a7ac4498fdbb1fced0d1435bd853c))
* **php:** bump the composer group across 1 directory with 2 updates ([#6344](https://github.com/super-linter/super-linter/issues/6344)) ([8638675](https://github.com/super-linter/super-linter/commit/8638675681e7d24125f71d09bbd20e296a75883c))
* **python:** bump the pip group across 1 directory with 11 updates ([#6350](https://github.com/super-linter/super-linter/issues/6350)) ([1f55d98](https://github.com/super-linter/super-linter/commit/1f55d98b0b1f611bedf57dd26c8476d92391aba3))
### 🧰 Maintenance
* add .ds_store to .gitignore ([#6241](https://github.com/super-linter/super-linter/issues/6241)) ([2bdad66](https://github.com/super-linter/super-linter/commit/2bdad665d3458affddba71a1eac3f21d3f06dd85))
* add mypy to the python group ([#6275](https://github.com/super-linter/super-linter/issues/6275)) ([e69f036](https://github.com/super-linter/super-linter/commit/e69f0364d2fd33c3ea08a4ca973762de2a4e655b))
* configure terraform formatting ([#6092](https://github.com/super-linter/super-linter/issues/6092)) ([dd33b47](https://github.com/super-linter/super-linter/commit/dd33b476f887b19d84d51613d3cec227d5d9d963))
* **dev-docker:** bump node in /dev-dependencies ([#6173](https://github.com/super-linter/super-linter/issues/6173)) ([5367999](https://github.com/super-linter/super-linter/commit/5367999a48fbfd7f917098037c96afda44e841ed))
* **dev-docker:** bump node in /dev-dependencies ([#6300](https://github.com/super-linter/super-linter/issues/6300)) ([ae65f71](https://github.com/super-linter/super-linter/commit/ae65f71b345f20883d58745d9715947d8893ff3c))
* devcontainer, docs, prettier config ([#6119](https://github.com/super-linter/super-linter/issues/6119)) ([170cabf](https://github.com/super-linter/super-linter/commit/170cabf92b9ee74a38a2c035cdd48e63d8d42153))
* explain how to configure the path ([#6244](https://github.com/super-linter/super-linter/issues/6244)) ([0208181](https://github.com/super-linter/super-linter/commit/02081814d883fc3401b8d3bdd67ec66ea91ad7f0))
* **github-actions:** bump actions/upload-artifact ([#6251](https://github.com/super-linter/super-linter/issues/6251)) ([ec9d08a](https://github.com/super-linter/super-linter/commit/ec9d08a2334522236d1a2b8566b51530364b78ad))
* **github-actions:** bump actions/upload-artifact from 4.3.6 to 4.4.0 ([#6097](https://github.com/super-linter/super-linter/issues/6097)) ([00b52f3](https://github.com/super-linter/super-linter/commit/00b52f36b6e86ab2277b50526b088bc294e25e54))
* group dependency updates prs ([#6247](https://github.com/super-linter/super-linter/issues/6247)) ([fed55ef](https://github.com/super-linter/super-linter/commit/fed55ef448dfd4e8002af9367092c4f1b7a55f37))
* improve ignore/exclude examples ([#6088](https://github.com/super-linter/super-linter/issues/6088)) ([c9116aa](https://github.com/super-linter/super-linter/commit/c9116aac88ffa6f475029ec2c9b2a30c365a8ce7))
* manage php dependencies ([#6139](https://github.com/super-linter/super-linter/issues/6139)) ([72a4884](https://github.com/super-linter/super-linter/commit/72a4884f7a37b7409b5ef2c7ab29fb552636bb74))
* move base image to a dedicated group ([#6351](https://github.com/super-linter/super-linter/issues/6351)) ([99b4bf6](https://github.com/super-linter/super-linter/commit/99b4bf6e025eedd387533097c25d43158c533827))
* prepare tests for updates ([#6279](https://github.com/super-linter/super-linter/issues/6279)) ([6c2f03f](https://github.com/super-linter/super-linter/commit/6c2f03ffb423a9c1069f0b42727b119d91f314ec))
* shorten linter versions ([#6176](https://github.com/super-linter/super-linter/issues/6176)) ([fc34cb5](https://github.com/super-linter/super-linter/commit/fc34cb53d9e6a866f9fbeec5c6abd638c3ac46da))
* simplified awk usage for version extraction ([#5893](https://github.com/super-linter/super-linter/issues/5893)) ([dd646d7](https://github.com/super-linter/super-linter/commit/dd646d7b7feddf1e7660f8cf080a2c924ef657db))
* update link to jscpd documentation ([#6117](https://github.com/super-linter/super-linter/issues/6117)) ([058b923](https://github.com/super-linter/super-linter/commit/058b9239d47af5565e7c80f55ec097259ad00673))
* update rollup ([#6203](https://github.com/super-linter/super-linter/issues/6203)) ([c4fe4da](https://github.com/super-linter/super-linter/commit/c4fe4da1f3bda7fd0f28bf92dd357fb9feeef5bf)), closes [#6197](https://github.com/super-linter/super-linter/issues/6197)
## [7.1.0](https://github.com/super-linter/super-linter/compare/v7.0.0...v7.1.0) (2024-08-27)

View file

@ -85,7 +85,6 @@ RUN apk add --no-cache \
COPY dependencies/package.json dependencies/package-lock.json /
RUN apk add --no-cache --virtual .node-build-deps \
npm \
&& npm audit \
&& npm install --strict-peer-deps \
&& npm cache clean --force \
&& chown -R "$(id -u)":"$(id -g)" node_modules \

View file

@ -4,7 +4,7 @@
all: info docker test ## Run all targets.
.PHONY: test
test: info validate-container-image-labels docker-build-check docker-dev-container-build-check test-lib inspec lint-codebase fix-codebase test-default-config-files test-actions-runner-debug test-actions-steps-debug test-runner-debug test-find lint-subset-files test-custom-ssl-cert test-non-default-workdir test-git-flags test-non-default-home-directory test-git-initial-commit test-git-merge-commit-push test-log-level test-use-find-and-ignore-gitignored-files test-linters-expect-failure-log-level-notice test-bash-exec-library-expect-success test-bash-exec-library-expect-failure test-save-super-linter-output test-save-super-linter-output-custom-path test-save-super-linter-custom-summary test-custom-gitleaks-log-level test-dont-save-super-linter-log-file test-dont-save-super-linter-output test-linters test-linters-fix-mode ## Run the test suite
test: info validate-container-image-labels docker-build-check docker-dev-container-build-check npm-audit test-lib inspec lint-codebase fix-codebase test-default-config-files test-actions-runner-debug test-actions-steps-debug test-runner-debug test-find lint-subset-files test-custom-ssl-cert test-non-default-workdir test-git-flags test-non-default-home-directory test-git-initial-commit test-git-merge-commit-push test-log-level test-use-find-and-ignore-gitignored-files test-linters-expect-failure-log-level-notice test-bash-exec-library-expect-success test-bash-exec-library-expect-failure test-save-super-linter-output test-save-super-linter-output-custom-path test-save-super-linter-custom-summary test-custom-gitleaks-log-level test-dont-save-super-linter-log-file test-dont-save-super-linter-output test-linters test-linters-fix-mode ## Run the test suite
# if this session isn't interactive, then we don't want to allocate a
# TTY, which would fail, but if it is interactive, we do want to attach
@ -165,6 +165,17 @@ validate-container-image-labels: ## Validate container image labels
$(BUILD_REVISION) \
$(BUILD_VERSION)
.PHONY: npm-audit
npm-audit: ## Run npm audit to check for known vulnerable dependencies
docker run $(DOCKER_FLAGS) \
--entrypoint /bin/bash \
--rm \
-v "$(CURDIR)/dependencies/package-lock.json":/package-lock.json \
-v "$(CURDIR)/dependencies/package.json":/package.json \
--workdir / \
$(SUPER_LINTER_TEST_CONTAINER_URL) \
-c "npm audit"
# For some cases, mount a directory that doesn't have too many files to keep tests short
.PHONY: test-actions-runner-debug

View file

@ -156,7 +156,7 @@ To run super-linter as a GitHub Action, you do the following:
fetch-depth: 0
- name: Super-linter
uses: super-linter/super-linter@v7.1.0 # x-release-please-version
uses: super-linter/super-linter@v7.2.0 # x-release-please-version
env:
# To report GitHub Actions status checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -531,7 +531,7 @@ jobs:
with:
fetch-depth: 0
- name: Super-Linter
uses: super-linter/super-linter@v7.1.0 # x-release-please-version
uses: super-linter/super-linter@v7.2.0 # x-release-please-version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Set your fix mode variables to true

View file

@ -4,7 +4,7 @@ author: "Super-linter contributors"
description: "Super-linter is a ready-to-run collection of linters and code analyzers, to help validate your source code."
runs:
using: "docker"
image: "docker://ghcr.io/super-linter/super-linter:v7.1.0" # x-release-please-version
image: "docker://ghcr.io/super-linter/super-linter:v7.2.0" # x-release-please-version
branding:
icon: "check-square"
color: "white"

View file

@ -4,15 +4,27 @@ set -o errexit
set -o nounset
set -o pipefail
GIT_MERGE_CONFLICT_EXPRESSION='^(<<<<<<<|=======|>>>>>>>)'
GIT_MERGE_CONFLICT_START='^<{7} .+$'
GIT_MERGE_CONFLICT_MIDST='^={7}$'
GIT_MERGE_CONFLICT_END='^>{7} .+$'
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"
declare -i errors=0
for file in "$@"; do
if grep -q -E "${GIT_MERGE_CONFLICT_START}" "$file" &&
grep -q -E "${GIT_MERGE_CONFLICT_MIDST}" "$file" &&
grep -q -E "${GIT_MERGE_CONFLICT_END}" "$file"; then
echo "Found Git merge conflict markers: \"$file\""
errors=$((errors + 1))
fi
done
if [[ $errors -gt 0 ]]; then
exit 1
else
echo "No merge conflicts found in $*"

View file

@ -4,7 +4,7 @@ author: "Super-linter contributors"
description: "Super-linter is a ready-to-run collection of linters and code analyzers, to help validate your source code."
runs:
using: "docker"
image: "docker://ghcr.io/super-linter/super-linter:slim-v7.1.0" # x-release-please-version
image: "docker://ghcr.io/super-linter/super-linter:slim-v7.2.0" # x-release-please-version
branding:
icon: "check-square"
color: "white"

View file

@ -1 +1,5 @@
<<<<<<<<<<<<<
Hello world 2
=============
Goodbye 2
>>>>>>>>>>>>>

View file

@ -1 +1 @@
7.1.0
7.2.0