tonyhffong / Lint.jl

A lint tool for Julia code
Other
168 stars 33 forks source link

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

Open diegozea opened 6 years ago

diegozea commented 6 years ago

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,