Rule for no "NoOp" expressions #53
Replies: 8 comments
-
It could also make sense to reduce the scope. My guess would be that only looking for Maybe it would make sense to have rule that only deals with
|
Beta Was this translation helpful? Give feedback.
-
True, the I'm not certain about recommending if someFunction "a" 5 15 == False then vs if not (someFunction "a" 5 15) then or if someFunction "a" 5 15 |> not then Good point about swapping the order of the sub-expressions in the |
Beta Was this translation helpful? Give feedback.
-
Could you recommend that Other useless maths that might also fit... Here's a bunch of unpublished rules that would cover cons and concat of lists, the later two have some pretty good fixes baked in too! With regards to the |
Beta Was this translation helpful? Give feedback.
-
For more simplification ideas, check out the fsharplint hints: https://github.com/fsprojects/FSharpLint/blob/0007ec1e83a1043d74bcd5a0067c6483657faa26/src/FSharpLint.Core/DefaultConfiguration.json#L271-L397 |
Beta Was this translation helpful? Give feedback.
-
I agree that you could highlight Failureif something == False then -- or: if not something then
bish
else if somethingElse then
bash
else
bosh Successif something then
if somethingElse then
bash
else
bosh
else
bish |
Beta Was this translation helpful? Give feedback.
-
This leads to the possibility of simplifying more complicated boolean expressions, but perhaps that's a discussion for another issue? E.g., |
Beta Was this translation helpful? Give feedback.
-
I think flipping |
Beta Was this translation helpful? Give feedback.
-
Implemented as part of https://package.elm-lang.org/packages/jfmengels/elm-review-simplify/latest/Simplify |
Beta Was this translation helpful? Give feedback.
-
What the rule should do: Remove code that is effectively a noop.
Example of things the rule would report:
Example of things the rule would not report:
I am looking for:
Ideally someone who will do the work for me :)
But otherwise this is just so I don't forget about this so I can get around to doing it sometime.
I've also posted the issue here jfmengels/elm-review-simplify#1 as I think this would be a good place for this rule to exist.
Beta Was this translation helpful? Give feedback.
All reactions