Skip to content

curly braces linter and comments #188

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

Closed
wamserma opened this issue Dec 12, 2016 · 2 comments
Closed

curly braces linter and comments #188

wamserma opened this issue Dec 12, 2016 · 2 comments
Labels
feature a feature request or enhancement

Comments

@wamserma
Copy link

The curly braces linter wants a newline after an opening curly brace, not accepting comments there.

Example

if ("P" != "NP") { # what most people expect
    print("Cryptomania is possible")
} else { # what would make a lot of people sad
    print("we live in Algorithmica")
}

lintr output:

R\test.R:7:22: style: Opening curly braces should never go on their own line and should always be followed by a new line.
    if ("P" != "NP") { # what most people expect
                     ^
R\test.R:9:12: style: Opening curly braces should never go on their own line and should always be followed by a new line.
    } else { # what would make a lot of people sad
@fangly
Copy link
Contributor

fangly commented Jan 27, 2017

Another case where open_curly_linter() fails, in my opinion, is with standalone code blocks (without leading if/for/while/repeat):

withr::with_options(
     list(verbose=TRUE),
     {
         print("hello")
         print("world")
     }
)

@prosoitos
Copy link
Contributor

prosoitos commented Apr 1, 2018

I second @wamserma (almost posted a duplicate to this by accident actually 😛 ).

In the meantime, I am using

if ("P" != "NP") {
                                        # what most people expect
    print("Cryptomania is possible")
} else {
                                        # what would make a lot of people sad
    print("we live in Algorithmica")
}

and maybe it makes it more readable???

@jimhester jimhester added the feature a feature request or enhancement label Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants