Skip to content

Commit

Permalink
lint: Update to super-linter/super-linter
Browse files Browse the repository at this point in the history
The linter has been blue badged.
  • Loading branch information
pataxis committed Nov 28, 2023
1 parent eef4ecf commit 26fa949
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0
- run: cat .github/super-linter.env >> "$GITHUB_ENV"
- name: Lint Code Base
uses: github/super-linter/slim@v5
uses: super-linter/super-linter/slim@v5
env:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 14 additions & 30 deletions LINT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ get a pull request approved.

When you create a pull request, a set of linters will run syntax and format
checks on different file types in GitHub actions by making use of a tool called
[super-linter](https://github.com/github/super-linter). If any of the linters
gives an error, this will be shown in the action connected to the pull request.
[super-linter](https://github.com/super-linter/super-linter). If any of the
linters gives an error, this will be shown in the action connected to the pull
request.

In order to fasten up development, it's possible to run linters as part of your
local development environment.
Expand All @@ -18,7 +19,7 @@ local development environment.
Since super-linter is using a Docker image in GitHub Actions, users of other
editors may run it locally to lint the codebase. For complete instructions and
guidance, see super-linter page for [running
locally](https://github.com/github/super-linter/blob/main/docs/run-linter-locally.md).
locally](https://github.com/super-linter/super-linter/blob/main/docs/run-linter-locally.md).

### VS Code

Expand All @@ -36,22 +37,26 @@ docker run --rm \
-v $PWD:/tmp/lint \
-e RUN_LOCAL=true \
--env-file ".github/super-linter.env" \
ghcr.io/github/super-linter:slim-v5
ghcr.io/super-linter/super-linter:slim-v5
```

For more details which linters that run and the settings, see the file
`.github/super-linter.env`.

To only test one specific linter, e.g. lint Markdown, see the variable name in
`.github/super-linter.env` that in this case is `VALIDATE_MARKDOWN=true`. Then
run the single linter with this command:
`.github/super-linter.env` that in this case is `VALIDATE_MARKDOWN=true`. Note
that you also need to specify the linter configuration file if there is one.
In this case `MARKDOWN_CONFIG_FILE=.markdownlint` together with the location
via `LINTER_RULES_PATH=/`. Then run the single linter with this command:

```sh
docker run --rm \
-v $PWD:/tmp/lint \
-e LINTER_RULES_PATH=/ \
-e RUN_LOCAL=true \
-e VALIDATE_MARKDOWN=true \
ghcr.io/github/super-linter:slim-v5
-e MARKDOWN_CONFIG_FILE=.markdownlint.yml \
ghcr.io/super-linter/super-linter:slim-v5
```

## Run super-linter interactively
Expand All @@ -66,7 +71,7 @@ docker run --rm \
-v $PWD:/tmp/lint \
-w /tmp/lint \
--entrypoint /bin/bash \
-it github/super-linter:slim-v5
-it ghcr.io/super-linter/super-linter:slim-v5
```

Then from the container terminal, the following commands can lint the codebase
Expand Down Expand Up @@ -134,7 +139,7 @@ docker run --rm \
-v $PWD:/tmp/lint \
-w /tmp/lint \
--entrypoint /bin/bash \
-it github/super-linter:slim-v5
-it ghcr.io/super-linter/super-linter:slim-v5

# Auto-format C and C++ files (second line change all)
clang-format -i <path/to/file>
Expand All @@ -143,24 +148,3 @@ clang-format -i $(find . -regex '.*\.\(c\|cpp\|h\|cc\|C\|CPP\|c++\|cp\)$')
# Fix Markdown file errors
markdownlint -f <path/to/file>
```

## Troubleshooting

### fatal: not a git repository

You may see output like this repeated in many lines.

```sh
fatal: not a git repository (or any of the parent directories): .git
```

A [fix](https://github.com/super-linter/super-linter/pull/4348) has been merged
and released in **super-linter/super-linter** `v5.2.1` but this repo use
**github/super-linter** which hasn't got this release.

The error message can be ignored. A workaround is to add this option to the
Docker command:

```sh
-w /tmp/lint
```

0 comments on commit 26fa949

Please sign in to comment.