Skip to content

Add lint for for i=1:length(v) #337

@non-Jedi

Description

@non-Jedi

After reading https://yuri.is/not-julia/, one takeaway is that this pattern is a frequent source of bugs when combined with OffsetArrays (especially with the use of @inbounds). In almost all cases, 1:length(v) should be replaced with eachindex(v). If there's worry that this lint would be too intrusive for cases where you really want to iterate over the length of an array rather than its indices, this lint could be conditional on @inbounds being present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions