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

OK to do case-insensitive checks on the OrderedGems cop? #3802

Closed
breckenedge opened this issue Dec 19, 2016 · 1 comment
Closed

OK to do case-insensitive checks on the OrderedGems cop? #3802

breckenedge opened this issue Dec 19, 2016 · 1 comment
Labels
enhancement good first issue Easy task, suitable for newcomers to the project

Comments

@breckenedge
Copy link
Contributor

breckenedge commented Dec 19, 2016

I love the new OrderedGems cop, it's a fantastic idea!

However, the OrderedGems cop uses the < sign to perform its comparison, and I have one pesky dependency that starts with a capital letter (the wonderful-yet-inconsistently-named StreetAddress gem). Since 'a' < 'Z' #=> false, it wants to sort this dependency at the top of my Gemfile. Would it be acceptable to write a PR that performs a case-insensitive comparison?


Expected behavior

The OrderedGems cop doesn't consider case when checking the Gemfile.

Actual behavior

The OrderedGems cop considers case when checking the Gemfile.

Steps to reproduce the problem

# in Gemfile
source 'https://rubygems.org'
gem 'sinatra'
gem 'StreetAddress'
rubocop
Inspecting 1 file
C

Offenses:

Gemfile:4:1: C: Gem StreetAddress should appear before sinatra in their gem group.
gem 'StreetAddress'
^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected

RuboCop version

$ rubocop -V
0.46.0 (using Parser 2.3.3.1, running on ruby 2.3.1 x86_64-darwin16)
@bbatsov
Copy link
Collaborator

bbatsov commented Dec 20, 2016

Make sense to me. Although I'd also suggest to the gem author to rename this, so it would match common conventions.

@bbatsov bbatsov added enhancement good first issue Easy task, suitable for newcomers to the project labels Dec 20, 2016
breckenedge added a commit to breckenedge/rubocop that referenced this issue Dec 21, 2016
Updates the Bundler/OrderedGems cop to not consider case when checking
if a Gemfile is alphabetized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Easy task, suitable for newcomers to the project
Projects
None yet
Development

No branches or pull requests

2 participants