Skip to content

enable open_curly_linter in .lintr #613

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

Merged
merged 7 commits into from
Nov 29, 2020
Merged

enable open_curly_linter in .lintr #613

merged 7 commits into from
Nov 29, 2020

Conversation

MichaelChirico
Copy link
Collaborator

@MichaelChirico MichaelChirico commented Nov 28, 2020

Closes #596

There are already no lints for this linter, we just need to enable it in the options:

lintr::lint_package(linters = lintr::open_curly_linter)
# returns nothing

@AshesITR
Copy link
Collaborator

This is already part of the default linters, no need to manually add it.

@lintr-bot
Copy link

R/expect_lint.R:54:28: style: Opening curly braces should never go on their own line and should always be followed by a new line.

lint_str <- if (n_lints) {paste0(c("", lints), collapse="\n")} else {""}
                           ^

R/expect_lint.R:54:71: style: Opening curly braces should never go on their own line and should always be followed by a new line.

lint_str <- if (n_lints) {paste0(c("", lints), collapse="\n")} else {""}
                                                                      ^

R/get_source_expressions.R:46:5: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​    {
    ^

R/get_source_expressions.R:319:44: style: Opening curly braces should never go on their own line and should always be followed by a new line.

tab_cols <- lapply(tab_cols, function(x) {if (x[[1L]] < 0L) {NA} else {x}})
                                           ^

R/get_source_expressions.R:319:63: style: Opening curly braces should never go on their own line and should always be followed by a new line.

tab_cols <- lapply(tab_cols, function(x) {if (x[[1L]] < 0L) {NA} else {x}})
                                                              ^

R/get_source_expressions.R:319:73: style: Opening curly braces should never go on their own line and should always be followed by a new line.

tab_cols <- lapply(tab_cols, function(x) {if (x[[1L]] < 0L) {NA} else {x}})
                                                                        ^

R/spaces_inside_linter.R:43:72: style: Opening curly braces should never go on their own line and should always be followed by a new line.

column_number = if (substr(line, start, start) == " ") {start} else {start + 1L},
                                                                       ^

R/spaces_inside_linter.R:43:85: style: Opening curly braces should never go on their own line and should always be followed by a new line.

column_number = if (substr(line, start, start) == " ") {start} else {start + 1L},
                                                                                    ^

R/unneeded_concatenation_linter.R:24:35: style: Opening curly braces should never go on their own line and should always be followed by a new line.

message = if (num_args) {msg_const} else {msg_empty},
                                  ^

R/unneeded_concatenation_linter.R:24:52: style: Opening curly braces should never go on their own line and should always be followed by a new line.

message = if (num_args) {msg_const} else {msg_empty},
                                                   ^

@MichaelChirico
Copy link
Collaborator Author

MichaelChirico commented Nov 29, 2020

Hmm, the linter bot seems to have found lints that the command in the issue did not:

lintr::lint_package(linters = lintr::open_curly_linter)

This also didn't detect those lints that the bot found:

setwd('R'); for (f in list.files()) print(lintr::lint(f, lintr::open_curly_linter))

The lints look correct though, any idea?

@MichaelChirico
Copy link
Collaborator Author

Well, I can reproduce locally with this at least:

Rscript -e "lintr::lint_package('.')"

with the new settings. I'll edit the issue descriptions...

@lintr-bot
Copy link

R/get_source_expressions.R:318:44: style: Opening curly braces should never go on their own line and should always be followed by a new line.

tab_cols <- lapply(tab_cols, function(x) {if (x[[1L]] < 0L) NA else x})
                                           ^

@AshesITR AshesITR merged commit a4b04f9 into master Nov 29, 2020
@AshesITR AshesITR deleted the enable-open-curly branch November 29, 2020 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make R/ conform to open_curly_linter
3 participants