Skip to content

lintr does not like for loop bodies with a single line and no braces #2564

Closed
@rlaboiss

Description

@rlaboiss

R accepts single-line bodies, without curly braces, for theif and the for statements.

Is there any reason why lintr accepts that for if but not for for? For instance:

> lint("if (TRUE)\n  x")
> lint("for (i in 0)\n  x")
<text>:2:2: style: [indentation_linter] Indentation should be 0 spaces but is 2 spaces.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions