Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[reek] change config to ignore some pain points #1

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ruby/reek/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ detectors:
ManualDispatch:
enabled: true
exclude: []
# Not really useful and ignored a lot.
MissingSafeMethod:
enabled: true
enabled: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bang means that the method is the dangerous version and that a safe version exist.
bang mean that there is a preferable and less dangerous version of the method.
Instead of remove this metric, just stop to use bang.

concat is a good example in ruby. It modify the receiver like map! or other methods with bang.
It is name concat and not concat!. There is not link between the modification of the receiver and the bang.

https://www.rubydoc.info/github/troessner/reek/Reek/Smells/PrimaDonnaMethod

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know but this is not followed at all in our codebase. It currently makes noise everywhere.

exclude: []
ModuleInitialize:
enabled: true
Expand Down Expand Up @@ -143,4 +144,4 @@ detectors:
UtilityFunction:
enabled: true
exclude: []
public_methods_only: false
public_methods_only: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no change here. Do you want to change to public_methods_only: true?
It may be acceptable but I think we often use functional method that could be extract in a module.
For example, it is preferable to extract method that serialize or build an object because it is a specific responsibility.

UtilityFunction shows that there is a mix of responsibilities.

Copy link
Author

@foliea foliea Dec 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this one is not working properly. e.g Using a map on an instance variable and then using a method inside will trigger this cop. There is an issue open for a while on reek repository for that but currently this is a major bug IMO (check alice link above).