airbnb / ruby

Ruby Style Guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AutoCorrect Bug

danielfahy opened this issue · comments

Hi there!

I'm not sure if autocorrect functionality is even supposed to be maintained by this gem as I don't see it in the readme.

However I wanted to open this issue to demonstrate an problem I have been getting when trying to use autocorrect with this gem loaded into my project.

Thanks for your time
-Dan

110 files inspected, 237 offenses detected, 126 offenses corrected
undefined method `range_by_whole_lines' for #<RuboCop::Cop::RSpec::LeadingSubject:0x007fc0d0ae2098>
/Library/Ruby/Gems/2.3.0/gems/rubocop-rspec-1.22.1/lib/rubocop/cop/rspec/leading_subject.rb:65:in `node_range'
/Library/Ruby/Gems/2.3.0/gems/rubocop-rspec-1.22.1/lib/rubocop/cop/rspec/leading_subject.rb:50:in `block in autocorrect'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cop/corrector.rb:61:in `block (2 levels) in rewrite'
/Library/Ruby/Gems/2.3.0/gems/parser-2.5.1.0/lib/parser/source/tree_rewriter.rb:220:in `transaction'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cop/corrector.rb:60:in `block in rewrite'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cop/corrector.rb:58:in `each'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cop/corrector.rb:58:in `rewrite'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cop/team.rb:126:in `autocorrect_all_cops'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cop/team.rb:70:in `autocorrect'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cop/team.rb:98:in `block in offenses'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cop/team.rb:115:in `investigate'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cop/team.rb:94:in `offenses'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cop/team.rb:44:in `inspect_file'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:265:in `inspect_file'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:212:in `block in do_inspection_loop'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:244:in `block in iterate_until_no_changes'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:237:in `loop'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:237:in `iterate_until_no_changes'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:208:in `do_inspection_loop'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:111:in `block in file_offenses'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:129:in `file_offense_cache'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:109:in `file_offenses'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:100:in `process_file'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:78:in `block in each_inspected_file'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:75:in `each'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:75:in `reduce'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:75:in `each_inspected_file'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:67:in `inspect_files'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/runner.rb:39:in `run'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cli.rb:160:in `execute_runner'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cli.rb:88:in `execute_runners'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/lib/rubocop/cli.rb:41:in `run'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/exe/rubocop:13:in `block in <top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
/Library/Ruby/Gems/2.3.0/gems/rubocop-0.57.2/exe/rubocop:12:in `<top (required)>'
/usr/local/bin/rubocop:22:in `load'
/usr/local/bin/rubocop:22:in `<main>'

In the latest version of Rubocop-Airbnb I upgraded rubocop but didn't also upgrade Rubocop-Rspec.

I think that's what's causing the issue I'll get a version out today to upgrade Rubocop-Rspec

Fantastic thank you so much

Thanks for reporting, just pushed the updated version

Thanks for the speedy fix!

Just ran the glorious rubocop -a command and it worked perfectly :)