superlint/scripts/git-merge-conflict-markers.sh
Marco Ferrari e0d8b4fb2f
feat: implement a linter to check git conflicts (#6113)
Implement a linter to check if files contain Git conflict
markers or whitespace errors.
2024-09-05 08:02:36 +02:00

19 lines
350 B
Bash
Executable file

#!/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