Certain linters and formatters support fixing linting and formatting
issues (fix mode). Before this change, Super-linter runs linters and
formatters in a mode that doesn't modify the source code in any way
(check only mode).
With this change, Super-linter supports running linters and formatters
in fix mode if explicitly requested by the configuration. If the
configuration includes a variable named FIX_<language_name>,
Super-linters modifies the command to run the linter or formatter for
<language_name> to enable fix mode.
The modifications to the linter or formatter command that Super-linter
applies depend on what is the default for a particular linter: it either
removes or adds options to the command to run the linter or formatter.
Remove clippy.sh script and run cargo-clippy directly. The script was
needed because when we introduced cargo-clippy, Super-linter didn't have
a way to customize the working directory when running linters and
formatters. Now, we can use GNU Parallel to handle that case.
This will unblock the work to do to implement #4001 (pass custom options
to cargo-clippy).
- New SAVE_SUPER_LINTER_OUTPUT variable. When set to true,
saves super-linter output to ${DEFAULT_WORKSPACE}/${SUPER_LINTER_OUTPUT_DIRECTORY_NAME}
- New SUPER_LINTER_OUTPUT_DIRECTORY_NAME variable to set the output
directory name instide the default workspace.
Close#5774
In case of linting errors, print stdout and stderr (if present)
at the ERROR level if users set LOG_LEVEL to NOTICE to avoid
failures without any explanation.
- Check if Stdout and Stderr have elements before printing them.
- Run the super-linter action in a dedicated step using default logging to
inspect how the output looks during CI.
- Remove the SKIP_FLAG variable and check for the length of the arrays
of files to lint directly.
- Remove the LIST_FILES variable, and use the FILE_ARRAY variable
directly.
- Remove the corner case for RENOVATE because renovate-config-validator
supports passing the path to the file to lint using an argument as the
default case does.
- Remove the corner case for ANSIBLE not having 'bad' tests because it
has them now.
- Set TF_DATA_DIR to avoid any modification to any existing Terraform
data directory that users might have in their workspace.
- Aggregate GO_MODULES and ANSIBLE corner cases because they are the
same.
- Remove the corner case for ANSIBLE to add a trailing slash to
TEST_CASE_FOLDER (similar reason as the previous point about ANSIBLE
corner case).
- Simplify log messages by removing color markers because they are
already handled in log.sh.
- Simplify linterVersions by removing redundant checks and functions.
- Avoid printing debug logs in the versions file.
- Validate variables representing boolean values.
- Group global variables in the same sections.
- Declare variables as lowercase with the 'declare -l' shell builtin for
more clarity.
Deprecate the ERROR_ON_MISSING_EXEC_BIT variable to remove a confusing
corner case, and to align the BASH_EXEC check to how super-linter
handles other linters.
- Simplify file status checks to assume that a file should be linted
correctly unless we are running in test mode.
- Avoid the corner case of files having the 'bad' string as part of
their file name to be wrongly assumed to fail linting.
- Move FILE_STATUS initialization where it's needed, after running the
linters.
- Run jscpd, gitleaks, textlint against the entire workspace instead of
running them over single files, one by one.
- Implement a warning function for deprecated variables.
- Deprecate the VALIDATE_JSCPD_ALL_CODEBASE variable.
- Remove duplicate configuration files when they are the same as the
ones we provide in TEMPLATES.
- Add a missing tests for ansible-lint.
- Move ANSIBLE_DIRECTORY configuration when running tests in
buildFileList, where similar configs are.
- Simplify ansible-lint test cases to include only what's necessary, and
not an entire set of roles, playbooks, and inventory.
- Write instructions about major upgrades in the upgrade guide.
* Lint Go projects by directory
* Search for Go modules
* Fix test path
* Add test cases and fix command
* Change workdir
* Add a warning about false positives
* fatal instead of warn
* Move tests to the test directory
* Close group on fatal
* Don't fail in test mode
* faster linter for cfn-lint and eslint
* workaround shfmt error
* fix xargs interleave large outputs
* parallel gitleaks
* fix exec bit, shfmt, bash linter
* show parallel --citation
* refactor a common interface using named pipe
* add readme for the experimental impl
* fix readme format
* minimize change in worker.sh
* will cite, showed once
* remove junk comment
* explicitly set EXPERIMENTAL_BATCH_WORKER=false
* fix: errors from github/super-linter:v5
* fix: support tflint relative module references
* chore: add test for relative module imports
* chore: add terraform binary
* chore: move tests
* chore: add newlines to tests
* chore: add newlines to tests
* refactor: move terraform get
* refactor: put terraform get back where it was
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
* fix(R linting): try installing the R package before linting R language
* the tool used to lint the R language gives false positives for files inside an R library, which is not installed
* this change tries to naively install the package in the linted directory
Resolves#1910
* fix code
* fixed it
* fixed it
Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
* only error on lintr errors
* ensure that dockerfile includes purrr
* update tap snapshot
* add actual lint error
* add snapshot for actual error
Co-authored-by: Gabriel Diaz <gabo.fdc@gmail.com>
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
* Move FILTER_REGEX_INCLUDE AND FILTER_REGEX_EXCLUDE before checking filetype
* missing continue, and a lint error
Co-authored-by: Marco Ferrari <ferrari.marco@gmail.com>
When lint fails, print command output on a newline surrounded by "------"
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
Co-authored-by: Gabriel Diaz <gabo.fdc@gmail.com>
* Improved ANSIBLE_DIRECTORY validation to support the repository root
Fixes#1110, which prevents linting playbooks at the root of the repository from being supported.
* Trim whitespace
* Remove undesired extra validation condition
Addressing review feedback from @ ferrarimarco
* Avoid mutating ANSIBLE_DIRECTORY beyond the extent that was already in place
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
* Change log level from warn to debug
* Move 'Linting x file' to be printed only if files are found
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>