Commit graph

89 commits

Author SHA1 Message Date
Marco Ferrari
cb109f45f1
fix: export test_case_run (#5499)
- Export the TEST_CASE_RUN variable because subprocesses reference it
  when building the file list.
- Remove a duplicate file that we didn't catch because Jscpd was not
  running due to the TEST_CASE_RUN variable not being exported.

Fix #5483
2024-04-08 20:48:30 +02:00
Marco Ferrari
608bd502d8
docs: suggest setting fetch-depth on ref errors (#5316)
Emit a hopefully more helpful error message when the Git ref doesn't
exist. The error message is the same we use when getting changed files
only: it suggests checking that repository clone is not shallow, and
that the full history is available. Additionally, when running on
GitHub Actions, it also suggests checking the fetch-depth option of the
actions/checkout step.

Fix #5315
2024-02-27 13:25:18 +01:00
Marco Ferrari
0967cd29d0
feat: enable shell error checks (#5126)
Enable error checks to:

- Exit on errors
- Disallow empty variables
- Fail when a piped command errors
2024-02-20 19:05:39 +00: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
787b63ddb2
fix: write hint about fetch-depth (#5241)
Point users at the fetch-depth option when not running locally.
2024-02-09 17:45:00 +00:00
Marco Ferrari
a26db6d34d
feat: lint xsd files (#5250)
Lint XSD files with xmllint

Close #5248
2024-02-09 17:44:30 +00: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
05009f2816
chore: simplify error code checks (#5131)
Instead of loading the error code and checking it, shorten checks by
running the command directly.
2024-01-30 08:48:24 +01:00
Marco Ferrari
f1873b0374
feat: don't check bake files with terragrunt (#5178)
Exclude the default docker bake files in HCL format from the list of files to
lint with Terragrunt.

Note that Docker bake supports defining arbitrary names for
configuration files, so this commit doesn't cover the scenario that a
user defined an arbitrary name for a Docker bake configuration file in
HCL format. Example: example-bake-config-file.hcl will be included in
the list of files to lint with Terragrunt.

Ref (default bake names):
https://docs.docker.com/build/bake/reference/#file-format
2024-01-29 13:51:28 +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
6f70adee89
fix: enable linting changed files with textlint (#5100)
textlint was expensive to run because we added every file in the list of
files to lint to FILE_ARRAY_NATURAL_LANGUAGE. In #5041, we mitigated
this issue but lost the ability to run textlint on changed files only.
Given that textlint ignore files for which it doesn't have a plugin
installed, and that we don't currently install additional plugins
besides the default ones to lint markdown files and text files, we let
textlint run on these files only, so we can have the feature to lint
only changed files with this linter as well, back.
2024-01-10 09:49:04 +01:00
Marco Ferrari
1d5ed2c386
fix: fix GITHUB_BEFORE_SHA diff on push events (#5096)
- Fix GITHUB_BEFORE_SHA initialization on push events by setting the
  correct key.
- Add an additional check against setting GITHUB_BEFORE_SHA to null.
- Run the CI workflow on push events to trigger required status checks
  when using the merge queue.
2024-01-04 22:54:47 +01:00
dependabot[bot]
20d12b4c7a
deps(java): bump com.pinterest.ktlint:ktlint-cli in /dependencies/ktlint (#5050)
Remove KOTLIN_ANDROID because ktlint handles that case by reading
a configuration setting in .editorconfig.

Bumps [com.pinterest.ktlint:ktlint-cli](https://github.com/pinterest/ktlint) from 0.47.1 to 1.1.0.
- [Release notes](https://github.com/pinterest/ktlint/releases)
- [Changelog](https://github.com/pinterest/ktlint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pinterest/ktlint/compare/0.47.1...1.1.0)

---
updated-dependencies:
- dependency-name: com.pinterest.ktlint:ktlint-cli
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-24 19:33:08 +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
b214a59ca7
fix: fix file list when looking for changes (#5044)
- Fix the file diff function on push events.
- Implement a test for the file diff function
2023-12-23 19:33:53 +01:00
Marco Ferrari
9d7268fb99
feat: add support for checkov to lint iac files (#4925)
- Add support to run Checkov against infrastructure as code descriptors
  that are in a given (configurable) directory. Defaults to lint the
  whole workspace.
- Establish a baseline for our own codebase so we don't have to fix
  issues right away with this change.
2023-12-22 13:22: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
eb688a090c
Change directory when checking ignored files (#4933)
* Change dir when checking ignored files

* Set to GITHUB_WORKSPACE
2023-12-06 07:32:46 +00:00
Marco Ferrari
5a8805dc4f
Exit on errors when running Git (#4889)
* Exit on errors when running Git

* Skip pulling changes entirely

* Enable pipefail when generating diffs

* Cleanup

* Shallow repo check

* Echo GITHUB_SHA update

* Check if GITHUB_SHA exists before using it

* Move GITHUB_SHA validation to validation script

* Rely on cat-file return code

* Check if DEFAULT_BRANCH exists

* Change dir when checking DEFAULT_BRANCH

* Show git branches

* Don't switch branches

* Check GITHUB_SHA only when needed

* Ensure we have permissions before interacting with the repo

* Remove the DIFF_CMD variable

* Move TEST_CASE_RUN and RUN_LOCAL init up

* Validate if Git repo and if SHA exists

* Move validation function

* Change dir when getting branch names

* Move debug messages up to be less verbose

* Move branch validation in a function

* Fix linting errors
2023-12-04 09:47:49 +00:00
Chris McIntosh
6c7dc51cf8
Fixes Regex to match only container files more strictly (#4867)
* #4846 fixes regex to be more strict with filenames that container Dockerfile but that are not actually dockerfiles

* Debug print for ANSIBLE_DIRECTORY to see if tests exist

* Trying out the =~ operator

* rm echo cmd

* catch the i-am-containerfile case

* rm extra space

* Remove quotes for shell format linter

---------

Co-authored-by: Zack Koppert <zkoppert@github.com>
2023-11-15 05:44:46 +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
Zack Koppert
da4dd08cd6
Follow up with several more documentation and automation renames for the org move from github to super-linter (#4543)
* move from github org to super-linter org

* rename to super-linter org

* rename to super-linter org

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter and remove dockerhub reference

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rename org to super-linter

* rm dockerhub section link
2023-08-17 15:12:11 +00:00
Stephen Abbene
6c1fcb284a
no need to run git check-ignore on every file if you are not setting IGNORE_GITIGNORED_FILES (#4348) 2023-06-09 09:33:05 -07:00
Bert Roos
ef76367358
Issue hint when failing to switch back to branch (#4107)
* Issue hint when failing to switch back to branch

Switching back to the branch fails with the below error on a shallow checkout:

2023-04-18 21:34:51 [ERROR]   Failed to switch back to branch!
2023-04-18 21:34:51 [FATAL]   [fatal: reference is not a tree: 3afa21b5f9bef8e81396e3572a598d089e710b96]

With this change, it will look as follows:

2023-04-18 21:34:51 [ERROR]   Failed to switch back to branch!
2023-04-18 21:34:51 [INFO]   Check that you have the full git history, the checkout is not shallow, etc
2023-04-18 21:34:51 [INFO]  See https://github.com/github/super-linter#example-connecting-github-action-workflow
2023-04-18 21:34:51 [FATAL]   [fatal: reference is not a tree: 3afa21b5f9bef8e81396e3572a598d089e710b96]

* Update lib/functions/buildFileList.sh

---------

Co-authored-by: Philip Mallegol-Hansen <philip@mallegolhansen.com>
2023-05-23 00:30:16 +00:00
Chris Kuhl
6bde96b30c
fix: Correct typo in env. var. name (#4153) 2023-05-22 23:08:35 +00:00
Janis Voigtländer
92ee250684 Textlint should check every file 2023-04-16 22:08:23 -04:00
Rui Chen
e6445c358f replace kubeval with kubeconform
Signed-off-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: Brett Logan <lindluni@github.com>
2023-01-16 21:14:13 -05:00
Jon Hamm
aad87c569b add jenkinsfile to groovy files 2023-01-05 09:52:29 -05:00
Algin Maduro
9f4a208eb5 Add terraform fmt support 2023-01-04 22:44:16 -05:00
Christoph Höger
adbf28f42d Use git check-ignore instead of a (incomplete) list of ignored files
The list-based method breaks down in case of ignored folders:
If .gitignore contains foo/, foo/bar.py is still checked.

Signed-off-by: Christoph Höger <christoph.hoeger@piano.io>
2023-01-03 20:14:39 -05:00
Lukas Gravley
431ee7836e
Release 4.9.3 (#2948)
* Update action.yml

* Update action.yml

* set flag to solve local changes

* spaces
2022-05-24 13:44:12 -05:00
Lukas Gravley
6c24367c7b
dumb issue (#2810) 2022-04-20 09:04:58 -07:00
Lukas Gravley
cb3c5472d8
adding safe (#2806)
* adding safe

* make a var

* so dumb

* so dumber

* so dumberer

* so dumbererer

* so dumberererer

* both
2022-04-19 15:12:46 -07:00
Alexandre Favre
edc7095b4b
Add Android support for Kotlin (#2670)
* Fix Kotlin good test case (incorrect filename)

* Add Android support for Kotlin

Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2022-03-24 15:39:52 -05:00
Marco Ferrari
4b16b5b473
Lint the whole Ansible directory (#2576) 2022-03-14 20:47:04 +01:00
Marco Ferrari
d7cefe279b
Don't populate FILE_ARRAY_JSCPD with single files when scanning the whole codebase (#2580) 2022-03-14 09:22:23 -05:00
Brett Logan
35d23ba664
Revert "Add find-unicode-control2 (#2286)" (#2299)
This reverts commit 46b9e49099.
2022-01-06 11:00:57 -06:00
Lukas Gravley
42981a4a7a
Update additional scala extensions (#2296)
* Update buildFileList.sh

add new extension

* fix space

* turn this down a hair

* update

* fix rule

* fixed dumb stuff

* fix indent

* hangry
2022-01-06 09:28:26 -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
Marco Ferrari
e4b08ec842
Lint the whole code base with JSCPD (#2180)
* Lint the whole code base with JSCPD if VALIDATE_ALL_CODEBASE is true

* Use VALIDATE_JSCPD_ALL_CODEBASE

Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2021-12-08 14:28:30 -06:00
dependabot[bot]
de35dfbf5a
Bump zricethezav/gitleaks from v7.6.1 to v8.0.4 (#2188)
* Bump zricethezav/gitleaks from v7.6.1 to v8.0.4

Bumps zricethezav/gitleaks from v7.6.1 to v8.0.4.

---
updated-dependencies:
- dependency-name: zricethezav/gitleaks
  dependency-type: direct:production
...

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

* fixing command for after 8.x

* better regex

* better verbose

* remove file

* fixed logic

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
2021-12-08 14:28:11 -06:00
Marco Ferrari
ee99da290b
Uninstall Dockerfilelint (#2195)
* Uninstall Dockerfilelint

* remove dockerfilelint packages

* trying ca-certs

Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
2021-12-08 09:53:05 -06:00
Marco Ferrari
071bfadcf0
Add RUST_2021 test and fix RUST_2021 file list (#2215)
* Add RUST_2021 test

* Add files to ARRAY_RUST_2021
2021-12-07 15:55:54 -06:00
Lukas Gravley
fb82126082
Typescript prettier (#2121)
* adding typescript prettier

* adding typescript prettier

* fix scala
2021-11-12 10:25:32 -06:00
Jake Herbst
897185a4aa
Adding scalafmt (#2053)
* Adding scalafmt

* add it

Co-authored-by: Jake Herbst <jherbst@rsglab.com>
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2021-11-10 12:28:50 -06:00
Masaya Suzuki
fafdcd214e
Add textlint (#2021)
* Add textlint

* Fix by textlint

* Fix package-lock.json

* Fix package-lock.json
2021-10-05 08:29:05 -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