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

Ship default .rubocop.yml #3731

Merged
merged 2 commits into from Jun 16, 2020

Conversation

utkarsh2102
Copy link
Contributor

@utkarsh2102 utkarsh2102 commented Jun 16, 2020

Description:

Currently, there is no .rubocop.yml shipped by default.
So when a user runs rubocop after creating a new gem via bundle gem foo, it throws a bunch of offenses.

With the default .rubocop.yml present, the number of those offenses significantly reduce by 25.

What was the end-user or developer problem that led to this PR?

A bunch of offenses thrown by rubocop since there's no default .rubocop.yml file.

What is your fix for the problem, implemented in this PR?

This PR adds a default .rubocop.yml file.


Tasks:

  • Describe the problem / feature
  • Write tests
  • Write code to solve the problem
  • Get code review from coworkers / friends

I will abide by the code of conduct.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

@welcome
Copy link

welcome bot commented Jun 16, 2020

Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality.

We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below.

If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems or #bundler channel on Slack.

For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide

@bronzdoc
Copy link
Member

Thanks for the PR @utkarsh2102!

What other cops are need to reduce it to 0?

@utkarsh2102
Copy link
Contributor Author

Hi @bronzdoc,

What other cops are need to reduce it to 0?

The other things that can bring down the offenses are mostly add frozen string literal comment, using double-quotes in some places, freezing a constant, and some other small things.
I can create another PR if you'd like to get them fixed, too? 😄

@utkarsh2102
Copy link
Contributor Author

Hi @deivid-rodriguez,
I see your #3728 to remove hidden files, d'you want me to do the same here?
I suppose so? 🙈

@deivid-rodriguez
Copy link
Member

Yes, please!

Copy link
Member

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

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

This is great, I always wanted to do this but never got to it!

bundler/lib/bundler/templates/newgem/.rubocop.yml.tt Outdated Show resolved Hide resolved
@bronzdoc
Copy link
Member

@utkarsh2102 I think if we are adding a default its better if we add all the cops that will reduce the offenses to 0 in this PR.

Currently, there is no `.rubocop.yml` shipped by default.
So when a user runs `rubocop` after creating a new gem via
`bundle gem foo`, it throws a bunch of offenses.

With the default `.rubocop.yml` present, the number of those
offenses significantly reduce by 25.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
Copy link
Member

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

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

Looks good to me! I believe we can iterate later to remove all offenses. But if @bronzdoc wants to do that here and you're ok with doing it, go ahead! 👍

@utkarsh2102
Copy link
Contributor Author

Thanks!
@bronzdoc, I can create another PR (soon!) to address those issues as well 😄

@deivid-rodriguez
Copy link
Member

Thanks @utkarsh2102!!

@deivid-rodriguez deivid-rodriguez merged commit 8c1702f into rubygems:master Jun 16, 2020
@utkarsh2102 utkarsh2102 deleted the ship-rubocop.yml branch June 16, 2020 15:20
utkarsh2102 added a commit to utkarsh2102/rubygems that referenced this pull request Jun 19, 2020
These offenses appear when you create a gem with
`bundle gem foo` and run `rubocop` over it.

Initially, there were around 45 offenses detected,
but with rubygems#3731 and this, the number of offenses
have been reduced to 2.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
@utkarsh2102 utkarsh2102 mentioned this pull request Jun 19, 2020
4 tasks
utkarsh2102 added a commit to utkarsh2102/rubygems that referenced this pull request Jun 19, 2020
These offenses appear when you create a gem with
`bundle gem foo` and run `rubocop` over it.

Initially, there were around 45 offenses detected,
but with rubygems#3731 and this, the number of offenses
have been reduced to 2.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
utkarsh2102 added a commit to utkarsh2102/rubygems that referenced this pull request Jun 20, 2020
These offenses appear when you create a gem with
`bundle gem foo` and run `rubocop` over it.

Initially, there were around 45 offenses detected,
but with rubygems#3731 and this, the number of offenses
have been reduced to 2.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
utkarsh2102 added a commit to utkarsh2102/rubygems that referenced this pull request Jun 21, 2020
These offenses appear when you create a gem with
`bundle gem foo` and run `rubocop` over it.

Initially, there were around 45 offenses detected,
but with rubygems#3731 and this, the number of offenses
have been reduced to 2.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
utkarsh2102 added a commit to utkarsh2102/rubygems that referenced this pull request Jun 30, 2020
With rubygems#3731 and rubygems#3740 merged, this covers up the
remaining part of the issues.
This was discovered when one tries to create a gem
with a different framework.
Could be reproduced with:
`bundle gem foo --ext --test=test-unit`

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
@utkarsh2102 utkarsh2102 mentioned this pull request Jun 30, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants