mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 12:42:09 -05:00
relative exclusions work, adressed comments
This commit is contained in:
parent
9ec761f61c
commit
6372885cd0
4 changed files with 15 additions and 9 deletions
|
@ -905,7 +905,7 @@ var = "terrible code down here..."
|
|||
|
||||
- `.github/linters/.lintr`
|
||||
- You can pass multiple rules and overwrite default rules
|
||||
- File should be located at: `.github/linters/.lintr`
|
||||
- You can use either one `.lintr` file in the root of your repository and/or additonal `.lintr` files in subdirectories. When linting a file lintr will look for config files from the file location upwards and will use the closest one.
|
||||
- **Note:** The defaults adhere to the [tidyverse styleguide](https://style.tidyverse.org/)
|
||||
|
||||
### lintr disable single line
|
||||
|
@ -924,7 +924,7 @@ var = "terrible code down here..."
|
|||
```
|
||||
### lintr disable entire file
|
||||
|
||||
Add files to exclude into the config file as a list of filenames to exclude from linting. You can use a named item to exclude only certain lines from a file.
|
||||
Add files to exclude into the config file as a list of filenames to exclude from linting. You can use a named item to exclude only certain lines from a file. Use paths relative to the location of the `.lintr` file.
|
||||
|
||||
```r
|
||||
exclusions: list("inst/doc/creating_linters.R" = 1, "inst/example/bad.R", "tests/testthat/exclusions-test")
|
||||
|
|
|
@ -358,7 +358,7 @@ function BuildFileList() {
|
|||
####################
|
||||
# Get the R files #
|
||||
####################
|
||||
elif [ "${FILE_TYPE}" == "r" ]; then
|
||||
elif [ "${FILE_TYPE}" == "r" ] || [ "${FILE_TYPE}" == "rmd" ]; then
|
||||
################################
|
||||
# Append the file to the array #
|
||||
################################
|
||||
|
|
|
@ -132,8 +132,8 @@ YAML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${YAML_FILE_NAME}" # Path to the ya
|
|||
#######################################
|
||||
LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'cfn-lint' 'checkstyle' 'clj-kondo' 'coffeelint'
|
||||
'dart' 'dockerfilelint' 'dotenv-linter' 'editorconfig-checker' 'eslint' 'flake8' 'golangci-lint'
|
||||
'hadolint' 'htmlhint' 'jsonlint' 'ktlint' 'lua' 'markdownlint' 'npm-groovy-lint' 'perl' 'protolint'
|
||||
'pwsh' 'pylint' 'lintr' 'raku' 'rubocop' 'shellcheck' 'spectral' 'standard' 'stylelint' 'sql-lint'
|
||||
'hadolint' 'htmlhint' 'jsonlint' 'ktlint' 'lintr' 'lua' 'markdownlint' 'npm-groovy-lint' 'perl' 'protolint'
|
||||
'pwsh' 'pylint' 'raku' 'rubocop' 'shellcheck' 'spectral' 'standard' 'stylelint' 'sql-lint'
|
||||
'terrascan' 'tflint' 'xmllint' 'yamllint')
|
||||
|
||||
#############################
|
||||
|
@ -299,7 +299,7 @@ FILE_ARRAY_POWERSHELL=() # Array of files to check
|
|||
FILE_ARRAY_PROTOBUF=() # Array of files to check
|
||||
FILE_ARRAY_PYTHON_PYLINT=() # Array of files to check
|
||||
FILE_ARRAY_PYTHON_FLAKE8=() # Array of files to check
|
||||
FILE_ARRAY_R=() # Array of files to check
|
||||
FILE_ARRAY_R=() # Array of files to check
|
||||
FILE_ARRAY_RAKU=() # Array of files to check
|
||||
FILE_ARRAY_RUBY=() # Array of files to check
|
||||
FILE_ARRAY_STATES=() # Array of files to check
|
||||
|
@ -1708,7 +1708,7 @@ if [ "${VALIDATE_R}" == "true" ]; then
|
|||
# Lint the R files #
|
||||
######################
|
||||
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
|
||||
LintCodebase "R" "lintr" "lintr::lint('$File')" ".*\.\(r\|R\|Rmd\|rmd\)\$" "${FILE_ARRAY_R[@]}"
|
||||
LintCodebase "R" "lintr" "lintr::lint(File)" ".*\.\(r\|R\|Rmd\|rmd\)\$" "${FILE_ARRAY_R[@]}"
|
||||
fi
|
||||
|
||||
################
|
||||
|
|
|
@ -213,10 +213,16 @@ function LintCodebase() {
|
|||
#######################################
|
||||
# Lint the file with the updated path #
|
||||
#######################################
|
||||
if [ ! -f "${DIR_NAME}/.lintr" ]; then
|
||||
r_dir="${GITHUB_WORKSPACE}"
|
||||
else
|
||||
r_dir="${DIR_NAME}"
|
||||
fi
|
||||
LINT_CMD=$(
|
||||
cd "${DIR_NAME}" || exit
|
||||
cd "$r_dir" || exit
|
||||
R --slave -e "errors <- lintr::lint('$FILE');print(errors);quit(save = 'no', status = if (length(errors) > 0) 1 else 0)" 2>&1
|
||||
)
|
||||
#LINTER_COMMAND="lintr::lint('${FILE}')"
|
||||
else
|
||||
################################
|
||||
# Lint the file with the rules #
|
||||
|
@ -632,7 +638,7 @@ function RunTestCases() {
|
|||
TestCodebase "PYTHON_PYLINT" "pylint" "pylint --rcfile ${PYTHON_PYLINT_LINTER_RULES}" ".*\.\(py\)\$" "python"
|
||||
TestCodebase "PYTHON_FLAKE8" "flake8" "flake8 --config ${PYTHON_FLAKE8_LINTER_RULES}" ".*\.\(py\)\$" "python"
|
||||
# TestCodebase "Language" "Linter" "Linter-command" "Regex to find files" "Test Folder"
|
||||
TestCodebase "R" "lintr" "raku -c" ".*\.\(r\|R\|Rmd\|rmd\)\$" "r"
|
||||
TestCodebase "R" "lintr" "lintr::lint()" ".*\.\(r\|R\|Rmd\|rmd\)\$" "r"
|
||||
TestCodebase "RAKU" "raku" "raku -c" ".*\.\(raku\|rakumod\|rakutest\|pm6\|pl6\|p6\)\$" "raku"
|
||||
TestCodebase "RUBY" "rubocop" "rubocop -c ${RUBY_LINTER_RULES}" ".*\.\(rb\)\$" "ruby"
|
||||
TestCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "states"
|
||||
|
|
Loading…
Reference in a new issue