troessner / reek

Code smell detector for Ruby
https://github.com/troessner/reek
MIT License
4.05k stars 280 forks source link

Getting rid of the gazillions of constants for the parameter keys #332

Closed troessner closed 9 years ago

troessner commented 9 years ago

Extracted from here: #328


Getting rid of the gazillions of constants for the parameter keys that are floating around in almost every smell detector and that used and spread across our spec suite

mvz commented 9 years ago

Is there actually any external use for these extra parameters? Why would smell class, source, context, lines, and message not be enough information?

troessner commented 9 years ago

Is there actually any external use for these extra parameters?

AFAIS -> no.

Why would smell class, source, context, lines, and message not be enough information?

Can't think of any reason as well. I'll whip up a PR for further discussion.

troessner commented 9 years ago

Addendum: I believe that those constants were only introduced for spec'ing reasons and / or the reek matchers. And I do agree that doing something like https://github.com/troessner/reek/blob/master/spec/reek/smells/data_clump_spec.rb#L153 is quite handy. But I believe that we still can get rid of all those constants by just using a couple of standard keys. E.g. "name" and "count" would already be enough for > 90% of all current smells and the remaining 10% can be handled with 2 or 3 more keys. I'll start out with a PR and then let's see where this leads us.:)

troessner commented 9 years ago

fyi, will start to work on this next week in combination with https://github.com/troessner/reek/issues/330 since this will imply a major spec overhaul as well (at least for the specs for smells/ )