No hidden units #69
Replies: 6 comments
-
|
Beta Was this translation helpful? Give feedback.
-
Would this conflict with
I think that if you want to find every case, you need type inference. foo : ( () -> something) -> something
foo = something
bar = foo (\_ -> 1) -- We would report it, because we know that the first argument of `foo` is a function whose first argument is () Also this one would be easy to report if there is a type annotation: foo : () -> something
foo _ = -- Report this one here
something
I might, but I'm leaning towards not. I feel like this adds little value. In most cases, when the argument is I feel like being pedantic about this is not necessarily worth it, since the "brought value" divided by "annoyance it can give coworkers" ratio is quite low. I imagine that having an automatic fix would help out here. Performance is more and more an issue for me also, as I am working on a big code-base (~160k LoC), where every additional rules adds maybe like 100ms/200ms (for simple ones. Very rough estimates), so it's unwise to multiply the rules, especially when they bring little value.
As @MartinSStewart said, it's a nitpick. I agree that these could be combined into a |
Beta Was this translation helpful? Give feedback.
-
I don't believe that this would conflict with either of those, they're looking for names that are unused, and consolidating some useless patterns, but unit wasn't one of them.
That's a very fair point - I'm not working with anything like that scale, most of my projects are relatively small, so at the moment this would give me some value, but I can see where that trade-off might come in to play (I'll add it to the list of when not to use this). |
Beta Was this translation helpful? Give feedback.
-
I'm guessing this is caused by overhead for each rule? Could the logic for lots of nitpick rules be merged together into a single rule to improve performance? |
Beta Was this translation helpful? Give feedback.
-
I've been pondering this for a little while now - there may be some nitpick rules that could be merged together, but I think you'd probably lose readability of the rule as a trade-off. |
Beta Was this translation helpful? Give feedback.
-
Probably. It's hard for me to tell at this point. I think that it's better to leave performance to the tool, and to keep each rule look at its own thing. |
Beta Was this translation helpful? Give feedback.
-
Forbid using
_
in place of()
- it's valuable to know when a pattern is meant to be a unit and it could be hiding the fact that you're missing data when it's not a unit (perhaps you refactored away from the unit).One place this comes up is in tests:
Another might be unused flags passed to an init function:
When (not) to enable this rule:
I am looking for:
Beta Was this translation helpful? Give feedback.
All reactions