Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 1.76 KB

LINT.md

File metadata and controls

63 lines (47 loc) · 1.76 KB

Lint of code base

This repo uses the super-linter to check the code base syntax and format on different file types.

Linters in GitHub Action

When you create a pull request, super-linter will automatically be run as a GitHub Action. If any of the linters give an error, this will be shown in the action connected to the pull request.

Run super-linter locally

Before you create a pull request, you are encouraged to run the super-linter locally which is possible since it is available as a container. Using Docker, a local run would be invoked by:

docker run --rm \
  -v "$PWD":/tmp/lint \
  -e RUN_LOCAL=true \
  --env-file .github/super-linter.env \
  ghcr.io/super-linter/super-linter:slim-v7

Run super-linter interactively

Sometimes it is more convenient to run super-linter interactively. To do so with Docker:

docker run -it --rm \
  -v "$PWD":/tmp/lint \
  -w /tmp/lint \
  --env-file .github/super-linter.env \
  --entrypoint /bin/bash \
  ghcr.io/super-linter/super-linter:slim-v7

Then from the container terminal, the following commands can lint the the code base for different file types:

# Lint C++ code (format)
find "$PWD" \( -iname \*.cpp -or -iname \*.hpp \) -exec clang-format --dry-run --Werror --verbose {} +

# Lint Dockerfile files
hadolint $(find -type f -name Dockerfile\*)

# Lint Dockerfile files (alternative command)
find -type f -name Dockerfile\* -exec hadolint {} +

# Lint JSON files
eslint --no-eslintrc -c /action/lib/.automation/.eslintrc.yml --ext .json .

# Lint Markdown files
markdownlint .

# Lint YAML files
yamllint .