Closed lbraglia closed 9 years ago
Thanks. I have not used lintr
yet. What are its benefits compared to checking a package and sourcing/running a function other than a direct static code analysis; does it uncover other bugs?
I've started using it yesterday... currently it seems mainly a style-checking (hadley's style by default, but can be configured) package with some bits of good practices enforcing. It uses codetools (checkUsage) for other analysis (it's not in the default linters). It's easy to add new linters (or to remove unused from the default ones)
Below from the devel README.md, about available linter up to now:
Syntax errors
: reported by parse.object_usage_linter
: checks that closures have the proper usage using
codetools::checkUsage(). Note this runs
base::eval() on the code, so do not use with untrusted code.absolute_paths_linter
: checks that no absolute paths are used.assignment_linter
: checks that <-
is always used for assignmentclosed_curly_linter
: check that closed curly braces should always be on their
own line unless they follow an else.commas_linter
: check that all commas are followed by spaces, but do not
have spaces before them.infix_spaces_linter
: check that all infix operators have spaces around them.line_length_linter
: check the line length of both comments and code is less than
length.no_tab_linter
: check that only spaces are used, never tabs.object_camel_case_linter
: check that function and variable names are not camelCase.object_snake_case_linter
: check that function and variable names are not snake_case.object_multiple_dots_linter
: check that function and variable names are separated by _
rather than .
.object_length_linter
: check that function and variable names are not more than length
characters.open_curly_linter
: check that opening curly braces are never on their own
line and are always followed by a newline.single_quotes_linter
: checks that only single quotes are used to delimit
string contestants.spaces_inside_linter
: check that parentheses and square brackets do not have
spaces directly inside them.spaces_left_parentheses_linter
: check that all left parentheses have a space before them
unless they are in a function call.trailing_blank_lines_linter
: check there are no trailing blank lines.trailing_whitespace_linter
: check there are no trailing whitespace characters.Thanks. I will definitely give it a go.
Thanks to @lbraglia I found jimhester's covr package. IMHO that is really interesting and useful!
definitely. Now i'm using
covr:
${R} -e "library(covr); package_coverage('"$(PKGDIR)"')"
it's fine but would be nice to have a way to display only tests below a given percent treshold (didn't digged too much at the moment)
That's looks fantastic. Will try it, thanks!
A recipe for the brand new lintr
https://github.com/jimhester/lintr