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

[R-package] standardize style for placement of braces #5240

Merged
merged 1 commit into from
May 24, 2022

Conversation

jameslamb
Copy link
Collaborator

In preparation for the release of {lintr} 3.0.0 (#5228), this PR proposes changes to the placement of braces in the project's R code.

Without these changes, {lintr} 3.0.0 will return the following findings:

LightGBM/R-package/R/lgb.convert_with_rules.R:7:33: style: Opening curly braces should never go on their own line and should always be followed by a new line.
            , FUN = function(x) {paste0(class(x), collapse = ",")}
                                ^
LightGBM/R-package/R/lgb.convert_with_rules.R:7:66: style: Closing curly-braces should always be on their own line, unless they are followed by an else.
            , FUN = function(x) {paste0(class(x), collapse = ",")}
                                                                 ^
LightGBM/R-package/R/lgb.convert_with_rules.R:43:51: style: Opening curly braces should never go on their own line and should always be followed by a new line.
.LGB_CONVERT_DEFAULT_FOR_LOGICAL_NA <- function() {return(-1L)}
                                                  ^
LightGBM/R-package/R/lgb.convert_with_rules.R:43:63: style: Closing curly-braces should always be on their own line, unless they are followed by an else.
.LGB_CONVERT_DEFAULT_FOR_LOGICAL_NA <- function() {return(-1L)}
                                                              ^
LightGBM/R-package/R/lgb.convert_with_rules.R:44:55: style: Opening curly braces should never go on their own line and should always be followed by a new line.
.LGB_CONVERT_DEFAULT_FOR_NON_LOGICAL_NA <- function() {return(0L)}
                                                      ^
LightGBM/R-package/R/lgb.convert_with_rules.R:44:66: style: Closing curly-braces should always be on their own line, unless they are followed by an else.
.LGB_CONVERT_DEFAULT_FOR_NON_LOGICAL_NA <- function() {return(0L)}
                                                                 ^
LightGBM/R-package/R/utils.R:72:58: style: Opening curly braces should never go on their own line and should always be followed by a new line.
    if (!all(sapply(interaction_constraints, function(x) {is.character(x) || is.numeric(x)}))) {
                                                         ^
LightGBM/R-package/tests/testthat/test_learning_to_rank.R:52:55: style: Opening curly braces should never go on their own line and should always be followed by a new line.
    expect_identical(sapply(eval_results, function(x) {x$name}), eval_names)
                                                      ^
LightGBM/R-package/tests/testthat/test_lgb.Booster.R:1206:20: style: Opening curly braces should never go on their own line and should always be followed by a new line.
    expect_warning({bst2 <- readRDS.lgb.Booster(file = model_file)})

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants