mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-25 15:41:02 -05:00
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>
This commit is contained in:
parent
a91f07d277
commit
0b756c57e8
4 changed files with 6 additions and 3 deletions
|
@ -39,5 +39,8 @@ message('single_quotes')
|
|||
# trailing_whitespace
|
||||
y <- 2 +(1:10)
|
||||
|
||||
# unexpected end of input
|
||||
{
|
||||
|
||||
# trailing_blank_lines
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@ TAP version 13
|
|||
1..2
|
||||
not ok 1 - r_bad_1.r
|
||||
---
|
||||
message: Warning message \nIn options(stringsAsFactors = TRUE) \n 'options(stringsAsFactors = TRUE)' is deprecated and will be disabled\n/tmp/lint/.automation/test/r/r_bad_1.r 8 3 style Use <-, not =, for assignment.\nf = function (x,y = 1){}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 8 14 style Remove spaces before the left parenthesis in a function call.\nf = function (x,y = 1){}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 8 17 style Commas should always have a space after.\nf = function (x,y = 1){}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 8 22 style There should be a space between right parenthesis and an opening curly brace.\nf = function (x,y = 1){}\n ^~\n/tmp/lint/.automation/test/r/r_bad_1.r 8 23 style Opening curly braces should never go on their own line and should always be followed by a new line.\nf = function (x,y = 1){}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 8 24 style Closing curly-braces should always be on their own line, unless it's followed by an else.\nf = function (x,y = 1){}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 11 3 style Commented code should be removed.\n# some <- commented("out code")\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 21 1 style functions should have cyclomatic complexity of less than 15, this has 22.\nsomeComplicatedFunctionWithALongCameCaseName <- function(x)\n^\n/tmp/lint/.automation/test/r/r_bad_1.r 21 1 style Variable and function names should not be longer than 30 characters.\nsomeComplicatedFunctionWithALongCameCaseName <- function(x)\n^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 21 1 style Variable and function name style should be snake_case.\nsomeComplicatedFunctionWithALongCameCaseName <- function(x)\n^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 22 1 style Opening curly braces should never go on their own line and should always be followed by a new line.\n{\n^\n/tmp/lint/.automation/test/r/r_bad_1.r 24 1 style Lines should not be more than 80 characters.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 24 44 style Put spaces around all infix operators.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ~^~\n/tmp/lint/.automation/test/r/r_bad_1.r 24 57 warning Use is.na rather than == NA.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ^~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 24 64 style Opening curly braces should never go on their own line and should always be followed by a new line.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 24 69 style Closing curly-braces should always be on their own line, unless it's followed by an else.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 24 76 style Opening curly braces should never go on their own line and should always be followed by a new line.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 24 82 style Closing curly-braces should always be on their own line, unless it's followed by an else.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 31 3 style Do not place spaces around code in parentheses or square brackets.\nx[ 2]\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 32 1 warning Avoid 1 length(...) expressions, use seq_len.\n1 length(x) %>% lapply(function(x) x*2) %>%\n^\n/tmp/lint/.automation/test/r/r_bad_1.r 32 37 style Put spaces around all infix operators.\n1 length(x) %>% lapply(function(x) x*2) %>%\n ~^~\n/tmp/lint/.automation/test/r/r_bad_1.r 32 43 style `%>%` should always have a space before it and a new line after it, unless the full pipeline fits on one line.\n1 length(x) %>% lapply(function(x) x*2) %>%\n ~~^\n/tmp/lint/.automation/test/r/r_bad_1.r 36 9 style Only use double-quotes.\nmessage('single_quotes')\n ^~~~~~~~~~~~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 40 8 style Put spaces around all infix operators.\ny <- 2 +(1 10)\n ^~\n/tmp/lint/.automation/test/r/r_bad_1.r 40 9 style Place a space before left parenthesis, except in a function call.\ny <- 2 +(1 10)\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 43 1 style Trailing blank lines are superfluous.\n\n^\n
|
||||
message: /tmp/lint/.automation/test/r/r_bad_1.r 8 3 style Use <-, not =, for assignment.\nf = function (x,y = 1){}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 8 14 style Remove spaces before the left parenthesis in a function call.\nf = function (x,y = 1){}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 8 17 style Commas should always have a space after.\nf = function (x,y = 1){}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 8 22 style There should be a space between right parenthesis and an opening curly brace.\nf = function (x,y = 1){}\n ^~\n/tmp/lint/.automation/test/r/r_bad_1.r 8 23 style Opening curly braces should never go on their own line and should always be followed by a new line.\nf = function (x,y = 1){}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 8 24 style Closing curly-braces should always be on their own line, unless it's followed by an else.\nf = function (x,y = 1){}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 11 3 style Commented code should be removed.\n# some <- commented("out code")\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 21 1 style functions should have cyclomatic complexity of less than 15, this has 22.\nsomeComplicatedFunctionWithALongCameCaseName <- function(x)\n^\n/tmp/lint/.automation/test/r/r_bad_1.r 21 1 style Variable and function names should not be longer than 30 characters.\nsomeComplicatedFunctionWithALongCameCaseName <- function(x)\n^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 21 1 style Variable and function name style should be snake_case.\nsomeComplicatedFunctionWithALongCameCaseName <- function(x)\n^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 22 1 style Opening curly braces should never go on their own line and should always be followed by a new line.\n{\n^\n/tmp/lint/.automation/test/r/r_bad_1.r 24 1 style Lines should not be more than 80 characters.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 24 44 style Put spaces around all infix operators.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ~^~\n/tmp/lint/.automation/test/r/r_bad_1.r 24 57 warning Use is.na rather than == NA.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ^~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 24 64 style Opening curly braces should never go on their own line and should always be followed by a new line.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 24 69 style Closing curly-braces should always be on their own line, unless it's followed by an else.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 24 76 style Opening curly braces should never go on their own line and should always be followed by a new line.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 24 82 style Closing curly-braces should always be on their own line, unless it's followed by an else.\n if (1 > 2 && 2 > 3 && 3 > 4 && 4 > 5 && 5*10 > 6 && x == NA) {TRUE} else {FALSE}\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 31 3 style Do not place spaces around code in parentheses or square brackets.\nx[ 2]\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 32 1 warning Avoid 1 length(...) expressions, use seq_len.\n1 length(x) %>% lapply(function(x) x*2) %>%\n^\n/tmp/lint/.automation/test/r/r_bad_1.r 32 37 style Put spaces around all infix operators.\n1 length(x) %>% lapply(function(x) x*2) %>%\n ~^~\n/tmp/lint/.automation/test/r/r_bad_1.r 32 43 style `%>%` should always have a space before it and a new line after it, unless the full pipeline fits on one line.\n1 length(x) %>% lapply(function(x) x*2) %>%\n ~~^\n/tmp/lint/.automation/test/r/r_bad_1.r 36 9 style Only use double-quotes.\nmessage('single_quotes')\n ^~~~~~~~~~~~~~~\n/tmp/lint/.automation/test/r/r_bad_1.r 40 8 style Put spaces around all infix operators.\ny <- 2 +(1 10)\n ^~\n/tmp/lint/.automation/test/r/r_bad_1.r 40 9 style Place a space before left parenthesis, except in a function call.\ny <- 2 +(1 10)\n ^\n/tmp/lint/.automation/test/r/r_bad_1.r 43 1 style Opening curly braces should never go on their own line and should always be followed by a new line.\n{\n^\n/tmp/lint/.automation/test/r/r_bad_1.r 46 0 error unexpected end of input\n\n\n/tmp/lint/.automation/test/r/r_bad_1.r 46 1 style Trailing blank lines are superfluous.\n\n^\n
|
||||
...
|
||||
ok 2 - r_good_1.r
|
||||
|
|
|
@ -18,7 +18,7 @@ FROM alpine/terragrunt:0.14.5 as terragrunt
|
|||
FROM mvdan/shfmt:v3.2.2 as shfmt
|
||||
FROM accurics/terrascan:2d1374b as terrascan
|
||||
FROM hadolint/hadolint:latest-alpine as dockerfile-lint
|
||||
FROM ghcr.io/assignuser/lintr-lib:0.1.2 as lintr-lib
|
||||
FROM ghcr.io/assignuser/lintr-lib:0.2.0 as lintr-lib
|
||||
FROM ghcr.io/assignuser/chktex-alpine:0.1.1 as chktex
|
||||
FROM garethr/kubeval:0.15.0 as kubeval
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ function LintCodebase() {
|
|||
fi
|
||||
LINT_CMD=$(
|
||||
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
|
||||
R --slave -e "lints <- lintr::lint('$FILE');print(lints);errors <- purrr::keep(lints, ~ .\$type == 'error');quit(save = 'no', status = if (length(errors) > 0) 1 else 0)" 2>&1
|
||||
)
|
||||
#########################################################
|
||||
# Corner case for C# as it writes to tty and not stdout #
|
||||
|
|
Loading…
Reference in a new issue