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

Infinite correction loop with SpaceAroundOperators and AlignHash with EnforcedStyle table #2565

Closed
jawshooah opened this issue Dec 31, 2015 · 1 comment
Assignees
Labels

Comments

@jawshooah
Copy link
Contributor

SpaceAroundOperators and AlignHash get caught in an infinite correction loop when AlignHash has EnforcedStyle: table.

Here's the file under test:

cask 'adobe-air' do
  version '20.0'
  sha256 :no_check # required as upstream package is updated in-place

  url "https://airdownload.adobe.com/air/mac/download/#{version}/AdobeAIR.dmg"
  name 'Adobe AIR'
  homepage 'https://get.adobe.com/air/'
  license :gratis

  installer :script => 'Adobe AIR Installer.app/Contents/MacOS/Adobe AIR Installer',
            :args   => %w[-silent],
            :sudo   => true

  uninstall :script => {
                         :executable => 'Adobe AIR Installer.app/Contents/MacOS/Adobe AIR Installer',
                         :args       => %w[-uninstall],
                       }
  zap :delete => [
                   '~/Library/Application Support/Adobe/AIR',
                   '~/Library/Caches/com.adobe.air.ApplicationInstaller',
                 ],
      :rmdir  => '~/Library/Application Support/Adobe/'
end

And here's RuboCop's output:

$ bundle exec rubocop --only Style/AlignHash,Style/SpaceAroundOperators --auto-correct -- Casks/adobe-air.rb
Inspecting 1 file
C

Offenses:

Casks/adobe-air.rb:22:7: C: [Corrected] Align the elements of a hash literal if they span more than one line.
      :rmdir => '~/Library/Application Support/Adobe/'
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Casks/adobe-air.rb:22:15: C: [Corrected] Operator => should be surrounded by a single space.
      :rmdir  => '~/Library/Application Support/Adobe/'
              ^^

0 files inspected, 2 offenses detected, 2 offenses corrected
/Users/joshuahagins/dev/github/rubocop/lib/rubocop/runner.rb:183:in `check_for_infinite_loop': Infinite loop detected in /Users/joshuahagins/dev/github/caskroom/homebrew-cask/Casks/adobe-air.rb. (RuboCop::Runner::InfiniteCorrectionLoop)
    from /Users/joshuahagins/dev/github/rubocop/lib/rubocop/runner.rb:154:in `block in do_inspection_loop'
    from /Users/joshuahagins/dev/github/rubocop/lib/rubocop/runner.rb:153:in `loop'
    from /Users/joshuahagins/dev/github/rubocop/lib/rubocop/runner.rb:153:in `do_inspection_loop'
    from /Users/joshuahagins/dev/github/rubocop/lib/rubocop/runner.rb:93:in `process_file'
    from /Users/joshuahagins/dev/github/rubocop/lib/rubocop/runner.rb:58:in `block in inspect_files'
    from /Users/joshuahagins/dev/github/rubocop/lib/rubocop/runner.rb:56:in `each'
    from /Users/joshuahagins/dev/github/rubocop/lib/rubocop/runner.rb:56:in `inspect_files'
    from /Users/joshuahagins/dev/github/rubocop/lib/rubocop/runner.rb:34:in `run'
    from /Users/joshuahagins/dev/github/rubocop/lib/rubocop/cli.rb:28:in `run'
    from /Users/joshuahagins/dev/github/rubocop/bin/rubocop:13:in `block in <top (required)>'
    from /Users/joshuahagins/.rbenv/versions/2.3.0/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
    from /Users/joshuahagins/dev/github/rubocop/bin/rubocop:12:in `<top (required)>'
    from /Users/joshuahagins/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bin/rubocop:23:in `load'
    from /Users/joshuahagins/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bin/rubocop:23:in `<main>'

From my Gemfile.lock:

GIT
  remote: git://github.com/bbatsov/rubocop.git
  revision: ec28c40e9adc74c3aca4800b68d93c9db7779a82
  branch: master
  specs:
    rubocop (0.35.1)
      astrolabe (~> 1.3)
      parser (>= 2.3.0.pre.5, < 3.0)
      powerpack (~> 0.1)
      rainbow (>= 1.99.1, < 3.0)
      ruby-progressbar (~> 1.7)
@jonas054 jonas054 added the bug label Jan 1, 2016
@jonas054 jonas054 self-assigned this Jan 1, 2016
@jonas054
Copy link
Collaborator

jonas054 commented Jan 1, 2016

Confirmed as a bug. I'll try to fix it. We should let SpaceAroundOperators stay away from hash literals, like we do in ExtraSpacing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants