guard-rubocop 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +8 -4
- data/guard-rubocop.gemspec +1 -1
- data/lib/guard/rubocop.rb +2 -2
- data/lib/guard/rubocop/runner.rb +1 -0
- data/lib/guard/rubocop/version.rb +2 -2
- data/spec/guard/rubocop/runner_spec.rb +12 -8
- data/spec/guard/rubocop_spec.rb +9 -6
- metadata +5 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: aa248932e68a78aa1fc24ae53d4d300b71640a11
         | 
| 4 | 
            +
              data.tar.gz: d23806def0e10055e1aa4988dcd0138a4fa9d43a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: fc9f0a685b407939a1d8ea48498d0b5be5f1886c9108281f712cb5d0cc39fb7acad86d33cf8f9fe5a0f8211c716a10178682f457c9188e6529fcfaf2a32220d5
         | 
| 7 | 
            +
              data.tar.gz: d00ac9dee7125d9b4fa215953121376d2dcce500a5261e58066748732454574b1c5768c74c88798bf27c1a67ead7c64d3aa197b155360a73b9f5736d23cab798
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -2,6 +2,10 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            ## Development
         | 
| 4 4 |  | 
| 5 | 
            +
            ## v1.1.0
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            * Use RuboCop's `--force-exclusion` option to always ignore files specified in the `Exclude` configuration in `.rubocop.yml`
         | 
| 8 | 
            +
             | 
| 5 9 | 
             
            ## v1.0.2
         | 
| 6 10 |  | 
| 7 11 | 
             
            * Support both spelling “offense” (RuboCop 0.19 or later) and “offence” (prior to RuboCop 0.19) ([rubocop#700](https://github.com/bbatsov/rubocop/issues/700))
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,8 +1,12 @@ | |
| 1 | 
            -
            [](http://badge.fury.io/rb/guard-rubocop)
         | 
| 2 | 
            +
            [](https://gemnasium.com/yujinakayama/guard-rubocop)
         | 
| 3 | 
            +
            [](https://travis-ci.org/yujinakayama/guard-rubocop)
         | 
| 4 | 
            +
            [](https://coveralls.io/r/yujinakayama/guard-rubocop)
         | 
| 5 | 
            +
            [](https://codeclimate.com/github/yujinakayama/guard-rubocop)
         | 
| 2 6 |  | 
| 3 | 
            -
            #  | 
| 7 | 
            +
            # guard-rubocop
         | 
| 4 8 |  | 
| 5 | 
            -
             | 
| 9 | 
            +
            **guard-rubocop** allows you to automatically check Ruby code style with [RuboCop](https://github.com/bbatsov/rubocop) when files are modified.
         | 
| 6 10 |  | 
| 7 11 | 
             
            Tested on MRI 1.9, 2.0, 2.1, JRuby in 1.9 mode and Rubinius.
         | 
| 8 12 |  | 
| @@ -102,6 +106,6 @@ Note: You need to use `guard-rspec` 4.2.3 or later due to a [bug](https://github | |
| 102 106 |  | 
| 103 107 | 
             
            ## License
         | 
| 104 108 |  | 
| 105 | 
            -
            Copyright (c) 2013 Yuji Nakayama
         | 
| 109 | 
            +
            Copyright (c) 2013–2014 Yuji Nakayama
         | 
| 106 110 |  | 
| 107 111 | 
             
            See the [LICENSE.txt](LICENSE.txt) for details.
         | 
    
        data/guard-rubocop.gemspec
    CHANGED
    
    | @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| | |
| 21 21 | 
             
              spec.require_paths = ['lib']
         | 
| 22 22 |  | 
| 23 23 | 
             
              spec.add_runtime_dependency 'guard',   '~> 2.0'
         | 
| 24 | 
            -
              spec.add_runtime_dependency 'rubocop', '~> 0. | 
| 24 | 
            +
              spec.add_runtime_dependency 'rubocop', '~> 0.20'
         | 
| 25 25 |  | 
| 26 26 | 
             
              spec.add_development_dependency 'bundler',     '~> 1.3'
         | 
| 27 27 | 
             
              spec.add_development_dependency 'rake',        '~> 10.0'
         | 
    
        data/lib/guard/rubocop.rb
    CHANGED
    
    | @@ -65,7 +65,7 @@ module Guard | |
| 65 65 | 
             
                  @failed_paths = runner.failed_paths
         | 
| 66 66 | 
             
                  throw :task_has_failed unless passed
         | 
| 67 67 | 
             
                rescue => error
         | 
| 68 | 
            -
                  UI.error 'The following exception occurred while running guard-rubocop: '  | 
| 68 | 
            +
                  UI.error 'The following exception occurred while running guard-rubocop: ' \
         | 
| 69 69 | 
             
                           "#{error.backtrace.first} #{error.message} (#{error.class.name})"
         | 
| 70 70 | 
             
                end
         | 
| 71 71 |  | 
| @@ -74,7 +74,7 @@ module Guard | |
| 74 74 | 
             
                  paths.map! { |path| File.expand_path(path) }
         | 
| 75 75 | 
             
                  paths.uniq!
         | 
| 76 76 | 
             
                  paths.reject! do |path|
         | 
| 77 | 
            -
                    next true unless File. | 
| 77 | 
            +
                    next true unless File.exist?(path)
         | 
| 78 78 | 
             
                    included_in_other_path?(path, paths)
         | 
| 79 79 | 
             
                  end
         | 
| 80 80 | 
             
                  paths
         | 
    
        data/lib/guard/rubocop/runner.rb
    CHANGED
    
    
| @@ -112,21 +112,25 @@ describe Guard::Rubocop::Runner do | |
| 112 112 | 
             
                  end
         | 
| 113 113 | 
             
                end
         | 
| 114 114 |  | 
| 115 | 
            -
                it 'adds args for JSON formatter | 
| 115 | 
            +
                it 'adds args for JSON formatter' do
         | 
| 116 116 | 
             
                  expect(build_command[3..4]).to eq(%w(--format json))
         | 
| 117 117 | 
             
                end
         | 
| 118 118 |  | 
| 119 | 
            -
                it 'adds args for output file path of JSON formatter | 
| 119 | 
            +
                it 'adds args for output file path of JSON formatter' do
         | 
| 120 120 | 
             
                  expect(build_command[5]).to eq('--out')
         | 
| 121 121 | 
             
                  expect(build_command[6]).not_to be_empty
         | 
| 122 122 | 
             
                end
         | 
| 123 123 |  | 
| 124 | 
            +
                it 'adds --force-exclusion option' do
         | 
| 125 | 
            +
                  expect(build_command[7]).to eq('--force-exclusion')
         | 
| 126 | 
            +
                end
         | 
| 127 | 
            +
             | 
| 124 128 | 
             
                it 'adds args specified by user' do
         | 
| 125 | 
            -
                  expect(build_command[ | 
| 129 | 
            +
                  expect(build_command[8..9]).to eq(%w(--debug --rails))
         | 
| 126 130 | 
             
                end
         | 
| 127 131 |  | 
| 128 132 | 
             
                it 'adds the passed paths' do
         | 
| 129 | 
            -
                  expect(build_command[ | 
| 133 | 
            +
                  expect(build_command[10..-1]).to eq(%w(file1.rb file2.rb))
         | 
| 130 134 | 
             
                end
         | 
| 131 135 | 
             
              end
         | 
| 132 136 |  | 
| @@ -319,14 +323,14 @@ describe Guard::Rubocop::Runner do | |
| 319 323 | 
             
                end
         | 
| 320 324 |  | 
| 321 325 | 
             
                it 'notifies summary' do
         | 
| 322 | 
            -
                  expect(Guard::Notifier).to receive(:notify) do |message,  | 
| 326 | 
            +
                  expect(Guard::Notifier).to receive(:notify) do |message, _options|
         | 
| 323 327 | 
             
                    expect(message).to eq('2 files inspected, 4 offenses detected')
         | 
| 324 328 | 
             
                  end
         | 
| 325 329 | 
             
                  runner.notify(true)
         | 
| 326 330 | 
             
                end
         | 
| 327 331 |  | 
| 328 332 | 
             
                it 'notifies with title "RuboCop results"' do
         | 
| 329 | 
            -
                  expect(Guard::Notifier).to receive(:notify) do | | 
| 333 | 
            +
                  expect(Guard::Notifier).to receive(:notify) do |_message, options|
         | 
| 330 334 | 
             
                    expect(options[:title]).to eq('RuboCop results')
         | 
| 331 335 | 
             
                  end
         | 
| 332 336 | 
             
                  runner.notify(true)
         | 
| @@ -334,7 +338,7 @@ describe Guard::Rubocop::Runner do | |
| 334 338 |  | 
| 335 339 | 
             
                context 'when passed' do
         | 
| 336 340 | 
             
                  it 'shows success image' do
         | 
| 337 | 
            -
                    expect(Guard::Notifier).to receive(:notify) do | | 
| 341 | 
            +
                    expect(Guard::Notifier).to receive(:notify) do |_message, options|
         | 
| 338 342 | 
             
                      expect(options[:image]).to eq(:success)
         | 
| 339 343 | 
             
                    end
         | 
| 340 344 | 
             
                    runner.notify(true)
         | 
| @@ -343,7 +347,7 @@ describe Guard::Rubocop::Runner do | |
| 343 347 |  | 
| 344 348 | 
             
                context 'when failed' do
         | 
| 345 349 | 
             
                  it 'shows failed image' do
         | 
| 346 | 
            -
                    expect(Guard::Notifier).to receive(:notify) do | | 
| 350 | 
            +
                    expect(Guard::Notifier).to receive(:notify) do |_message, options|
         | 
| 347 351 | 
             
                      expect(options[:image]).to eq(:failed)
         | 
| 348 352 | 
             
                    end
         | 
| 349 353 | 
             
                    runner.notify(false)
         | 
    
        data/spec/guard/rubocop_spec.rb
    CHANGED
    
    | @@ -132,10 +132,10 @@ describe Guard::Rubocop, :silence_output do | |
| 132 132 | 
             
                  end
         | 
| 133 133 |  | 
| 134 134 | 
             
                  it 'passes cleaned paths to rubocop' do
         | 
| 135 | 
            -
                    expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run) do | | 
| 135 | 
            +
                    expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run) do |_instance, paths|
         | 
| 136 136 | 
             
                      expect(paths).to eq([
         | 
| 137 | 
            -
                        File.expand_path(' | 
| 138 | 
            -
                        File.expand_path(' | 
| 137 | 
            +
                        File.expand_path('lib/guard/rubocop.rb'),
         | 
| 138 | 
            +
                        File.expand_path('spec/spec_helper.rb')
         | 
| 139 139 | 
             
                      ])
         | 
| 140 140 | 
             
                    end
         | 
| 141 141 | 
             
                    subject
         | 
| @@ -159,7 +159,7 @@ describe Guard::Rubocop, :silence_output do | |
| 159 159 |  | 
| 160 160 | 
             
                    it 'also inspects paths which are failed last time' do
         | 
| 161 161 | 
             
                      guard.failed_paths << failed_path
         | 
| 162 | 
            -
                      expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run) do | | 
| 162 | 
            +
                      expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run) do |_instance, paths|
         | 
| 163 163 | 
             
                        expect(paths).to include failed_path
         | 
| 164 164 | 
             
                      end
         | 
| 165 165 | 
             
                      subject
         | 
| @@ -171,8 +171,11 @@ describe Guard::Rubocop, :silence_output do | |
| 171 171 |  | 
| 172 172 | 
             
                    it 'inspects just changed paths' do
         | 
| 173 173 | 
             
                      guard.failed_paths << failed_path
         | 
| 174 | 
            -
                      expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run) do | | 
| 175 | 
            -
                        expect(paths).to eq( | 
| 174 | 
            +
                      expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run) do |_instance, paths|
         | 
| 175 | 
            +
                        expect(paths).to eq([
         | 
| 176 | 
            +
                          File.expand_path('lib/guard/rubocop.rb'),
         | 
| 177 | 
            +
                          File.expand_path('spec/spec_helper.rb')
         | 
| 178 | 
            +
                        ])
         | 
| 176 179 | 
             
                      end
         | 
| 177 180 | 
             
                      subject
         | 
| 178 181 | 
             
                    end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: guard-rubocop
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0 | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Yuji Nakayama
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014- | 
| 11 | 
            +
            date: 2014-04-13 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: guard
         | 
| @@ -30,14 +30,14 @@ dependencies: | |
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - "~>"
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: '0. | 
| 33 | 
            +
                    version: '0.20'
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - "~>"
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: '0. | 
| 40 | 
            +
                    version: '0.20'
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: bundler
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 176 176 | 
             
                  version: '0'
         | 
| 177 177 | 
             
            requirements: []
         | 
| 178 178 | 
             
            rubyforge_project: 
         | 
| 179 | 
            -
            rubygems_version: 2.2. | 
| 179 | 
            +
            rubygems_version: 2.2.2
         | 
| 180 180 | 
             
            signing_key: 
         | 
| 181 181 | 
             
            specification_version: 4
         | 
| 182 182 | 
             
            summary: Guard plugin for RuboCop
         |