All #awesome-ci Docker images
ansible • ansible-lint • awesome-ci • black • checkmake • eslint • file-lint • gofmt • goimports • golint • jsonlint • linkcheck • mypy • phpcbf • phpcs • phplint • php-cs-fixer • pycodestyle • pydocstyle • pylint • terraform-docs • terragrunt • terragrunt-fmt • yamlfmt • yamllint
All #awesome-ci Makefiles
Visit cytopia/makefiles for seamless project integration, minimum required best-practice code linting and CI.
View Dockerfile on GitHub.
Tiny Alpine-based Docker image for the very basics of CI against your code files based one awesome-ci[1].
[1] Original project: https://github.com/topics/awesome-ci
- dry run (which shows all piped unix command voodoo for learning)
- project based configuration file (
awesome-ci.conf
) - check for empty files
- check for files with carriage returns (
\r
) - check for files with windows newlines (
\r\n
) - check for files with nullbyte characters (
\x00
) - check for trailing newlines at eof (exactly one or multiple)
- check for trailing white space
- ensure files are utf8 encoded
- ensure files do not contain utf8 bom (byte order mark:
U+FEFF
) - allows for automatic fixing (most commands)
- allows for find-grained control
- check files by specific extension(s) only
- check files by specific shebang only
- check binary or text-files only
Type | Tool | Fixable | Description |
---|---|---|---|
File | file-cr | ✓ | Scan files and check if they contain CR (Carriage Return only). |
File | file-crlf | ✓ | Scan files and check if they contain CRLF (Windows Line Feeds). |
File | file-empty | Scan files and check if they are empty (0 bytes). | |
File | file-nullbyte | ✓ | Scan files and check if they contain a null-byte character (\x00) . |
File | file-trailing-newline | ✓ | Scan files and check if they contain a trailing newline. |
File | file-trailing-single-newline | ✓ | Scan files and check if they contain exactly one trailing newline. |
File | file-trailing-space | ✓ | Scan files and check if they contain trailing whitespaces. |
File | file-utf8 | ✓ | Scan files and check if they have a non UTF-8 encoding. |
File | file-utf8-bom | ✓ | Scan files and check if they contain BOM (Byte Order Mark): U+FEFF . |
Git | git-conflicts | Scan files and check if they contain git conflicts. |
Tools extracted from https://github.com/cytopia/awesome-ci
Docker tag | Build from |
---|---|
latest |
Current stable file-lint version |
<tag> |
Git tag from this repository |
The working directory inside the Docker container is /data/
and should be mounted locally.
$ docker run --rm -v $(pwd):/data cytopia/file-lint
################################################################################
# cytopia/file-lint #
# (awesome-ci) #
################################################################################
# #
# #
# Usage: #
# -----------------------------------------------------------------------------#
# docker run --rm cytopia/file-lint --help #
# docker run --rm cytopia/file-lint <tool> --help #
# docker run --rm cytopia/file-lint <tool> --info #
# docker run --rm cytopia/file-lint <tool> --version #
# #
# #
# Available tools: #
# -----------------------------------------------------------------------------#
# file-empty Scans if files are empty #
# file-cr Scans if files contain carriage returns (\r) #
# file-crlf Scans if files contain win line feeds (\r\n) #
# file-nullbyte Scans if files contain nullbyte chars (\x00) #
# file-trailing-newline Scans if files contain trailing newline(s) #
# file-trailing-single-newline Scans if files contain single trailing newline #
# 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: #
# -----------------------------------------------------------------------------#
# docker run --rm -v $(pwd):/data cytopia/file-lint \ #
# lf-crlf --ignore ".git/,.github/" --path . #
# #
################################################################################
The following help screen is taken from file-crlf
. All other tools have the exact same functionality.
$ docker run --rm cytopia/file-lint file-crlf --help
Usage: file-crlf [--text] [--size] [--shebang <ARG>] [--extension "tpl,htm,html,php,..."] [--ignore "dir1,dir2"] [--config "conf"] [--confpre "FILE_CRLF_"] [--fix] [--verbose] [--debug] [--dry] [--list] --path <DIR>
file-crlf --info
file-crlf --help
file-crlf --version
Scans recursively for files containing CRLF (Windows Line Feeds).
Will return 1 on occurance, otherwise 0.
Required arguments:
--path <ARG> Specify directory where to scan.
Optional run arguments:
--fix Fixable :-)
Fix the problems for the specified files.
Note, all other options below also apply
--text Limit search to text files only (non-binary).
Can be narrowed further with '--extension'
--size Limit search to files which are not empty (bigger than 0 bytes).
--shebang <ARG> Only find files (shell scripts) with this specific shebang.
It is useful to combine this with --text and --size for faster searches.
Use with --dry to see how this search command is generated.
Example:
--shebang bash
--shebang php
--shebang sh
--extension <ARG> Only find files matching those extensions.
Comma separated list of file extensions.
Only find files matching those extensions.
Defaults to all files if not specified or empty.
Example:
--extension "html,php,inc"
--extension php
--ignore <ARG> Comma separated list of ignore paths.
Directories must be specified from the starting location of --path.
Example:
ignore 'foor/bar' folder inside '/var/www' path:
--path /var/www --ignore foo/bar
--config <ARG> Load configuration file.
File must contain the following directives:
FILE_CRLF_EXTENSION="" # comma separated
FILE_CRLF_IGNORE="" # comma separated
FILE_CRLF_TEXT=0|1 # 0 or 1
Note that cmd arguments take precedence over
config file settings.
--confpre <ARG> Set custom configuration directive prefix.
Current default ist: 'FILE_CRLF_'.
This is useful, when you want to define different defaults
per check via configuration file.
--verbose Be verbose and print commands and files being checked.
--debug Print system messages.
Optional training arguments:
--dry Don't do anything, just display the commands.
--list Instead of searching inside the files, just display the filenames
that would be found by --path, --extension and --ignore
System arguments:
--info Show versions of required commands (useful for bugreports).
--help Show help screen.
--version Show version information.
file-crlf is part of the awesome-ci collection.
https://github.com/cytopia/awesome-ci
You can also add a configuration file named awesome-ci.conf
to your project to configure it to your likings.
#
# Awesome-ci configuration file
#
# Each tool will have its own config section
# which all behave in the same way:
#
#
# 1. File extensions
# ------------------
# Comma separated list of file extensions
# to narrow down the files to check.
# <TOOL_NAME>_EXTENSION=""
# <TOOL_NAME>_EXTENSION="tpl,html"
#
# 2. Ignored paths
# ----------------
# Comma separated list of file paths
# to narrow down the files to check.
# Note that those paths must start at the
# path where --path starts.
# <TOOL_NAME>_IGNORE=""
# <TOOL_NAME>_IGNORE="tmp/log,tmp/run"
#
# 3. Text files
# -------------
# 0 or 1 to specify whether to work on text files
# only.
# <TOOL_NAME>_TEXT=0
# <TOOL_NAME>_TEXT=1
#
# File checkers
#
# file-cr
FILE_CR_EXTENSION=""
FILE_CR_IGNORE=".git,*.svn"
FILE_CR_TEXT=1
FILE_CR_SIZE=1
# file-crlf
FILE_CRLF_EXTENSION=""
FILE_CRLF_IGNORE=".git,*.svn"
FILE_CRLF_TEXT=1
FILE_CRLF_SIZE=1
# file-empty
FILE_EMPTY_EXTENSION=""
FILE_EMPTY_IGNORE=".git,*.svn"
FILE_EMPTY_TEXT=0
FILE_EMPTY_SIZE=0
# file-nullbyte
FILE_NULLBYTE_EXTENSION=""
FILE_NULLBYTE_IGNORE=".git,*.svn,*.pyc"
FILE_NULLBYTE_TEXT=1
FILE_NULLBYTE_SIZE=1
# file-trailing-newline
FILE_TRAILING_NEWLINE_EXTENSION=""
FILE_TRAILING_NEWLINE_IGNORE=".git,*.svn"
FILE_TRAILING_NEWLINE_TEXT=1
FILE_TRAILING_NEWLINE_SIZE=1
# file-trailing-single-newline
FILE_TRAILING_SINGLE_NEWLINE_EXTENSION=""
FILE_TRAILING_SINGLE_NEWLINE_IGNORE=".git,*.svn"
FILE_TRAILING_SINGLE_NEWLINE_TEXT=1
FILE_TRAILING_SINGLE_NEWLINE_SIZE=1
# file-trailing-space
FILE_TRAILING_SPACE_EXTENSION=""
FILE_TRAILING_SPACE_IGNORE=".git,*.svn"
FILE_TRAILING_SPACE_TEXT=1
FILE_TRAILING_SPACE_SIZE=1
# file-utf8
FILE_UTF8_EXTENSION=""
FILE_UTF8_IGNORE=".git,*.svn"
FILE_UTF8_TEXT=1
FILE_UTF8_SIZE=1
# file-utf8-bom
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
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 _lint-git-conflicts
FL_VERSION = latest
FL_IGNORE_PATHS = .git/,.github/
lint:
@$(MAKE) --no-print-directory _lint-cr
@$(MAKE) --no-print-directory _lint-crlf
@$(MAKE) --no-print-directory _lint-trailing-single-newline
@$(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 $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-cr --text --ignore '$(FL_IGNORE_PATHS)' --path .
_lint-crlf:
@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 $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-trailing-single-newline --text --ignore '$(FL_IGNORE_PATHS)' --path .
_lint-trailing-space:
@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 $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-utf8 --text --ignore '$(FL_IGNORE_PATHS)' --path .
_lint-utf8-bom:
@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 .
Related #awesome-ci projects
Save yourself from installing lot's of dependencies and pick a dockerized version of your favourite linter below for reproducible local or remote CI tests:
GitHub | DockerHub | Type | Description |
---|---|---|---|
awesome-ci | Basic | Tools for git, file and static source code analysis | |
file-lint | Basic | Baisc source code analysis | |
linkcheck | Basic | Search for URLs in files and validate their HTTP status code | |
ansible | Ansible | Multiple versions and flavours of Ansible | |
ansible-lint | Ansible | Lint Ansible | |
gofmt | Go | Format Go source code [1] | |
goimports | Go | Format Go source code [1] | |
golint | Go | Lint Go code | |
eslint | Javascript | Lint Javascript code | |
jsonlint | JSON | Lint JSON files [1] | |
checkmake | Make | Lint Makefiles | |
phpcbf | PHP | PHP Code Beautifier and Fixer | |
phpcs | PHP | PHP Code Sniffer | |
phplint | PHP | PHP Code Linter [1] | |
php-cs-fixer | PHP | PHP Coding Standards Fixer | |
black | Python | The uncompromising Python code formatter | |
mypy | Python | Static source code analysis | |
pycodestyle | Python | Python style guide checker | |
pydocstyle | Python | Python docstyle checker | |
pylint | Python | Python source code, bug and quality checker | |
terraform-docs | Terraform | Terraform doc generator (TF 0.12 ready) [1] | |
terragrunt | Terraform | Terragrunt and Terraform | |
terragrunt-fmt | Terraform | terraform fmt for Terragrunt files [1] |
|
yamlfmt | Yaml | Format Yaml files [1] | |
yamllint | Yaml | Lint Yaml files |
[1] Uses a shell wrapper to add enhanced functionality not available by original project.
Visit cytopia/makefiles for dependency-less, seamless project integration and minimum required best-practice code linting for CI. The provided Makefiles will only require GNU Make and Docker itself removing the need to install anything else.
Copyright (c) 2019 cytopia