diff --git a/Makefile b/Makefile
index 21f96e7..2e3e05f 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,7 @@ _test-req:
@docker run --rm $(IMAGE) file-trailing-space --info
@docker run --rm $(IMAGE) file-utf8 --info
@docker run --rm $(IMAGE) file-utf8-bom --info
+ @docker run --rm $(IMAGE) git-conflicts --info
_test-run-succ:
@echo "------------------------------------------------------------"
@@ -57,6 +58,7 @@ _test-run-succ:
@docker run --rm -v $(CURRENT_DIR)/tests/ok:/data $(IMAGE) file-trailing-space --path .
@docker run --rm -v $(CURRENT_DIR)/tests/ok:/data $(IMAGE) file-utf8 --path .
@docker run --rm -v $(CURRENT_DIR)/tests/ok:/data $(IMAGE) file-utf8-bom --path .
+ @docker run --rm -v $(CURRENT_DIR)/tests/ok:/data $(IMAGE) git-conflicts --path .
_test-run-fail:
@echo "------------------------------------------------------------"
@@ -89,6 +91,9 @@ _test-run-fail:
@if docker run --rm -v $(CURRENT_DIR)/tests/err:/data $(IMAGE) file-utf8-bom --path .; then \
exit 1; \
fi
+ @if docker run --rm -v $(CURRENT_DIR)/tests/err:/data $(IMAGE) git-conflicts --path .; then \
+ exit 1; \
+ fi
tag:
docker tag $(IMAGE) $(IMAGE):$(TAG)
diff --git a/README.md b/README.md
index 5901005..af32b0d 100644
--- a/README.md
+++ b/README.md
@@ -21,11 +21,14 @@
> [goimports][gimp-git-lnk] **•**
> [golint][glint-git-lnk] **•**
> [jsonlint][jlint-git-lnk] **•**
+> [linkcheck][linkcheck-git-lnk] **•**
+> [mypy][mypy-git-lnk] **•**
> [phpcbf][pcbf-git-lnk] **•**
> [phpcs][pcs-git-lnk] **•**
> [phplint][plint-git-lnk] **•**
> [php-cs-fixer][pcsf-git-lnk] **•**
> [pycodestyle][pycs-git-lnk] **•**
+> [pydocstyle][pyds-git-lnk] **•**
> [pylint][pylint-git-lnk] **•**
> [terraform-docs][tfdocs-git-lnk] **•**
> [terragrunt][tg-git-lnk] **•**
@@ -78,6 +81,7 @@ Tiny Alpine-based Docker image for the very basics of CI against your code files
| File | [file-trailing-space](data/file-trailing-space) | ✓ | Scan files and check if they contain trailing whitespaces. |
| File | [file-utf8](data/file-utf8) | ✓ | Scan files and check if they have a non UTF-8 encoding. |
| File | [file-utf8-bom](data/file-utf8-bom) | ✓ | Scan files and check if they contain BOM (Byte Order Mark): `U+FEFF`. |
+| Git | [git-conflicts](data/git-conflicts) | | Scan files and check if they contain git conflicts. |
> Tools extracted from https://github.com/cytopia/awesome-ci
@@ -126,6 +130,7 @@ $ docker run --rm -v $(pwd):/data cytopia/file-lint
# file-trailing-space Scans if files contain trailing whitespace #
# file-utf8 Scans if files are utf8 encoded #
# file-utf8-bom Scans if files contain byte order mark #
+# git-conflicts Scans if files contain git conflicts #
# #
# #
# Example: #
@@ -314,6 +319,12 @@ FILE_UTF8_BOM_EXTENSION=""
FILE_UTF8_BOM_IGNORE=".git,*.svn"
FILE_UTF8_BOM_TEXT=1
FILE_UTF8_BOM_SIZE=1
+
+# git-conflicts
+GIT_CONFLICTS_EXTENSION=""
+GIT_CONFLICTS_IGNORE=".git,*.svn"
+GIT_CONFLICTS_TEXT=1
+GIT_CONFLICTS_SIZE=1
```
### Example Makefile
@@ -322,9 +333,7 @@ ifneq (,)
.error This Makefile requires GNU Make.
endif
-.PHONY: lint _lint-cr _lint-crlf _lint-trailing-single-newline _lint-trailing-space _lint-utf8 _lint-utf8-bom
-
-CURRENT_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+.PHONY: lint _lint-cr _lint-crlf _lint-trailing-single-newline _lint-trailing-space _lint-utf8 _lint-utf8-bom _lint-git-conflicts
FL_VERSION = latest
FL_IGNORE_PATHS = .git/,.github/
@@ -336,24 +345,29 @@ lint:
@$(MAKE) --no-print-directory _lint-trailing-space
@$(MAKE) --no-print-directory _lint-utf8
@$(MAKE) --no-print-directory _lint-utf8-bom
+ @$(MAKE) --no-print-directory _lint-git-conflicts
_lint-cr:
- @docker run --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-cr --text --ignore '$(FL_IGNORE_PATHS)' --path .
+ @docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-cr --text --ignore '$(FL_IGNORE_PATHS)' --path .
_lint-crlf:
- @docker run --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-crlf --text --ignore '$(FL_IGNORE_PATHS)' --path .
+ @docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-crlf --text --ignore '$(FL_IGNORE_PATHS)' --path .
_lint-trailing-single-newline:
- @docker run --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-trailing-single-newline --text --ignore '$(FL_IGNORE_PATHS)' --path .
+ @docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-trailing-single-newline --text --ignore '$(FL_IGNORE_PATHS)' --path .
_lint-trailing-space:
- @docker run --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-trailing-space --text --ignore '$(FL_IGNORE_PATHS)' --path .
+ @docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-trailing-space --text --ignore '$(FL_IGNORE_PATHS)' --path .
_lint-utf8:
- @docker run --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-utf8 --text --ignore '$(FL_IGNORE_PATHS)' --path .
+ @docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-utf8 --text --ignore '$(FL_IGNORE_PATHS)' --path .
_lint-utf8-bom:
- @docker run --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-utf8-bom --text --ignore '$(FL_IGNORE_PATHS)' --path .
+ @docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-utf8-bom --text --ignore '$(FL_IGNORE_PATHS)' --path .
+
+_lint-git-conflicts:
+ @docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) git-conflicts --text --ignore '$(FL_IGNORE_PATHS)' --path .
+
```
@@ -368,6 +382,7 @@ linter below for reproducible local or remote CI tests:
|--------|-----------|------|-------------|
| [awesome-ci][aci-git-lnk] | [![aci-hub-img]][aci-hub-lnk] | Basic | Tools for git, file and static source code analysis |
| [file-lint][flint-git-lnk] | [![flint-hub-img]][flint-hub-lnk] | Basic | Baisc source code analysis |
+| [linkcheck][linkcheck-git-lnk] | [![linkcheck-hub-img]][flint-hub-lnk] | Basic | Search for URLs in files and validate their HTTP status code |
| [ansible][ansible-git-lnk] | [![ansible-hub-img]][ansible-hub-lnk] | Ansible | Multiple versions and flavours of Ansible |
| [ansible-lint][alint-git-lnk] | [![alint-hub-img]][alint-hub-lnk] | Ansible | Lint Ansible |
| [gofmt][gfmt-git-lnk] | [![gfmt-hub-img]][gfmt-hub-lnk] | Go | Format Go source code **[1]** |
@@ -381,7 +396,9 @@ linter below for reproducible local or remote CI tests:
| [phplint][plint-git-lnk] | [![plint-hub-img]][plint-hub-lnk] | PHP | PHP Code Linter **[1]** |
| [php-cs-fixer][pcsf-git-lnk] | [![pcsf-hub-img]][pcsf-hub-lnk] | PHP | PHP Coding Standards Fixer |
| [black][black-git-lnk] | [![black-hub-img]][black-hub-lnk] | Python | The uncompromising Python code formatter |
+| [mypy][mypy-git-lnk] | [![mypy-hub-img]][mypy-hub-lnk] | Python | Static source code analysis |
| [pycodestyle][pycs-git-lnk] | [![pycs-hub-img]][pycs-hub-lnk] | Python | Python style guide checker |
+| [pydocstyle][pyds-git-lnk] | [![pyds-hub-img]][pyds-hub-lnk] | Python | Python docstyle checker |
| [pylint][pylint-git-lnk] | [![pylint-hub-img]][pylint-hub-lnk] | Python | Python source code, bug and quality checker |
| [terraform-docs][tfdocs-git-lnk] | [![tfdocs-hub-img]][tfdocs-hub-lnk] | Terraform | Terraform doc generator (TF 0.12 ready) **[1]** |
| [terragrunt][tg-git-lnk] | [![tg-hub-img]][tg-hub-lnk] | Terraform | Terragrunt and Terraform |
@@ -399,6 +416,10 @@ linter below for reproducible local or remote CI tests:
[flint-hub-img]: https://img.shields.io/docker/pulls/cytopia/file-lint.svg
[flint-hub-lnk]: https://hub.docker.com/r/cytopia/file-lint
+[linkcheck-git-lnk]: https://github.com/cytopia/docker-linkcheck
+[linkcheck-hub-img]: https://img.shields.io/docker/pulls/cytopia/linkcheck.svg
+[linkcheck-hub-lnk]: https://hub.docker.com/r/cytopia/linkcheck
+
[jlint-git-lnk]: https://github.com/cytopia/docker-jsonlint
[jlint-hub-img]: https://img.shields.io/docker/pulls/cytopia/jsonlint.svg
[jlint-hub-lnk]: https://hub.docker.com/r/cytopia/jsonlint
@@ -451,10 +472,18 @@ linter below for reproducible local or remote CI tests:
[black-hub-img]: https://img.shields.io/docker/pulls/cytopia/black.svg
[black-hub-lnk]: https://hub.docker.com/r/cytopia/black
+[mypy-git-lnk]: https://github.com/cytopia/docker-mypy
+[mypy-hub-img]: https://img.shields.io/docker/pulls/cytopia/mypy.svg
+[mypy-hub-lnk]: https://hub.docker.com/r/cytopia/mypy
+
[pycs-git-lnk]: https://github.com/cytopia/docker-pycodestyle
[pycs-hub-img]: https://img.shields.io/docker/pulls/cytopia/pycodestyle.svg
[pycs-hub-lnk]: https://hub.docker.com/r/cytopia/pycodestyle
+[pyds-git-lnk]: https://github.com/cytopia/docker-pydocstyle
+[pyds-hub-img]: https://img.shields.io/docker/pulls/cytopia/pydocstyle.svg
+[pyds-hub-lnk]: https://hub.docker.com/r/cytopia/pydocstyle
+
[pylint-git-lnk]: https://github.com/cytopia/docker-pylint
[pylint-hub-img]: https://img.shields.io/docker/pulls/cytopia/pylint.svg
[pylint-hub-lnk]: https://hub.docker.com/r/cytopia/pylint
diff --git a/data/awesome-ci-lib.sh b/data/awesome-ci-lib.sh
index fa4bf53..e9dbf17 100644
--- a/data/awesome-ci-lib.sh
+++ b/data/awesome-ci-lib.sh
@@ -4,8 +4,8 @@ set -u
#
# Version
#
-MY_VERSION="0.16"
-MY_DATE="2019-06-15"
+MY_VERSION="0.17"
+MY_DATE="2020-06-13"
#
# Credits
diff --git a/data/git-conflicts b/data/git-conflicts
new file mode 100755
index 0000000..dce7181
--- /dev/null
+++ b/data/git-conflicts
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+set -u
+
+############################################################
+# Adjust for each check
+############################################################
+
+# Name and messages
+MY_NAME="git-conflicts"
+MY_DESC="Scans recursively for files containing git conflicts."
+MY_FINISH_OK="No files with git conflicts found."
+MY_FINISH_ERR="Found files with git conflicts."
+
+# Configuration file prefix
+MY_CONF_PRE="GIT_CONFLICTS_"
+
+# Custom required binaries
+REQUIRED_CUST_BINS=""
+
+# Binaries required for fixing
+REQUIRED_FIX_BINS=""
+
+# Enable custom options (cmd arguments)
+# that can be parsed to the actual check binary?
+ENABLE_CUST_OPS=0
+
+# When not specifying --custom,
+# always use this as the default options
+# to parse to the check binary.
+DEFAULT_CUST_OPS=""
+
+# How to add your check here:
+# ---------------------------
+# $1 This comes from xargs and represents
+# the current file to work on:
+# xargs sh '${MY_CHECK}' --
+#
+# __CUSTOM_OPT_PLACEHOLDER__
+# This will be replaced either with custom options
+# or with the default options.
+MY_REG="^(<<<<<<<|>>>>>>>)[[:space:]]."
+MY_CHECK="grep --color=always -inHE \"${MY_REG}\" \"\$1\" || true"
+
+# Can this check fix the problems?
+ENABLE_FIX=0
+
+# Command to be displayed for --info
+MY_INFO="grep -V | grep -E '([0-9]+\.+)+'"
+
+
+############################################################
+# Source library
+############################################################
+
+. /usr/bin/awesome-ci-lib.sh
diff --git a/data/usage b/data/usage
index b13c958..ddee785 100755
--- a/data/usage
+++ b/data/usage
@@ -25,6 +25,7 @@ echo "# file-trailing-single-newline Scans if files contain single trailing new
echo "# file-trailing-space Scans if files contain trailing whitespace #"
echo "# file-utf8 Scans if files are utf8 encoded #"
echo "# file-utf8-bom Scans if files contain byte order mark #"
+echo "# git-conflicts Scans if files contain git conflicts #"
echo "# #"
echo "# #"
echo "# Example: #"
diff --git a/tests/ok/git-conflicts_ok b/tests/ok/git-conflicts_ok
index 7cd5b35..ea61149 100644
--- a/tests/ok/git-conflicts_ok
+++ b/tests/ok/git-conflicts_ok
@@ -1 +1,9 @@
No git conflicts found
+The following are all non-valid delimiter
+>>>>>>>
+>>>>>>>branch-a
+ >>>>>>> branch-a
+
+<<<<<<<
+<<<<<<