Skip to content

lint

A set of tasks to lint different types of files.

List of tasks

Tasks Description
lint:all Linter for files, markdown, yaml extensions. Arguments: [FIX|F=y|Y] [MEX|M=\"#node_modules\"] (*)
lint:docker Linter for Dockerfiles with hadolint. Arguments: [FILE|F=Dockerfile] [IMG|I=hadolint/hadolint] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] (*)
lint:file Linter for files. Arguments: [FIX|F=y|Y] (*)
lint:lychee Find broken hyperlinks with lychee. Arguments: [ARGS|A='.'] [IMG|I=lycheeverse/lychee] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] (*)
lint:markdown Linter for Mardown files. Arguments: [GLOB|G='"/.md"'] [IMG|I=tmknom/markdownlint] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] ()
lint:pre-commit Lint with pre-commit framework. Arguments: [IMG|I=jfxs/pre-commit] [PULL|P=n|N] [DIR|D=.] [DOCKER_OPTS|DO=-u 1000:0] (*)
lint:shell Linter for bash/sh shell files. Arguments: FILES|F="myscripts/.sh" [IMG|I=koalaman/shellcheck:stable] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] ()
lint:vale Linter for grammar, style, and word usage English language. Arguments: [FILES|F=".md"] [STYLES|S="styles"] [IMG|I=jdkato/vale] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] ()
lint:yaml Linter for YAML files. Arguments: [FILES|F="."] [IMG|I=jfxs/ansible] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] (*)

global variables

Variables Description Default value
IMAGE_HADOLINT Default image for lint:docker task hadolint/hadolint
IMAGE_LYCHEE Default image for lint:lychee task lycheeverse/lychee:master
IMAGE_MARKDOWNLINT Default image for lint:markdown task davidanson/markdownlint-cli2
IMAGE_PRECOMMIT Default image for lint:pre-commit task jfxs/pre-commit
IMAGE_SHELLCHECK Default image for lint:shellcheck task koalaman/shellcheck:stable
IMAGE_VALE Default image for lint:vale task jdkato/vale
IMAGE_YAMLINT Default image for lint:yaml task jfxs/ansible

lint:all

Linter for files, markdown, yaml extensions. Arguments: [FIX|F=y|Y] [MEX|M=\"#node_modules\"] (*)

[LINT] Linter for files.
Usage: task lint:all [FIX|F=<y|Y>] [MEX|M='"#node_modules"']
Arguments Description
FIX | F Fix files (optional, by default no)
MEX | M Makdown exlude directories with single quotes example: MEX='"#node_modules" "#.node_cache"' (see: https://github.com/DavidAnson/markdownlint-cli2)

Notes:
- Only git versionned files are checked for generic files. Use MEX argument for Markdown files and .yamlint for YAML files to exclude.
- Check git tracked files.
- otherwise (empty git list), all files not in a directory starting by dot

Requirements:

  • markdownlint-cli2 or docker
  • yamllint or docker

lint:docker

Linter for Dockerfiles with hadolint. Arguments: [FILE|F=Dockerfile] [IMG|I=hadolint/hadolint] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] (*)

[LINT] Linter for Dockerfiles with hadolint.
Usage: task lint:docker [FILE|F=Dockerfile] [IMG|I=hadolint/hadolint] [PULL|P=<n|N>] [DOCKER_OPTS|DO=<docker_options>]
Arguments Description
FILE | F Path of the Docker file to lint (optional, by default Dockerfile)
IMG | I Docker lint image to use (optional, by default {{.IMAGE_HADOLINT}})
PULL | P Pull docker image (optional, by default yes)
DOCKER_OPTS | DO Docker options (optional)

Requirements:

  • hadolint or docker

lint:file

Linter for files. Arguments: [FIX|F=y|Y] (*)

[LINT] Linter for files.
Usage: task lint:file [FIX|F=<y|Y>]
Arguments Description
FIX | F Fix files (optional, by default no)

Notes:
- Check git tracked files,
- otherwise (empty git list), all files not in a directory starting by dot

Requirements:

  • None

lint:lychee

Find broken hyperlinks with lychee. Arguments: [ARGS|A='.'] [IMG|I=lycheeverse/lychee] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] (*)

[LINT] Find broken hyperlinks.
Usage: task lint:lychee [ARGS|A='.'] [IMG|I=lycheeverse/lychee] [PULL|P=<n|N>] [DOCKER_OPTS|DO=<docker_options>]
Arguments Description
ARGS | A Glob expressions (optional, by default ".")
IMG | I lychee image to use (optional, by default {{.IMAGE_LYCHEE}})
PULL | P Pull docker image (optional, by default yes)
DOCKER_OPTS | DO Docker options (optional)

Notes:
- To exclude directories create a lychee.toml file with the exclude_path = ["dir1", "dir2"] directive
- Documentation: https://github.com/lycheeverse/lychee

Requirements:

  • lychee or docker

lint:markdown

Linter for Mardown files. Arguments: [GLOB|G='"/.md"'] [IMG|I=tmknom/markdownlint] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] ()

[LINT] Linter for Markdown files.
Usage: task lint:markdown [GLOB|G='"**/*.md" "#node_modules"'] [IMG|I=tmknom/markdownlint] [PULL|P=<n|N>] [DOCKER_OPTS|DO=<docker_options>]
Arguments Description
GLOB | G Glob expressions (optional, by default "*/.md")
IMG | I Docker markdownlint image to use (optional, by default {{.IMAGE_MARKDOWNLINT}})
PULL | P Pull docker image (optional, by default yes)
DOCKER_OPTS | DO Docker options (optional)

Notes:
- Documentation of Glob expressions: https://github.com/DavidAnson/markdownlint-cli2

Requirements:

  • markdownlint-cli2 or docker

lint:pre-commit

Lint with pre-commit framework. Arguments: [IMG|I=jfxs/pre-commit] [PULL|P=n|N] [DIR|D=.] [DOCKER_OPTS|DO=-u 1000:0] (*)

[LINT] Lint with pre-commit framework.
Usage: task lint:pre-commit [IMG|I=jfxs/pre-commit] [PULL|P=<n|N>] [DIR|D=<directory>] [DOCKER_OPTS|DO=<docker_options>]
Arguments Description
IMG | I Docker pre-commit image to use (optional, by default {{.IMAGE_PRECOMMIT}})
PULL | P Pull pre-commit image (optional, by default yes)
DIR | D Directory to run pre-commit (optional, by default .)
DOCKER_OPTS | DO Docker options (optional)

Notes:
- Documentation of pre-commit: https://pre-commit.com/

Requirements:

  • pre-commit or docker

lint:shell

Linter for bash/sh shell files. Arguments: FILES|F="myscripts/.sh" [IMG|I=koalaman/shellcheck:stable] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] ()

[LINT] Linter for bash/sh shell files.
If shellcheck command is in the path and IMG/I argument is not set, the local shellcheck command is executed,
otherwise a shellcheck Docker image is used.
Usage: task lint:shell FILES|F="myscripts/*.sh" [IMG|I=<koalaman/shellcheck:stable>] [PULL|P=<n|N>] [DOCKER_OPTS|DO=<docker_options>]
Arguments Description
FILES | F Files to check (required)
IMG | I Docker shellcheck image to use (optional, by default {{.IMAGE_SHELLCHECK}})
PULL | P Pull docker image (optional, by default yes)
DOCKER_OPTS | DO Docker options (optional)

Requirements:

  • shellcheck or docker

lint:vale

Linter for grammar, style, and word usage English language. Arguments: [FILES|F=".md"] [STYLES|S="styles"] [IMG|I=jdkato/vale] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] ()

[LINT] Linter for Linter for a grammar, style, and word usage English language.
If vale command is in the path and IMG/I argument is not set, the local vale command is executed,
otherwise a Vale Docker image is used.
You must create a .vale.ini configuration file and vale sync is automatically run:
https://vale.sh/generator
Usage: task lint:vale [FILES|F=\"*.md\"] [STYLES|S=\"styles\"] [IMG|I=jdkato/vale] [PULL|P=<n|N>] [DOCKER_OPTS|DO=<docker_options>]
Arguments Description
FILES | F Files to check (optional, by default *.md)
STYLES | S Styles directory (optional, by default styles)
IMG | I Docker vale image to use (optional, by default {{.IMAGE_VALE}})
PULL | P Pull docker image (optional, by default yes)
DOCKER_OPTS | DO Docker options (optional)

Requirements:

  • vale or docker

lint:yaml

Linter for YAML files. Arguments: [FILES|F="."] [IMG|I=jfxs/ansible] [PULL|P=n|N] [DOCKER_OPTS|DO=-u 1000:0] (*)

[LINT] Linter for YAML files.
If yamllint command is in the path and IMG/I argument is not set, the local yamllint command is executed,
otherwise a yamllint Docker image is used.
You can configure rules and exclude directories with a .yamlint configuration file:
https://yamllint.readthedocs.io/en/stable/configuration.html
Usage: task lint:yaml [FILES|F=\".\"] [IMG|I=jfxs/ansible] [PULL|P=<n|N>] [DOCKER_OPTS|DO=<docker_options>]
Arguments Description
FILES | F Files to check (optional, by default .)
IMG | I Docker yamllint image to use (optional, by default {{.IMAGE_YAMLINT}})
PULL | P Pull docker image (optional, by default yes)
DOCKER_OPTS | DO Docker options (optional)

Requirements:

  • yamllint or docker