prontolabs / pronto-rubocop

Pronto runner for Rubocop, ruby code analyzer
MIT License
83 stars 74 forks source link

Bundler/OrderedGems error is not detected #43

Closed YusukeIwaki closed 3 years ago

YusukeIwaki commented 5 years ago

I'm using Bundle/OrderedGems rule in my project.

When a gem is added to Gemfile, like below:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.3'

gem 'bcrypt', '~> 3.1.7'
gem 'bootsnap', '>= 1.1.0', require: false
gem 'jbuilder', '~> 2.5'
gem 'mysql2', '~> 0.5.2'
gem 'puma', '~> 3.11'
gem 'rails', '~> 5.2.2'
gem 'file_validators' # <-- added line

bundle exec rubocop shows a error:

Gemfile:13:1: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem file_validators should appear before rails.
gem 'file_validators' # <-- added line
^^^^^^^^^^^^^^^^^^^^^

however with pronto-rubocop, it is now shown...

# pronto run --runner=rubocop --commit=<base commit>

How can I show error with pronto-rubocop? 🤔

Thanks

doomspork commented 5 years ago

@YusukeIwaki can you confirm the rubocop versions you're using locally and we use in this package are the same?

sunny commented 5 years ago

It seems that this does not work since it depends on pronto's Runner#ruby_patches method which doesn't include Gemfiles.

I've pushed a PR to pronto which should fix this issue: https://github.com/prontolabs/pronto/pull/344

doomspork commented 5 years ago

Awesome @YusukeIwaki! Thank you. Your PR looks great. I'll give the other @prontolabs/core folks a day or so to comment before merging it.

ashkulz commented 3 years ago

This should be now available with the 0.11.0 release.