Skip to content

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

Closed

Description

@MichaelChirico
download.file("https://raw.githubusercontent.com/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.

Activity

  1. added
    bug
    on Mar 12, 2021
  2. IndrajeetPatil commented on Oct 8, 2022

    @IndrajeetPatil
    Contributor

    Looks good with #1642!

    download.file("https://raw.githubusercontent.com/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions