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

Replace some trivial Rubocop checks with more meaningful Reek checks. #67

Merged
merged 1 commit into from
Dec 15, 2020

Conversation

fhwang
Copy link
Contributor

@fhwang fhwang commented Dec 14, 2020

Our Ruby static analysis makes extensive use of Rubocop, but in my opinion Reek is a superior analysis tool for Ruby: It offers sophisticated checks that point the way towards better object-oriented design, as opposed to the more superficial analysis style of Rubocop.

This PR is a suggested way to adopt Reek: By taking on some of its checks, and at the same time removing some Rubocop checks that are relatively low value. The goal here is to keep roughly the same amount of static analysis strictness, but refocusing developer effort on deeper analysis of OO design.

As a proof of concept I've run these changes on velocity here: https://codeclimate.com/repos/59f12f7da7c8dc02c00011be/pull/12377

Copy link
Contributor

@filipesperandio filipesperandio left a comment

Choose a reason for hiding this comment

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

I am up to give it a try!

@@ -56,6 +56,41 @@ inherit_from: rails_rubocop.yml
# project-specific configuration...
```

## Reek

Every project should start with the `reek.yml` present here. It should
Copy link
Contributor

Choose a reason for hiding this comment

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

Guess we should keep the dot to avoid confusion.

Suggested change
Every project should start with the `reek.yml` present here. It should
Every project should start with the `.reek.yml` present here. It should

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's referring to the file in this repo, though, not the name it'll get when pulled into a project.

Comment on lines +80 to +82
Reek has strong opinions about object-orientation that many find
overaggressive in some parts of codebases where OO design is less
important. You may find these common exclusions to be helpful:
Copy link

Choose a reason for hiding this comment

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

This was my main thought when I saw this PR. What you wrote here hits home for me. I think of reek as valuable, specially for growing teams. It helps drive some level of quality for some standards without too much PR micromanagement.

In some aspects, though, it's like a very purist tool. In some cases we need to make an executive decision to sacrifice something for a benefit somewhere else, and in those moments I found reek to be annoying.

I'm interested in the list of rules you set up, it looks like you gave it some thought and also recognize that it's aggressive so I'm quite interested 😄

Copy link
Member

@larkinscott larkinscott left a comment

Choose a reason for hiding this comment

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

+1 on giving this a try. Thanks for adding this!

Copy link

@samdallas samdallas left a comment

Choose a reason for hiding this comment

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

This looks cool! is it possible to add instructions for running this locally to the readme? I think especially as we get used to it, it would be helpful to be able to check output locally before pushing to a PR.

@wfleming
Copy link
Contributor

@samdallas it's funny you should ask about that, because up until now I think we just assumed everyone would know about running the Quality CLI locally because it was the product we worked on all the time.

You can read instructions for installing the CLI at https://github.com/codeclimate/codeclimate. Once it's installed, you can fetch any shared config files by running codeclimate prepare from within a project, and then codeclimate analyze to run analysis (on the whole project - there are flags available to run specific plugins or only check specific files).

@samdallas
Copy link

@wfleming thank you! 🤯 I didn't know that was possible!

Copy link

@ale7714 ale7714 left a comment

Choose a reason for hiding this comment

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

Thank you Francis! We should totally try this changes :)

@fhwang fhwang merged commit dd9aec8 into master Dec 15, 2020
@fhwang fhwang deleted the fh-reek branch December 15, 2020 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants