Commit graph

38 commits

Author SHA1 Message Date
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
5b5e54ad5c
fix: initialize terrascan at runtime (#5246)
Terrascan runs initialization anyway when scanning files, so there's no
point in running it at build time. Also, this works around a Terrascan
bug that caused it to fail its initialization if $HOME/.terrascan
directory is not present. This happens on GitHub Actions because it
configures a $HOME directory that is different from ours.
2024-02-09 22:57:01 +00:00
Marco Ferrari
83eca1df43
fix: unset the log_level variable (#5249)
- Super-linter uses the LOG_LEVEL variable to let the user
  configure the desired log level. Checkov and Renovate use a variable
  with the same name for the same purpose, but accept a
  different set of values, and exit with an error if it gets an unknown
  value for that variable.
- Refactor the VERBOSE log level to the more commonly used INFO.
  Configuration validation will warn users if they use VERBOSE and
  instruct them to use INFO instead. This is not a breaking change
  because super-linter falls back on INFO if VERBOSE is set.
- Remove the TRACE log level because we rarely used it. As with VERBOSE,
  configuration validation will warn the user. Fall back to DEBUG if the
  user configured LOG_LEVEL to VERBOSE.

Close #5217
2024-02-09 18:43:58 +00:00
Marco Ferrari
38edbe557a
fix: create mypy cache directory (#5240)
MyPy expects the cache directory to be there. We now remove it after
each super-linter run to avoid leftovers, so we need to create it before
running MyPy.

See https://github.com/python/mypy/issues/10768
and https://github.com/python/mypy/issues/10863
2024-02-06 15:53:30 +01:00
Marco Ferrari
99e41ce451
feat: run linters in parallel (#5177) 2024-01-30 19:24:55 +00: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
5a2056d77a
fix: handle log messages in CheckFileType (#5117)
- Honor SUPPRESS_FILE_TYPE_WARN when printing messages in the
  CheckFileType function.
- Reduce duplication when handling log messages in the CheckFileType
  function.
- Don't add files to the array of files to lint with JSCPD because we
  lint the whole codebase with JSCPD anyway.
2024-01-11 20:44:16 +01:00
Marco Ferrari
e62b382bf0
feat: don't inspect files if not needed (#5094)
Don't run potentially expensive I/O operations to check file types if
we're not going to analyze them anyway.
2024-01-06 18:39:39 +01:00
Marco Ferrari
60983d395f
fix: fail if r package installation fails (#4994)
- Fail if the installation of a R package fails.
- Install the remotes package once during the image build, and not when we scan
  files at runtime.
- Reuse the default R library directory instead of moving it to /home/r-library
2023-12-21 20:52:57 +01: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
Marco Ferrari
e6cf8d3845
Move tests to the test directory (#4985)
* Move tests to the test directory

* Fix linting errors

* Add states back

* Add xml back
2023-12-15 08:50:35 +00:00
cicdguy
94279fc4ed
No fatal error on R package installation (#4705)
Co-authored-by: Zack Koppert <zkoppert@github.com>
2023-10-15 05:10:37 +00:00
EJ Etherington
dea6e50722
Update Kuberentes File Detection (#4375)
Co-authored-by: Zack Koppert <zkoppert@github.com>
2023-06-20 12:27:03 -07:00
tonyk7440
516b3f81b1 #3501 edit code to debug from review 2023-04-10 19:29:18 -04:00
Tony Kenny
e8d8e662c8 #3473 redirect more output 2023-04-10 19:29:18 -04:00
tonyk7440
c525f0b39f #3473 try alternate install cmd 2023-04-10 19:29:18 -04:00
Marco Ferrari
8607445fb4 Throw a fatal error if tflint --init fails 2022-10-09 19:31:12 -04:00
Marco Ferrari
2053621293
Use TFLINT_LOG environment variable instead of the deprecated --loglevel option (#3414) 2022-10-05 13:27:30 +00:00
Lukas Gravley
bb6a68e80b
adding log level (#2959)
* adding log level

* Update lib/functions/detectFiles.sh

Co-authored-by: Tibo Delor <delor.thibault@gmail.com>

* fix space

Co-authored-by: Tibo Delor <delor.thibault@gmail.com>
2022-05-26 09:33:19 -05:00
Lukas Gravley
14eb37a88c
adding addional command (#2711)
* adding addional command

* shell format
2022-03-28 13:32:04 -05:00
Marco Ferrari
c5e5046b8b
Don't override the PATH when installing Psalm (#2643) 2022-03-23 11:43:28 -05:00
Marco Ferrari
4b16b5b473
Lint the whole Ansible directory (#2576) 2022-03-14 20:47:04 +01:00
Marco Ferrari
f26ace31b9
Check for kind when detecting Kubernetes files (#2612)
* Check for kind when detecting Kubernetes files

* Fix condition

* Check conditions one by one

* Formatting

* Formatting
2022-03-14 09:22:58 -05:00
Lukas Gravley
591688d57d
adding perl and python (#2360) 2022-01-19 11:09:26 -06:00
Brett Logan
47bd074778
Update Deps (#2107)
* Fix rakudo

* Update deps

* wants percent

* fix style

* somehow we got a space

Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
2021-11-09 14:35:36 -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
57e0530d1b
cleaner (#2008)
* cleaner

* fix bad name

* fix name

* adding flag

* fix links

* noise

* fix rules

* fix to warn

* remove textlint
2021-10-01 12:41:13 -05:00
Lukas Gravley
a3cce70fa3
adding composer code (#1950)
* adding composer code

* making it better

* adding composer bin

* adding some logic

* make shellfmt happy
2021-09-10 09:43:20 -05:00
Tibo Delor
a3ad489783
Match AWS States file using "States" JSON key (#1949)
* Match AWS states file using "States" key

Matching only on `"Resource": "arn` is too wide and will match also aws json policy files

* Update detectFiles.sh

* spacing

Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
2021-09-09 13:03:41 -05:00
Lukas Gravley
c649496209
suppress warn messages (#1943) 2021-09-07 10:12:49 -05:00
Xiao Liang
f6910e3ee9
feat: support bats (#1778)
Support linting of bats files by identifying them as shell scripts (they actually are)
2021-07-19 09:30:44 -05:00
Lukas Gravley
ab24b82199
Adding actionlint (#1775)
* Adding action lint

* adding tests

* adding tests

* Update Dockerfile

Co-authored-by: Masaya Suzuki <15100604+massongit@users.noreply.github.com>

* cleanup name

* fix test

* typo

* fix file name

* fix our own errors

* more cleanup

* angry

* make it happy

* stop double jobs

Co-authored-by: Masaya Suzuki <15100604+massongit@users.noreply.github.com>
2021-07-19 09:28:49 -05:00
Stepan Koltsov
e059100991
Ignore files marked with @generated marker (#1689)
* Ignore files marked with @generated marker

`@generated` marker is used by certain tools to understand that the
file is generated, so it should be treated differently than a file
written by a human:
* these files do not need to be reformatted,
* diffs in these files are less important,
* and linters should not be invoked on these files.

This PR proposes builtin support for `@generated` marker (and
`@not-generated` marker to mark file as not generated when it
contains `@generated` marker, like `README.md`).

I have not found a standard for a generated file marker, but:
* Facebook [uses `@generated` marker](https://tinyurl.com/fb-generated)
* Phabricator tool which was spawned from Facebook internal tool
  [also understands `@generated` marker](https://git.io/JnVHa)
* Cargo inserts `@generated` marker into [generated Cargo.lock files](https://git.io/JnVHP)

Super-linter supports regex includes and excludes, but they are
harder to maintain (each repository needs to be configured) than
patching the tools which generate the files.

My personal story is that I maintain rust-protobuf crate, which
started emitting `@generated` markers [six years ago](https://git.io/JnV5h)
after a request of a Phabricator user.

Test Plan:

Create a test file `test.sh`:

```
echo $a
```

Run:

```
docker run -e RUN_LOCAL=true -v $HOME/tmp/g:/tmp/lint super-linter-test
```

Result is:

```
In /tmp/lint/test.sh line 1:
echo $a
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
     ^-- SC2154: a is referenced but not assigned.
     ^-- SC2086: Double quote to prevent globbing and word splitting.
...
2021-06-22 23:46:16 [ERROR]   ERRORS FOUND in BASH:[1]
```

Now add `@generated` to the file and run again:

```
2021-06-22 23:47:13 [NOTICE]   All file(s) linted successfully with no errors detected
```

Additionally, add `@not-generated` in addition to `@generated`, and
linter error pops up again.

* cleanup

* remove space

* fix non utf return

* fix non utf return

Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2021-06-28 07:59:11 -05:00
Lukas Gravley
ebf6194d0e
wildcard search (#1608) 2021-06-01 12:17:13 -05: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
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
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