Lint.jl icon indicating copy to clipboard operation
Lint.jl copied to clipboard

Advise on the use of ! (bang) for mutating functions

Open diegozea opened this issue 6 years ago • 0 comments

Hi!

I would be great if Lint.jl could catch situations where mutating functions are not named with the bang at the end.

i.e.

my_fill(x) = fill!(x, zero(eltype(x)))

function add_one(x)
    for i in 1:length(x)
        x[i] = x[i] + one(eltype(x))
    end
    x
end

These functions should be named my_fill! and add_one! instead.

Best regards,

diegozea avatar Dec 20 '17 13:12 diegozea