You thought you had no dead code?

You thought you had no dead code in your project? Think again.

I just released a (huge) patch version for elm-review-unused, that should find a lot more dead code than before :broom:

Read more about that in the link below.

You can try it out like this:

npx elm-review --template jfmengels/elm-review-unused/example

Then if you want to adopt it, use it with init

npx elm-review init --template jfmengels/elm-review-unused/example

Enjoy the cleaning up, and please let me know if or how much dead code this patch found!

19 Likes

That look like a huge release indeed! I have one question about that rule:

Let declarations assigned to _ will now be reported and removed.

I think I’m only doing this when I need to call Debug.log is there special casing for that? Or is it considered a temporary state anyway, and once debugging is done the rule can help cleaning up?

Yes, it’s about cleaning up. I do the same thing you do.

Previously we were not reporting those, and it wasn’t because I forgot about handling that case. Thankfully, in most cases, it was reporting by the NoDebug.Log rule because in more than 90% of cases that’s what _ = ... was used for.

But at some point I introduced an autofix for NoDebug.Log which removes all Debug.log calls, which was very nice, but that would sometimes get you from _ = Debug.log "thing" thing to _ = thing and then it would remain like that.

So this change just makes sure the last step of removing _ = thing is done (though in practice the Debug.log step will be skipped).

Really cool to see so many improvements to NoUnused!

The removal of _ = ... got me and a colleague to both react with “Noooooo…” (in a funny positive way) because that’s our escape hatch when we want to temporarily keep around some unused code. We’ll probably use to the ignore file feature instead now.

1 Like

A few bugs were reported on the Elm Slack and in the repo’s issues, and have been fixed in the latest 1.1.6 release. I hope we’re back to users being able to being able to blindly trust elm-review! If you do still encounter some problems, please open up an issue and a way to reproduce the problem!

It also includes the resolving of a false negative, so you may encounter new reported issues :slightly_smiling_face:

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.