Skip to content

handle empty arguments in switch statements - #499

Merged
jimhester merged 5 commits into
r-lib:masterfrom
markromanmiller:master
Jun 23, 2020
Merged

jimhester merged 5 commits into
r-lib:masterfrom
markromanmiller:master

Conversation

@markromanmiller

Copy link
Copy Markdown
Contributor

I've noticed that there was a conflict between the comma spacing linter and the infix operator linter when using switch statements that have fall-through arguments like switch(foo, x = , y = bar, z = baz). If there is a space in the x argument between the = and the ,, then the comma spacing linter complains; if there is no space there the infix operator linter complains.

I consulted the vctrs documentation here (because that's what originally made me use switch) and saw it was written with the space, so I modified the comma linter to allow these types of lines.

I'm happy to take feedback on my approach; I'm not too confident using base R.

@jimhester

Copy link
Copy Markdown
Member

Looks good to me, can you please add a bullet to NEWS? It should briefly describe the change and end with (@yourname, #issuenumber).

@markromanmiller

Copy link
Copy Markdown
Contributor Author

Changes made! Thanks.

@jimhester

Copy link
Copy Markdown
Member

Thanks for working on this!

Thanks!

After your first merged pull request you are automatically invited as a contributor to the lintr project. See #318 (comment) for details on what you can do as a contributor.

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.

2 participants