guard-rubocop 1.4.0 → 1.5.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/.github/workflows/ci.yml +6 -5
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/README.md +9 -6
- data/guard-rubocop.gemspec +2 -2
- data/lib/guard/rubocop/runner.rb +4 -6
- data/lib/guard/rubocop/version.rb +1 -1
- data/spec/guard/rubocop/runner_spec.rb +16 -0
- metadata +9 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f4fd50bb78f68a751f5fcc10f383377a222c9929ed882c62e44a93f15de13054
         | 
| 4 | 
            +
              data.tar.gz: 0ec423fa69f1af3cc9e784a576ecd6c91995f3ab03afdb5ea54226a7bdf97a0e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: de52917c49a6988e46ab3c8c2a933e6c590df311252c0d0e8a5828113242448c8f0f1deeaa7c4c57a1290a91f8ae9869bafa73a36c9fdf74c840d1b199fd5f84
         | 
| 7 | 
            +
              data.tar.gz: 8a9f56e402052cdbe167ddf27fd6f736e659a1dd864861d7aef07017e3c3f88b3395ac7b9e2ee2eecb57dc4fb84d72720845d2a86f3ae47b7b165ba603b7dd87
         | 
    
        data/.github/workflows/ci.yml
    CHANGED
    
    | @@ -6,7 +6,7 @@ jobs: | |
| 6 6 | 
             
                runs-on: ubuntu-latest
         | 
| 7 7 | 
             
                strategy:
         | 
| 8 8 | 
             
                  matrix:
         | 
| 9 | 
            -
                    ruby: [2. | 
| 9 | 
            +
                    ruby: ['2.5', '2.6', '2.7', '3.0']
         | 
| 10 10 | 
             
                steps:
         | 
| 11 11 | 
             
                  - uses: actions/checkout@v2
         | 
| 12 12 | 
             
                  - uses: ruby/setup-ruby@v1
         | 
| @@ -14,9 +14,10 @@ jobs: | |
| 14 14 | 
             
                      ruby-version: ${{ matrix.ruby }}
         | 
| 15 15 | 
             
                  - run: bundle install
         | 
| 16 16 | 
             
                  - run: bundle exec rspec
         | 
| 17 | 
            -
                   | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 17 | 
            +
                  # FIXME: https://github.com/rubocop/guard-rubocop/pull/48#issuecomment-906893891
         | 
| 18 | 
            +
                  # - uses: coverallsapp/github-action@master
         | 
| 19 | 
            +
                  #   with:
         | 
| 20 | 
            +
                  #     github-token: ${{ secrets.GITHUB_TOKEN }}
         | 
| 20 21 | 
             
              rubocop:
         | 
| 21 22 | 
             
                name: RuboCop
         | 
| 22 23 | 
             
                runs-on: ubuntu-latest
         | 
| @@ -24,6 +25,6 @@ jobs: | |
| 24 25 | 
             
                  - uses: actions/checkout@v2
         | 
| 25 26 | 
             
                  - uses: ruby/setup-ruby@v1
         | 
| 26 27 | 
             
                    with:
         | 
| 27 | 
            -
                      ruby-version: 2. | 
| 28 | 
            +
                      ruby-version: 2.5
         | 
| 28 29 | 
             
                  - run: bundle install
         | 
| 29 30 | 
             
                  - run: bundle exec rubocop
         | 
    
        data/.rubocop.yml
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            [](http://badge.fury.io/rb/guard-rubocop)
         | 
| 2 | 
            -
            [](https://github.com/rubocop/guard-rubocop/actions)
         | 
| 3 | 
            +
            [](https://coveralls.io/github/rubocop/guard-rubocop?branch=master)
         | 
| 4 | 
            +
            [](https://codeclimate.com/github/rubocop/guard-rubocop)
         | 
| 5 5 |  | 
| 6 6 | 
             
            # guard-rubocop
         | 
| 7 7 |  | 
| 8 | 
            -
            **guard-rubocop** allows you to automatically check Ruby code style with [RuboCop](https://github.com/ | 
| 8 | 
            +
            **guard-rubocop** allows you to automatically check Ruby code style with [RuboCop](https://github.com/rubocop/rubocop) when files are modified.
         | 
| 9 9 |  | 
| 10 | 
            -
            Tested on MRI 2. | 
| 10 | 
            +
            Tested on MRI 2.5 - 3.0.
         | 
| 11 11 |  | 
| 12 12 | 
             
            ## Installation
         | 
| 13 13 |  | 
| @@ -61,6 +61,9 @@ all_on_start: true     # Check all files at Guard startup. | |
| 61 61 | 
             
            cli: '--rails'         # Pass arbitrary RuboCop CLI arguments.
         | 
| 62 62 | 
             
                                   # An array or string is acceptable.
         | 
| 63 63 | 
             
                                   #   default: nil
         | 
| 64 | 
            +
            cmd: './bin/rubocop'   # Pass custom cmd to run rubocop.
         | 
| 65 | 
            +
                                   #   default: rubocop
         | 
| 66 | 
            +
             | 
| 64 67 | 
             
            hide_stdout: false     # Do not display console output (in case outputting to file).
         | 
| 65 68 | 
             
                                   #   default: false
         | 
| 66 69 | 
             
            keep_failed: true      # Keep failed files until they pass.
         | 
| @@ -120,6 +123,6 @@ Note: You need to use `guard-rspec` 4.2.3 or later due to a [bug](https://github | |
| 120 123 |  | 
| 121 124 | 
             
            ## License
         | 
| 122 125 |  | 
| 123 | 
            -
            Copyright (c) 2013– | 
| 126 | 
            +
            Copyright (c) 2013–2020 Yuji Nakayama
         | 
| 124 127 |  | 
| 125 128 | 
             
            See the [LICENSE.txt](LICENSE.txt) for details.
         | 
    
        data/guard-rubocop.gemspec
    CHANGED
    
    | @@ -13,10 +13,10 @@ Gem::Specification.new do |spec| | |
| 13 13 | 
             
              spec.summary       = 'Guard plugin for RuboCop'
         | 
| 14 14 | 
             
              spec.description   = 'Guard::RuboCop automatically checks Ruby code style with RuboCop ' \
         | 
| 15 15 | 
             
                                   'when files are modified.'
         | 
| 16 | 
            -
              spec.homepage      = 'https://github.com/ | 
| 16 | 
            +
              spec.homepage      = 'https://github.com/rubocop/guard-rubocop'
         | 
| 17 17 | 
             
              spec.license       = 'MIT'
         | 
| 18 18 |  | 
| 19 | 
            -
              spec.required_ruby_version = '>= 2. | 
| 19 | 
            +
              spec.required_ruby_version = '>= 2.5'
         | 
| 20 20 |  | 
| 21 21 | 
             
              spec.files         = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
         | 
| 22 22 | 
             
              spec.executables   = spec.files.grep(/^bin\//) { |f| File.basename(f) }
         | 
    
        data/lib/guard/rubocop/runner.rb
    CHANGED
    
    | @@ -28,7 +28,7 @@ module Guard | |
| 28 28 | 
             
                  end
         | 
| 29 29 |  | 
| 30 30 | 
             
                  def build_command(paths)
         | 
| 31 | 
            -
                    command = ['rubocop']
         | 
| 31 | 
            +
                    command = [@options[:cmd] || 'rubocop']
         | 
| 32 32 |  | 
| 33 33 | 
             
                    if should_add_default_formatter_for_console?
         | 
| 34 34 | 
             
                      command.concat(%w[--format progress]) # Keep default formatter for console.
         | 
| @@ -80,11 +80,9 @@ module Guard | |
| 80 80 | 
             
                  end
         | 
| 81 81 |  | 
| 82 82 | 
             
                  def result
         | 
| 83 | 
            -
                    @result ||=  | 
| 84 | 
            -
                       | 
| 85 | 
            -
             | 
| 86 | 
            -
                        JSON.parse(file.read, symbolize_names: true)
         | 
| 87 | 
            -
                      end
         | 
| 83 | 
            +
                    @result ||= File.open(json_file_path) do |file|
         | 
| 84 | 
            +
                      # Rubinius 2.0.0.rc1 does not support `JSON.load` with 3 args.
         | 
| 85 | 
            +
                      JSON.parse(file.read, symbolize_names: true)
         | 
| 88 86 | 
             
                    end
         | 
| 89 87 | 
             
                  end
         | 
| 90 88 |  | 
| @@ -109,6 +109,22 @@ RSpec.describe Guard::RuboCop::Runner do | |
| 109 109 | 
             
                let(:options) { { cli: %w[--debug --rails] } }
         | 
| 110 110 | 
             
                let(:paths) { %w[file1.rb file2.rb] }
         | 
| 111 111 |  | 
| 112 | 
            +
                describe ':cmd option' do
         | 
| 113 | 
            +
                  context 'when set' do
         | 
| 114 | 
            +
                    let(:options) { { cmd: 'bin/rubocop' } }
         | 
| 115 | 
            +
             | 
| 116 | 
            +
                    it 'uses the supplied :cmd' do
         | 
| 117 | 
            +
                      expect(build_command[0]).to eq('bin/rubocop')
         | 
| 118 | 
            +
                    end
         | 
| 119 | 
            +
                  end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
                  context 'when not set' do
         | 
| 122 | 
            +
                    it 'uses the default command' do
         | 
| 123 | 
            +
                      expect(build_command[0]).to eq('rubocop')
         | 
| 124 | 
            +
                    end
         | 
| 125 | 
            +
                  end
         | 
| 126 | 
            +
                end
         | 
| 127 | 
            +
             | 
| 112 128 | 
             
                context 'when :hide_stdout is not set' do
         | 
| 113 129 | 
             
                  context 'and :cli option includes formatter for console' do
         | 
| 114 130 | 
             
                    before { options[:cli] = %w[--format simple] }
         | 
    
        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. | 
| 4 | 
            +
              version: 1.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Yuji Nakayama
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-08-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: guard
         | 
| @@ -158,11 +158,11 @@ files: | |
| 158 158 | 
             
            - spec/spec_helper.rb
         | 
| 159 159 | 
             
            - spec/support/silence_output.rb
         | 
| 160 160 | 
             
            - spec/support/simplecov.rb
         | 
| 161 | 
            -
            homepage: https://github.com/ | 
| 161 | 
            +
            homepage: https://github.com/rubocop/guard-rubocop
         | 
| 162 162 | 
             
            licenses:
         | 
| 163 163 | 
             
            - MIT
         | 
| 164 164 | 
             
            metadata: {}
         | 
| 165 | 
            -
            post_install_message: | 
| 165 | 
            +
            post_install_message:
         | 
| 166 166 | 
             
            rdoc_options: []
         | 
| 167 167 | 
             
            require_paths:
         | 
| 168 168 | 
             
            - lib
         | 
| @@ -170,15 +170,16 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 170 170 | 
             
              requirements:
         | 
| 171 171 | 
             
              - - ">="
         | 
| 172 172 | 
             
                - !ruby/object:Gem::Version
         | 
| 173 | 
            -
                  version: '2. | 
| 173 | 
            +
                  version: '2.5'
         | 
| 174 174 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 175 175 | 
             
              requirements:
         | 
| 176 176 | 
             
              - - ">="
         | 
| 177 177 | 
             
                - !ruby/object:Gem::Version
         | 
| 178 178 | 
             
                  version: '0'
         | 
| 179 179 | 
             
            requirements: []
         | 
| 180 | 
            -
             | 
| 181 | 
            -
             | 
| 180 | 
            +
            rubyforge_project:
         | 
| 181 | 
            +
            rubygems_version: 2.7.6.3
         | 
| 182 | 
            +
            signing_key:
         | 
| 182 183 | 
             
            specification_version: 4
         | 
| 183 184 | 
             
            summary: Guard plugin for RuboCop
         | 
| 184 185 | 
             
            test_files:
         |