Commit graph

50 commits

Author SHA1 Message Date
Marco Ferrari
48d5391b7b
fix!: remove sql-lint (#5991)
sql-lint is unmaintained, and its dependencies are impacted by several
vulnerabilities.
2024-08-14 17:30:46 +02:00
Marco Ferrari
d9bf945fd2
chore: remove file_array leftovers (#6018)
Remove the initialization of FILE_ARRAY_xxx variables because worker.sh
dynamically initializes them already.
2024-08-14 17:26:55 +02:00
Marco Ferrari
91dc6d7234
fix: add missing fix mode options and test cases (#5987)
- Add missing fix mode options for: CLANG_FORMAT, ENV,
  GOOGLE_JAVA_FORMAT, NATURAL_LANGUAGE, PYTHON_ISORT, RUST_CLIPPY.
- Refactor linter tests to make them shorter because there's no need to
  have big test files.
- Refactor 'bad' linter tests for linters that support fix mode so they
  contain only automatically fixable issues. This is needed to avoid
  adding another set of 'bad' linter tests for fix mode.
- Provide configuration files for linters that support fix mode and for
  which the default configuration is not suitable to enable fix mode:
  ansible-lint, ESLint, golangci-lint.
- Add a test case for linter commands options for linters that support
  fix mode, to ensure that fix mode and check-only mode options have
  been defined.
- Refactor the fix mode test to check if linters actually applied
  modifications to files.
- Update documentation about adding test cases for linters that support
  fix mode.
- Don't exit with a fatal error if VALIDATE_xxx is false when testing
  fix mode because not all linters support fix mode. To enable this, set
  the new FIX_MODE_TEST_CASE_RUN variable to true.
2024-08-12 12:31:38 +02:00
Marco Ferrari
6fdc091361
feat: local fix mode (#5978)
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.
2024-08-07 15:36:16 +02:00
Marco Ferrari
c46346c774
chore: remove clippy script, run clippy directly (#5953)
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).
2024-08-02 13:24:43 +02:00
Marco Ferrari
94bb3f5563
feat: save super-linter output if requested (#5806)
- 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
2024-07-01 14:50:52 +02:00
Marco Ferrari
091eaa71e3
feat: show error output when info is disabled (#5251)
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.
2024-02-10 10:16:31 +01:00
Marco Ferrari
20ded7178b
fix: don't print empty lines with default logging (#5238)
- 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.
2024-02-05 18:24:07 +01:00
Marco Ferrari
eded42747b
fix: don't add unnecessary empty lines (#5221) 2024-02-05 11:49:22 +01:00
Marco Ferrari
99e41ce451
feat: run linters in parallel (#5177) 2024-01-30 19:24:55 +00:00
Marco Ferrari
5219feefab
fix: simplify worker and linterVersions (#5123)
- 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.
2024-01-15 19:37:45 +01:00
Marco Ferrari
4a28fc5e73
feat: validate variables and simplify lowercase (#5128)
- 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.
2024-01-11 20:30:00 +00:00
Marco Ferrari
3a5617235c
feat!: deprecate error_on_missing_exec_bit (#5120)
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.
2024-01-10 22:54:13 +00:00
Marco Ferrari
3a784fcfd6
fix: simplify file status checks (#5119)
- 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.
2024-01-10 12:35:05 +01:00
Marco Ferrari
11b70102c3
feat!: run linters against the workspace (#5041)
- 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.
2023-12-24 17:56:15 +01:00
Marco Ferrari
30317804b1
Lint Go modules (#4984)
* 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
2023-12-16 08:30:33 +00:00
Marco Ferrari
22564fb65c
Switch to tflint image because tflint-bundle is deprecated (#4990)
* Switch to tflint image because tflint-bundle is deprecated

* Fix version string

* Don't copy plugins

* Don't copy plugins

* Set terraform log vars globally

* Fix tflint error
2023-12-15 09:29:34 +00:00
Kin Fai Tse
c3ac3aa5d9
Batched & parallel support for cfn-lint, eslint, gitleaks (#4088)
* 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
2023-10-31 00:13:33 +00:00
Masaya Suzuki
50d462e0ec
renovate-config-validator: validate shareable config preset (#4674)
* renovate-config-validator: validate default.json

* Add RENOVATE_SHAREABLE_CONFIG_PRESET_FILE

* Allow specifying multiple additional files with a environment variable

* Add break
2023-09-29 20:25:37 +00:00
Masaya Suzuki
3703f392e8
Add renovate-config-validator (#4643) 2023-09-12 16:58:09 +00:00
Jan Hentschel
ec17c93135
Handle tflint deprecations (#4451)
Solve the deprecations introduced in tflint, which are getting removed
in v0.47.0.

Co-authored-by: Philip Mallegol-Hansen <philip@mallegolhansen.com>
2023-07-09 09:56:47 -07:00
Marco Ferrari
81c370a611
Validate if we the test suite runs both good and bad tests (#3811)
Also, remove the ansible-lint configuration file because we can rely on the default one
2023-01-11 17:24:48 +01:00
Marco Ferrari
2d7b73b7b9
Change directory to ANSIBLE_DIRECTORY before running ansible-lint and enable autodetection (#3350)
* Change directory to ANSIBLE_DIRECTORY before running ansible-lint

* move log so we see it

* Don't pass the directory to enable autodetection
2022-09-27 07:59:15 +00:00
Nicolas Vuillamy
f1196a50f6
Remove npm-groovy-lint custom handling as it now accepts files as arguments (#3250) 2022-08-15 12:49:50 -05:00
Marco Ferrari
4b16b5b473
Lint the whole Ansible directory (#2576) 2022-03-14 20:47:04 +01:00
Marco Ferrari
244f2daed2
Echo output only when necessary (#2575)
Co-authored-by: Brett Logan <lindluni@github.com>
2022-03-01 20:50:47 +01:00
Colwyn Fritze-Moor
58e42fe112 fix: dont print stdout from terraform get 2022-02-22 01:19:52 -05:00
Colwyn Fritze-Moor
ecb6625a21 fix: enable tflint module mode 2022-02-22 01:19:52 -05:00
Colwyn Fritze-Moor
0741c52808 fix: cd to terraform directory before running get 2022-02-22 01:19:52 -05:00
Colwyn Fritze-Moor
c1ded5ed7d
fix: tflint should clean up after itself (#2459)
* fix: tflint should clean up after itself

* feat: add cache for tflint
2022-02-14 09:23:17 -06:00
Lukas Gravley
28de408b0e
adding lind command output to success (#2399) 2022-01-27 17:28:11 -06:00
Colwyn Fritze-Moor
09b571b1b0
feat: add support for Terraform modules in tflint (#2297)
* 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>
2022-01-06 11:04:10 -06:00
Brett Logan
35d23ba664
Revert "Add find-unicode-control2 (#2286)" (#2299)
This reverts commit 46b9e49099.
2022-01-06 11:00:57 -06:00
Masaya Suzuki
46b9e49099
Add find-unicode-control2 (#2286)
* Add find-unicode-control2

* make version easier

* cleaner version

Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2022-01-04 10:07:45 -06:00
Konrad Pagacz
a2193cb9f6
fix(R linting): try installing the R package before linting R language (#1911)
* 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>
2021-10-05 08:46:38 -05:00
Lukas Gravley
5f65429f2c
adding tflint (#1899)
* adding tflint

* fixed array

* i thought this was fixed
2021-08-30 09:47:50 -05:00
Lukas Gravley
5f5904883d
remove tap and tests (#1496)
* remove tap and tests

* fix proto

* remove dumb test
2021-04-30 12:46:24 -05:00
Lukas Gravley
bf70afb2a9
Fix Root path for rust (#1373)
* fix path

* quiet

* rules for ktlint

* correct name
2021-03-17 13:28:51 -05:00
Antonio Yang
60e2561b15
Add clippy for rust (#1277)
* Add clippy for Rust

* Update ARM test cases

- fix arm good test case
- update tap report

* Lint github workflows release config
2021-03-08 14:13:04 -06:00
Max Held
0b756c57e8
only error on rstats lintr errors, not all lints (#1233)
* 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>
2021-02-26 08:49:08 -06:00
dependabot[bot]
7c4842d2d2
Bump ansible-lint from 5.0.1 to 5.0.2 in /dependencies (#1248)
* Bump ansible-lint from 5.0.1 to 5.0.2 in /dependencies

Bumps [ansible-lint](https://github.com/ansible-community/ansible-lint) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/ansible-community/ansible-lint/releases)
- [Commits](https://github.com/ansible-community/ansible-lint/compare/v5.0.1...v5.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

* fix ansible

* fix ansible

* looking

* maybe baby

* adding details

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
2021-02-24 07:45:39 -06:00
Lukas Gravley
9bfc6158b9
Fix Tap report spacing (#1240)
* cleaner

* fix go

* fix go

* going ham

* fix typo

* fix typo

* fix typo

* fix mapfile

* fix mapfile

* fixed spacing
2021-02-22 11:28:49 -06:00
Thorbjörn 'Puggan' Sundragon
3abe0fc5e6
Move FILTER_REGEX_INCLUDE and FILTER_REGEX_EXCLUDE test (#1022)
* 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>
2021-02-03 09:52:12 -06:00
Marco Ferrari
ab8780a58f
Install, configure, and run jscpd. Add missing tests (#1032)
Co-authored-by: Gabo <gabo.fdc@gmail.com>
Co-authored-by: Matt Desmond <beardofedu@github.com>
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2021-01-27 20:47:34 +01:00
Ishan Goel
c9471d70eb
Linter command output on newline (#1146)
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>
2021-01-20 12:44:30 -06:00
Aaron Sky
328b17bbc8
Improved ANSIBLE_DIRECTORY validation to support the repository root (#1111)
* 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>
2021-01-04 13:38:46 -06:00
Marco Ferrari
156024e231
Simplify linter and worker by generalizing ansible-lint (#1035)
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2020-12-04 16:04:09 -06:00
Gabriel Diaz
cf0e6a9704
Change log level from warn to debug (#1034)
* 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>
2020-11-30 11:19:17 -06:00
Marco Ferrari
241f9f2cad
Harden testing (#982) 2020-11-20 09:12:31 -06:00
Lukas Gravley
7943ce1f54
break out: (#990)
* break out:

* fix it

* fix source

* add them exports

* more path

* more path
2020-11-12 11:27:34 -06:00
Renamed from lib/worker.sh (Browse further)