fasterer icon indicating copy to clipboard operation
fasterer copied to clipboard

Feature Request: Line-level Inline Exclusions

Open ChefAustin opened this issue 3 years ago • 5 comments

I think it would be a great enhancement if I was able to disable/exclude a speed suggestion for a specific line via a magic comment (much like how Rubocop does single-instance cop-disablement; # rubocop:disable Metrics/LineLength).

There are times where a single speedup in a given line of code is not applicable and I want to disable the speedup for the line but I don't want to have to add the entire file to the exclude_paths block of .fasterer.yml.

For example, if I have instance whereby I've used Hash#keys.each two times in a single file and one of those two times the hash is modified during the .each block (but the other time, the hash is not modified during the .each block) then I would want fasterer to ignore that singular instance of Hash#keys.each where the hash is modified (while still letting fasterer analyze the other instance of Hash#keys.each where the hash is not modified).

Hopefully this makes sense and seems reasonable!

Thanks for all the work put into fasterer over the years; it has certainly made some of my code... well... fasterer. 😄

ChefAustin avatar Jul 15 '21 13:07 ChefAustin

Hi @ChefAustin! Thanks for the suggestion, I see it is well accepted by looking at the number of upvotes. Do you potentially have the bandwidth to try to do a proof of concept how it would work?

DamirSvrtan avatar Sep 15 '21 02:09 DamirSvrtan

I very much wish I currently had the free time to do a PoC on this feature. I am hoping that in the coming months I might be able to get around to poking at it.

When I do eventually have the time, I'll need to first do a deep-dive into the mechanics of fasterer and see how it works (because, tbh, right now its a bit of a blackbox of awesome magic to me).

ChefAustin avatar Dec 01 '21 09:12 ChefAustin

Sounds good! :) If there isn't any movement on this in the next 6 months, i'll close it out :)

DamirSvrtan avatar Dec 02 '21 07:12 DamirSvrtan

Any chance of merging the open PR that adds this functionality? Currently fasterer is a hammer and both opt-out options are not ideal.

erikng avatar Oct 18 '23 17:10 erikng