Add a template config file for ShellCheck (#1900)

* Improve wording of LINTER_RULES_PATH docs (#1634).

* Add a template config file for ShellCheck (#1633).

Instruct ShellCheck to search SCRIPTDIR, the directory that the script
being linted is in, for other scripts that are sourced. Otherwise, the
commonly-used source command results in linter error SC1091. See
https://github.com/koalaman/shellcheck/wiki/SC1091 for more details.

* fix line ending

Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
This commit is contained in:
Kurt von Laven 2021-08-30 09:19:56 -07:00 committed by GitHub
parent 9896c4b654
commit 8227f79074
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 6 deletions

View file

@ -388,12 +388,12 @@ But if you wish to select or exclude specific linters, we give you full control
You can use the **GitHub** **Super-Linter** _with_ or _without_ your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level.
- Copy **any** or **all** template rules files from `TEMPLATES/` into your repository in the location: `.github/linters/` of your repository
- If your repository does not have rules files, they will fall back to defaults in [this repository's `TEMPLATE` folder](https://github.com/github/super-linter/tree/master/TEMPLATES)
- Copy **any** or **all** template rules files from `TEMPLATES/` into the `.github/linters/` directory of your repository, and modify them to suit your needs.
- The rules files in [this repository's `TEMPLATE` folder](https://github.com/github/super-linter/tree/master/TEMPLATES) will be used as defaults should any be omitted.
### Using your own rules files
If your repository contains your own rules files that live outside of a ``.github/linters/`` directory, you will have to tell Super-Linter where your rules files are located in your repository, and what their file names are. To learn more, see [Using your own rules files](docs/using-rules-files.md).
If your repository contains your own rules files that live outside of a `.github/linters/` directory, you will have to tell Super-Linter where your rules files are located in your repository, and what their filenames are. To learn more, see [Using your own rules files](docs/using-rules-files.md).
### Disabling rules

1
TEMPLATES/.shellcheckrc Normal file
View file

@ -0,0 +1 @@
source-path=SCRIPTDIR

View file

@ -1,6 +1,6 @@
# TEMPLATES
The files in this folder are template rules for the linters that will run against your code base. If you chose to copy these to your local repository in the directory: `.github/linters` they will be used at runtime. If they are not present, they will be used by default in the linter run.
The files in this folder are template rules for the linters that will run against your code base. If you choose to copy these to your local repository in the `.github/linters/` directory, they will be used at runtime. If rule files are not present locally, the templates will be used by default.
The file(s) will be parsed at run time on the local branch to load all rules needed to run the **Super-Linter** **GitHub** Action.
The **GitHub** Action will inform the user via the **Checks API** on the status and success of the process.

View file

@ -2,7 +2,7 @@
Linters can often require additional configuration to ensure they work with your codebase and your team's coding style, to avoid flagging false-positives. The **GitHub Super-Linter** has set up some default configurations for each linter which should work reasonably well with common code bases, but many of the linters can be configured to disable certain rules or configure the rules to ignore certain pieces of codes.
To run with your own configuration for a linter, copy the relevant [`TEMPLATE` configuration file for the linter you are using from this repo](https://github.com/github/super-linter/tree/master/TEMPLATES) into the `.github/linters` folder in your own repository, and then edit it to modify, disable - or even add - rules and configuration to suit how you want your code checked.
To run with your own configuration for a linter, copy the relevant [`TEMPLATE` configuration file for the linter you are using from this repo](https://github.com/github/super-linter/tree/master/TEMPLATES) into the `.github/linters/` folder in your own repository, and then edit it to modify, disable - or even add - rules and configuration to suit how you want your code checked.
How the changes are made differ for each linter, and also how much the **Github Super-Linter** has decided to change the linter's defaults. So, for some linters (e.g. [pylint for python](https://github.com/github/super-linter/blob/master/TEMPLATES/.python-lint)), there may be a large configuration file. For others (e.g. [stylelint for CSS](https://github.com/github/super-linter/blob/master/TEMPLATES/.stylelintrc.json)) the default configuration file may initially be nearly empty. And for some (e.g. StandardJS) it may not be possible to change configuration at all so there is no Template file.

View file

@ -66,7 +66,7 @@ source /action/lib/functions/worker.sh # Source the function script(s)
###########
# Default Vars
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter rules directory
GITHUB_API_URL="${GITHUB_CUSTOM_API_URL:-"https://api.github.com"}" # GitHub API root url
VERSION_FILE='/action/lib/functions/linterVersions.txt' # File to store linter versions
export VERSION_FILE # Workaround SC2034