Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.
/ lintr-cli Public archive

Bash wrapper for lintr: lint your code outside of R, not inside

License

Notifications You must be signed in to change notification settings

jlanga/lintr-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

lintr-cli

Bash wrapper for lintr: lint your R code outside of R, not inside

Requirements

  • A shell (duh!)
  • R (obviously)
  • lintr

Installation

  1. Enter R and type
install.packages("lintr")
  1. Copy lintr-cli to a folder in your path, or in a folder nearby

How to use it

./lintr-cli bad.R
> lintr::lint("bad.R")
bad.R:1:5: style: Use <-, not =, for assignment.
fun = function(one)
    ^
bad.R:2:1: style: Opening curly braces should never go on their own line and should always be followed by a new line.
{
^
bad.R:3:5: style: Words within variable and function names should be separated by '_' rather than '.'.
    one.plus.one <- oen +1 
    ^~~~~~~~~~~~
bad.R:3:5: warning: local variableone.plus.oneassigned but may not be used
    one.plus.one <- oen +1 
    ^~~~~~~~~~~~
bad.R:3:21: warning: no visible binding for global variableoen’, Did you mean 'one'?
    one.plus.one <- oen +1 
                    ^~~
bad.R:3:25: style: Put spaces around all infix operators.
    one.plus.one <- oen +1 
                        ^~
bad.R:3:27: style: Trailing whitespace is superfluous.
    one.plus.one <- oen +1 
                          ^
bad.R:4:13: style: Variable and function names should be all lowercase.
    four <- newVar <- matrix(1:10, nrow = 2)
            ^~~~~~
bad.R:4:13: warning: local variablenewVarassigned but may not be used
    four <- newVar <- matrix(1:10, nrow = 2)
            ^~~~~~
bad.R:5:9: style: Do not place spaces around code in parentheses or square brackets.
    four[ 1, ]
        ^
bad.R:6:12: style: Only use double-quotes.
    txt <- 'hi'
           ^~~~
bad.R:7:5: warning: local variablethreeassigned but may not be used
    three <- two+ 1
    ^~~~~
bad.R:7:14: warning: no visible binding for global variabletwo’, Did you mean 'txt'?
    three <- two+ 1
             ^~~
bad.R:7:17: style: Put spaces around all infix operators.
    three <- two+ 1
               ~^
bad.R:8:7: style: Place a space before left parenthesis, except in a function call.
    if(txt == 'hi') 4
      ^
bad.R:8:15: style: Only use double-quotes.
    if(txt == 'hi') 4
              ^~~~
bad.R:9:6: style: Closing curly-braces should always be on their own line, unless it's followed by an else.
    5}
     ^
bad.R:10:1: error: unexpected '}'
}
^

About

Bash wrapper for lintr: lint your code outside of R, not inside

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published