Skip to content

seq_linter() could optionally lint all 1:<non-literal> usage #1927

@MichaelChirico

Description

@MichaelChirico

I think that a large portion of 1:<non-literal> usages should be replaced by seq_len(<non-literal>). In practice it's often as simple as:

size <- length(x)
for (i in 1:size) { }

1:10 should still be allowed as seq_len(10) is probably overkill.

I'm tempted to turn this on by default, but I'm OK with a more conservative approach to leave this under an option that's off by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions