Don't populate FILE_ARRAY_JSCPD with single files when scanning the whole codebase (#2580)

This commit is contained in:
Marco Ferrari 2022-03-14 15:22:23 +01:00 committed by GitHub
parent b80c79d647
commit d7cefe279b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -329,7 +329,7 @@ But if you wish to select or exclude specific linters, we give you full control
| **TYPESCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [ESLint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`) |
| **USE_FIND_ALGORITHM** | `false` | By default, we use `git diff` to find all files in the workspace and what has been updated, this would enable the Linux `find` method instead to find all files to lint |
| **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. |
| **VALIDATE_JSCPD_ALL_CODEBASE** | `false` | If set to `true`, will lint the whole codebase with JSCPD, in addition to linting files with JSCPD one by one. If set to `false`, JSCPD will only lint files one by one. |
| **VALIDATE_JSCPD_ALL_CODEBASE** | `false` | If set to `true`, will lint the whole codebase with JSCPD. If set to `false`, JSCPD will only lint files one by one. |
| **VALIDATE_ANSIBLE** | `true` | Flag to enable or disable the linting process of the Ansible language. |
| **VALIDATE_ARM** | `true` | Flag to enable or disable the linting process of the ARM language. |
| **VALIDATE_BASH** | `true` | Flag to enable or disable the linting process of the Bash language. |

View file

@ -316,8 +316,13 @@ function BuildFileList() {
# Editorconfig-checker should check every file
FILE_ARRAY_EDITORCONFIG+=("${FILE}")
# jscpd also runs an all files
FILE_ARRAY_JSCPD+=("${FILE}")
if [ "${VALIDATE_JSCPD_ALL_CODEBASE}" == "true" ]; then
debug "Not adding ${FILE} to FILE_ARRAY_JSCPD because we're going to lint the whole codebase anyway."
else
# jscpd also runs an all files
FILE_ARRAY_JSCPD+=("${FILE}")
fi
# Need to make sure we dont check the secrets paterns
# for secrets, as it will pop!
if [ "${BASE_FILE}" != ".gitleaks.toml" ]; then