This repository is for the GitHub Action to run a Super-Linter.
It is a simple combination of various linters, written in bash, to help validate your source code.
The end goal of this tool:
master)The super-linter finds issues and reports them to the console output. Fixes are suggested in the console output but not automatically fixed, and a status check will show up as failed on the pull request.
The design of the Super-Linter is currently to allow linting to occur in GitHub Actions as a part of continuous integration occurring on pull requests as the commits get pushed. It works best when commits are being pushed early and often to a branch with an open or draft pull request. There is some desire to move this closer to local development for faster feedback on linting errors but this is not yet supported.
Developers on GitHub can call the GitHub Action to lint their code base with the following list of linters:
| Language | Linter |
|---|---|
| Ansible | ansible-lint |
| Azure Resource Manager (ARM) | arm-ttk |
| AWS CloudFormation templates | cfn-lint |
| CSS | stylelint |
| Clojure | clj-kondo |
| CoffeeScript | coffeelint |
| Dart | dartanalyzer |
| Dockerfile | dockerfilelint hadolint |
| EDITORCONFIG | editorconfig-checker |
| ENV | dotenv-linter |
| Golang | golangci-lint |
| Groovy | npm-groovy-lint |
| HTMLHint | HTMLHint |
| Java | checkstyle |
| JavaScript | eslint standard js |
| JSON | jsonlint |
| Kotlin | ktlint |
| Lua | luacheck |
| Markdown | markdownlint |
| OpenAPI | spectral |
| Perl | perlcritic |
| PHP | PHP built-in linter PHP CodeSniffer PHPStan Psalm |
| PowerShell | PSScriptAnalyzer |
| Protocol Buffers | protolint |
| Python3 | pylint flake8 |
| R | lintr |
| Raku | raku |
| Ruby | RuboCop |
| Shell | Shellcheck |
| SQL | sql-lint |
| Terraform | tflint terrascan |
| TypeScript | eslint standard js |
| XML | LibXML |
| YAML | YamlLint |
More in-depth tutorial available
To use this GitHub Action you will need to complete the following:
.github/workflows/linter.ymlNOTE: If you pass the Environment variable GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} in your workflow, then the GitHub Super-Linter will mark the status of each individual linter run in the Checks section of a pull request. Without this you will only see the overall status of the full run. There is no need to set the GitHub Secret as it is automatically set by GitHub, it only needs to be passed to the action.
In your repository you should have a .github/workflows folder with GitHub Action similar to below:
.github/workflows/linter.ymlThis file should have the following code:
---
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base
#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
#############################
# Start the job on all push #
#############################
on:
push:
branches-ignore: [master]
# Remove the line above to run when pushing to master
pull_request:
branches: [master]
###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest
##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: docker://github/super-linter:v3
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTE:
Using the line:uses: docker://github/super-linter:v3 will pull the image down from DockerHub and run the GitHub Super-Linter. Using the line: uses: github/super-linter@v3 will build and compile the GitHub Super-Linter at build time. This can be far more costly in time...
The super-linter allows you to pass the following ENV variables to be able to trigger different functionality.
Note: All the VALIDATE_[LANGUAGE] variables behave in a very specific way:
VALIDATE_[LANGUAGE] variables set to both true and false. It will fail.This means that if you run the linter "out of the box", all languages will be checked. But if you wish to select or exclude specific linters, we give you full control to choose which linters are run, and won't run anything unexpected.
| ENV VAR | Default Value | Notes |
|---|---|---|
| ACTIONS_RUNNER_DEBUG | false | Flag to enable additional information about the linter, versions, and additional output. |
| ANSIBLE_DIRECTORY | /ansible | Flag to set the root directory for Ansible file location(s). |
| DEFAULT_BRANCH | master | The name of the repository default branch. |
| DEFAULT_WORKSPACE | /tmp/lint | The location containing files to lint if you are running locally. |
| DISABLE_ERRORS | false | Flag to have the linter complete with exit code 0 even if errors were detected. |
| JAVASCRIPT_ES_CONFIG_FILE | .eslintrc.yml | Filename for eslint configuration (ex: .eslintrc.yml, .eslintrc.json) |
| LINTER_RULES_PATH | .github/linters | Directory for all linter configuration rules. |
| LOG_FILE | super-linter.log | The file name for outputting logs. All output is sent to the log file regardless of LOG_LEVEL. |
| LOG_LEVEL | VERBOSE | How much output the script will generate to the console. One of VERBOSE, DEBUG or TRACE. |
| MULTI_STATUS | true | A status API is made for each language that is linted to make visual parsing easier. |
| MARKDOWN_CONFIG_FILE | .markdown-lint.yml | Filename for Markdownlint configuration (ex: .markdown-lint.yml, .markdownlint.json, .markdownlint.yaml) |
| OUTPUT_FORMAT | none | The report format to be generated, besides the stdout one. Output format of tap is currently using v13 of the specification. Supported formats: tap |
| OUTPUT_FOLDER | super-linter.report | The location where the output reporting will be generated to. Output folder must not previously exist. |
| OUTPUT_DETAILS | simpler | What level of details to be reported. Supported formats: simpler or detailed. |
| PYTHON_PYLINT_CONFIG_FILE | .python-lint | Filename for pylint configuration (ex: .python-lint, .pylintrc) |
| PYTHON_FLAKE8_CONFIG_FILE | .flake8 | Filename for flake8 configuration (ex: .flake8, tox.ini) |
| RUBY_CONFIG_FILE | .ruby-lint.yml | Filename for rubocop configuration (ex: .ruby-lint.yml, .rubocop.yml) |
| TYPESCRIPT_ES_CONFIG_FILE | .eslintrc.yml | Filename for eslint configuration (ex: .eslintrc.yml, .eslintrc.json) |
| VALIDATE_ALL_CODEBASE | true | Will parse the entire repository and find all files to validate across all types. NOTE: When set to false, only new or edited files will be parsed for validation. |
| VALIDATE_ANSIBLE | true | Flag to enable or disable the linting process of the Ansible language. |
| VALIDATE_ARM | true | Flag to enable or disable the linting process of the ARM language. |
| VALIDATE_BASH | true | Flag to enable or disable the linting process of the Bash language. |
| VALIDATE_CLOJURE | true | Flag to enable or disable the linting process of the Clojure language. |
| VALIDATE_CLOUDFORMATION | true | Flag to enable or disable the linting process of the AWS Cloud Formation language. |
| VALIDATE_COFFEE | true | Flag to enable or disable the linting process of the Coffeescript language . |
| VALIDATE_CSS | true | Flag to enable or disable the linting process of the CSS language. |
| VALIDATE_DART | true | Flag to enable or disable the linting process of the Dart language. |
| VALIDATE_DOCKER | true | Flag to enable or disable the linting process of the Docker language. |
| VALIDATE_DOCKER_HADOLINT | true | Flag to enable or disable the linting process of the Docker language. |
| VALIDATE_EDITORCONFIG | true | Flag to enable or disable the linting process with the editorconfig. |
| VALIDATE_ENV | true | Flag to enable or disable the linting process of the ENV language. |
| VALIDATE_GO | true | Flag to enable or disable the linting process of the Golang language. |
| VALIDATE_GROOVY | true | Flag to enable or disable the linting process of the language. |
| VALIDATE_HTML | true | Flag to enable or disable the linting process of the HTML language. |
| VALIDATE_JAVA | true | Flag to enable or disable the linting process of the language. |
| VALIDATE_JAVASCRIPT_ES | true | Flag to enable or disable the linting process of the Javascript language. (Utilizing: eslint) |
| VALIDATE_JAVASCRIPT_STANDARD | true | Flag to enable or disable the linting process of the Javascript language. (Utilizing: standard) |
| VALIDATE_JSON | true | Flag to enable or disable the linting process of the JSON language. |
| VALIDATE_JSX | true | Flag to enable or disable the linting process for jsx files (Utilizing: eslint) |
| VALIDATE_KOTLIN | true | Flag to enable or disable the linting process of the Kotlin language. |
| VALIDATE_LUA | true | Flag to enable or disable the linting process of the language. |
| VALIDATE_MD | true | Flag to enable or disable the linting process of the Markdown language. |
| VALIDATE_OPENAPI | true | Flag to enable or disable the linting process of the OpenAPI language. |
| VALIDATE_PERL | true | Flag to enable or disable the linting process of the Perl language. |
| VALIDATE_PHP | true | Flag to enable or disable the linting process of the PHP language. (Utilizing: PHP built-in linter) (keep for backward compatibility) |
| VALIDATE_PHP_BUILTIN | true | Flag to enable or disable the linting process of the PHP language. (Utilizing: PHP built-in linter) |
| VALIDATE_PHP_PHPCS | true | Flag to enable or disable the linting process of the PHP language. (Utilizing: PHP CodeSniffer) |
Content type
Image
Digest
Size
1 GB
Last updated
about 6 years ago
docker pull assignuser/super-linter