rubocop-rubycw 0.1.5 → 0.2.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/main.yml +36 -0
- data/Gemfile +1 -1
- data/README.md +6 -6
- data/lib/rubocop/rubycw/plugin.rb +31 -0
- data/lib/rubocop/rubycw/version.rb +1 -1
- data/lib/rubocop/rubycw/warning_capturer.rb +7 -2
- data/lib/rubocop-rubycw.rb +1 -4
- data/rubocop-rubycw.gemspec +5 -4
- metadata +26 -11
- data/.circleci/config.yml +0 -49
- data/lib/rubocop/rubycw/inject.rb +0 -20
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 10400a7e8d7cb88964ffa0c2615da00f4a2a623caa0648779e252c92cd8b4612
         | 
| 4 | 
            +
              data.tar.gz: b30a3eb957415c8d3fbfa6838840618820fe9d1e1b3aa51f1a032930ea2f76d0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9e8f12b43e01d9f192aca8704705dfa53ddc033ef17a9cdc10611798e5bd899d9a0cc4280fe804e1d2b5c6d3ba447070f9691ab0602b6e496df86718c34d0407
         | 
| 7 | 
            +
              data.tar.gz: 65dd59bbfe15ff2103228d5b501473bcc436d50a2fbba2dd85c07ff36ce36f3ec1702122070d3a0c9c064a7a53ad337692ab2ffdd8742c871c2d9bcc48ec443d
         | 
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            name: CI
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on:
         | 
| 4 | 
            +
              pull_request:
         | 
| 5 | 
            +
              push:
         | 
| 6 | 
            +
                branches:
         | 
| 7 | 
            +
                  - master
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            concurrency:
         | 
| 10 | 
            +
              group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
         | 
| 11 | 
            +
              cancel-in-progress: true
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            jobs:
         | 
| 14 | 
            +
              main:
         | 
| 15 | 
            +
                runs-on: ubuntu-latest
         | 
| 16 | 
            +
                strategy:
         | 
| 17 | 
            +
                  fail-fast: false
         | 
| 18 | 
            +
                  matrix:
         | 
| 19 | 
            +
                    ruby:
         | 
| 20 | 
            +
                      - "2.7"
         | 
| 21 | 
            +
                      - "3.0"
         | 
| 22 | 
            +
                      - "3.1"
         | 
| 23 | 
            +
                      - "3.2"
         | 
| 24 | 
            +
                      - "3.3"
         | 
| 25 | 
            +
                      - "3.4"
         | 
| 26 | 
            +
                      - ruby-head
         | 
| 27 | 
            +
                    task:
         | 
| 28 | 
            +
                      - spec
         | 
| 29 | 
            +
                name: Ruby ${{ matrix.ruby }}
         | 
| 30 | 
            +
                steps:
         | 
| 31 | 
            +
                  - uses: actions/checkout@v4
         | 
| 32 | 
            +
                  - uses: ruby/setup-ruby@v1
         | 
| 33 | 
            +
                    with:
         | 
| 34 | 
            +
                      ruby-version: ${{ matrix.ruby }}
         | 
| 35 | 
            +
                      bundler-cache: true
         | 
| 36 | 
            +
                  - run: bundle exec rake
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -6,9 +6,7 @@ You can get Ruby's warning as a RuboCop offense by rubocop-rubycw. | |
| 6 6 |  | 
| 7 7 | 
             
            ## Requirements
         | 
| 8 8 |  | 
| 9 | 
            -
            * Ruby 2. | 
| 10 | 
            -
              * But I highly recommend to use Ruby 2.6 or greater.
         | 
| 11 | 
            -
                Because it is about 10x slower if it works on Ruby 2.5 or lower.
         | 
| 9 | 
            +
            * Ruby 2.7 or greater.
         | 
| 12 10 |  | 
| 13 11 | 
             
            ## Installation
         | 
| 14 12 |  | 
| @@ -31,9 +29,12 @@ Or install it yourself as: | |
| 31 29 | 
             
            Put this into your `.rubocop.yml`.
         | 
| 32 30 |  | 
| 33 31 | 
             
            ```yaml
         | 
| 34 | 
            -
             | 
| 32 | 
            +
            plugins: rubocop-rubycw
         | 
| 35 33 | 
             
            ```
         | 
| 36 34 |  | 
| 35 | 
            +
            > [!NOTE]
         | 
| 36 | 
            +
            > The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
         | 
| 37 | 
            +
             | 
| 37 38 | 
             
            ## Development
         | 
| 38 39 |  | 
| 39 40 | 
             
            After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         | 
| @@ -42,5 +43,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To | |
| 42 43 |  | 
| 43 44 | 
             
            ## Contributing
         | 
| 44 45 |  | 
| 45 | 
            -
            Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop | 
| 46 | 
            -
             | 
| 46 | 
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop/rubocop-rubycw.
         | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'lint_roller'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module RuboCop
         | 
| 6 | 
            +
              module Rubycw
         | 
| 7 | 
            +
                # A plugin that integrates RuboCop Rubycw with RuboCop's plugin system.
         | 
| 8 | 
            +
                class Plugin < LintRoller::Plugin
         | 
| 9 | 
            +
                  def about
         | 
| 10 | 
            +
                    LintRoller::About.new(
         | 
| 11 | 
            +
                      name: 'rubocop-rubycw',
         | 
| 12 | 
            +
                      version: Version::STRING,
         | 
| 13 | 
            +
                      homepage: 'https://github.com/rubocop/rubocop-rubycw',
         | 
| 14 | 
            +
                      description: 'Integrate RuboCop and `ruby -cw`.'
         | 
| 15 | 
            +
                    )
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  def supported?(context)
         | 
| 19 | 
            +
                    context.engine == :rubocop
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  def rules(_context)
         | 
| 23 | 
            +
                    LintRoller::Rules.new(
         | 
| 24 | 
            +
                      type: :path,
         | 
| 25 | 
            +
                      config_format: :rubocop,
         | 
| 26 | 
            +
                      value: Pathname.new(__dir__).join('../../../config/default.yml')
         | 
| 27 | 
            +
                    )
         | 
| 28 | 
            +
                  end
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
            end
         | 
| @@ -5,11 +5,16 @@ module RuboCop | |
| 5 5 | 
             
                module WarningCapturer
         | 
| 6 6 | 
             
                  if defined?(RubyVM::AbstractSyntaxTree)
         | 
| 7 7 | 
             
                    module ::Warning
         | 
| 8 | 
            -
                      def self.warn(*message)
         | 
| 8 | 
            +
                      def self.warn(*message, **kwargs)
         | 
| 9 9 | 
             
                        if WarningCapturer.warnings
         | 
| 10 10 | 
             
                          WarningCapturer.warnings.concat message
         | 
| 11 11 | 
             
                        else
         | 
| 12 | 
            -
                           | 
| 12 | 
            +
                          if RUBY_VERSION >= '3'
         | 
| 13 | 
            +
                            # kwargs is available since Ruby 3
         | 
| 14 | 
            +
                            super(*message, **kwargs)
         | 
| 15 | 
            +
                          else
         | 
| 16 | 
            +
                            super(*message)
         | 
| 17 | 
            +
                          end
         | 
| 13 18 | 
             
                        end
         | 
| 14 19 | 
             
                      end
         | 
| 15 20 | 
             
                    end
         | 
    
        data/lib/rubocop-rubycw.rb
    CHANGED
    
    | @@ -4,9 +4,6 @@ require 'rubocop' | |
| 4 4 |  | 
| 5 5 | 
             
            require_relative 'rubocop/rubycw'
         | 
| 6 6 | 
             
            require_relative 'rubocop/rubycw/version'
         | 
| 7 | 
            -
            require_relative 'rubocop/rubycw/ | 
| 8 | 
            -
             | 
| 9 | 
            -
            RuboCop::Rubycw::Inject.defaults!
         | 
| 10 | 
            -
             | 
| 7 | 
            +
            require_relative 'rubocop/rubycw/plugin'
         | 
| 11 8 | 
             
            require_relative 'rubocop/rubycw/warning_capturer'
         | 
| 12 9 | 
             
            require_relative 'rubocop/cop/rubycw_cops'
         | 
    
        data/rubocop-rubycw.gemspec
    CHANGED
    
    | @@ -8,15 +8,15 @@ Gem::Specification.new do |spec| | |
| 8 8 |  | 
| 9 9 | 
             
              spec.summary       = %q{Integrate RuboCop and ruby -cw}
         | 
| 10 10 | 
             
              spec.description   = %q{Integrate RuboCop and ruby -cw}
         | 
| 11 | 
            -
              spec.homepage      = "https://github.com/rubocop | 
| 12 | 
            -
              spec.required_ruby_version = Gem::Requirement.new(">= 2. | 
| 11 | 
            +
              spec.homepage      = "https://github.com/rubocop/rubocop-rubycw"
         | 
| 12 | 
            +
              spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
         | 
| 13 13 | 
             
              spec.license       = 'MIT'
         | 
| 14 14 |  | 
| 15 15 | 
             
              # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
         | 
| 16 16 |  | 
| 17 17 | 
             
              spec.metadata["homepage_uri"] = spec.homepage
         | 
| 18 18 | 
             
              spec.metadata["source_code_uri"] = spec.homepage
         | 
| 19 | 
            -
               | 
| 19 | 
            +
              spec.metadata["default_lint_roller_plugin"] = 'RuboCop::Rubycw::Plugin'
         | 
| 20 20 |  | 
| 21 21 | 
             
              # Specify which files should be added to the gem when it is released.
         | 
| 22 22 | 
             
              # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
         | 
| @@ -27,5 +27,6 @@ Gem::Specification.new do |spec| | |
| 27 27 | 
             
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         | 
| 28 28 | 
             
              spec.require_paths = ["lib"]
         | 
| 29 29 |  | 
| 30 | 
            -
              spec.add_runtime_dependency ' | 
| 30 | 
            +
              spec.add_runtime_dependency 'lint_roller', '~> 1.1'
         | 
| 31 | 
            +
              spec.add_runtime_dependency 'rubocop', '~> 1.72.1'
         | 
| 31 32 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,29 +1,43 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rubocop-rubycw
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Masataka Pocke Kuwabara
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2025-02-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: lint_roller
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - "~>"
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '1.1'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - "~>"
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '1.1'
         | 
| 13 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 28 | 
             
              name: rubocop
         | 
| 15 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 30 | 
             
                requirements:
         | 
| 17 31 | 
             
                - - "~>"
         | 
| 18 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version:  | 
| 33 | 
            +
                    version: 1.72.1
         | 
| 20 34 | 
             
              type: :runtime
         | 
| 21 35 | 
             
              prerelease: false
         | 
| 22 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 37 | 
             
                requirements:
         | 
| 24 38 | 
             
                - - "~>"
         | 
| 25 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version:  | 
| 40 | 
            +
                    version: 1.72.1
         | 
| 27 41 | 
             
            description: Integrate RuboCop and ruby -cw
         | 
| 28 42 | 
             
            email:
         | 
| 29 43 | 
             
            - kuwabara@pocke.me
         | 
| @@ -31,7 +45,7 @@ executables: [] | |
| 31 45 | 
             
            extensions: []
         | 
| 32 46 | 
             
            extra_rdoc_files: []
         | 
| 33 47 | 
             
            files:
         | 
| 34 | 
            -
            - ". | 
| 48 | 
            +
            - ".github/workflows/main.yml"
         | 
| 35 49 | 
             
            - ".gitignore"
         | 
| 36 50 | 
             
            - ".rspec"
         | 
| 37 51 | 
             
            - ".rubocop.yml"
         | 
| @@ -46,16 +60,17 @@ files: | |
| 46 60 | 
             
            - lib/rubocop/cop/rubycw/rubycw.rb
         | 
| 47 61 | 
             
            - lib/rubocop/cop/rubycw_cops.rb
         | 
| 48 62 | 
             
            - lib/rubocop/rubycw.rb
         | 
| 49 | 
            -
            - lib/rubocop/rubycw/ | 
| 63 | 
            +
            - lib/rubocop/rubycw/plugin.rb
         | 
| 50 64 | 
             
            - lib/rubocop/rubycw/version.rb
         | 
| 51 65 | 
             
            - lib/rubocop/rubycw/warning_capturer.rb
         | 
| 52 66 | 
             
            - rubocop-rubycw.gemspec
         | 
| 53 | 
            -
            homepage: https://github.com/rubocop | 
| 67 | 
            +
            homepage: https://github.com/rubocop/rubocop-rubycw
         | 
| 54 68 | 
             
            licenses:
         | 
| 55 69 | 
             
            - MIT
         | 
| 56 70 | 
             
            metadata:
         | 
| 57 | 
            -
              homepage_uri: https://github.com/rubocop | 
| 58 | 
            -
              source_code_uri: https://github.com/rubocop | 
| 71 | 
            +
              homepage_uri: https://github.com/rubocop/rubocop-rubycw
         | 
| 72 | 
            +
              source_code_uri: https://github.com/rubocop/rubocop-rubycw
         | 
| 73 | 
            +
              default_lint_roller_plugin: RuboCop::Rubycw::Plugin
         | 
| 59 74 | 
             
            post_install_message:
         | 
| 60 75 | 
             
            rdoc_options: []
         | 
| 61 76 | 
             
            require_paths:
         | 
| @@ -64,14 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 64 79 | 
             
              requirements:
         | 
| 65 80 | 
             
              - - ">="
         | 
| 66 81 | 
             
                - !ruby/object:Gem::Version
         | 
| 67 | 
            -
                  version: 2. | 
| 82 | 
            +
                  version: 2.7.0
         | 
| 68 83 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 69 84 | 
             
              requirements:
         | 
| 70 85 | 
             
              - - ">="
         | 
| 71 86 | 
             
                - !ruby/object:Gem::Version
         | 
| 72 87 | 
             
                  version: '0'
         | 
| 73 88 | 
             
            requirements: []
         | 
| 74 | 
            -
            rubygems_version: 3. | 
| 89 | 
            +
            rubygems_version: 3.1.6
         | 
| 75 90 | 
             
            signing_key:
         | 
| 76 91 | 
             
            specification_version: 4
         | 
| 77 92 | 
             
            summary: Integrate RuboCop and ruby -cw
         | 
    
        data/.circleci/config.yml
    DELETED
    
    | @@ -1,49 +0,0 @@ | |
| 1 | 
            -
            version: 2
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            steps: &steps
         | 
| 4 | 
            -
              steps:
         | 
| 5 | 
            -
                - checkout
         | 
| 6 | 
            -
                - run: bundle install
         | 
| 7 | 
            -
                - run: bundle exec rake
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            jobs:
         | 
| 10 | 
            -
              ruby-2.4:
         | 
| 11 | 
            -
                docker:
         | 
| 12 | 
            -
                  - image: circleci/ruby:2.4
         | 
| 13 | 
            -
                <<: *steps
         | 
| 14 | 
            -
             | 
| 15 | 
            -
              ruby-2.5:
         | 
| 16 | 
            -
                docker:
         | 
| 17 | 
            -
                  - image: circleci/ruby:2.5
         | 
| 18 | 
            -
                <<: *steps
         | 
| 19 | 
            -
             | 
| 20 | 
            -
              ruby-2.6:
         | 
| 21 | 
            -
                docker:
         | 
| 22 | 
            -
                  - image: circleci/ruby:2.6
         | 
| 23 | 
            -
                <<: *steps
         | 
| 24 | 
            -
             | 
| 25 | 
            -
              ruby-2.7:
         | 
| 26 | 
            -
                docker:
         | 
| 27 | 
            -
                  - image: circleci/ruby:2.7
         | 
| 28 | 
            -
                <<: *steps
         | 
| 29 | 
            -
             | 
| 30 | 
            -
              ruby-3.0:
         | 
| 31 | 
            -
                docker:
         | 
| 32 | 
            -
                  - image: circleci/ruby:3.0
         | 
| 33 | 
            -
                <<: *steps
         | 
| 34 | 
            -
             | 
| 35 | 
            -
              ruby-head:
         | 
| 36 | 
            -
                docker:
         | 
| 37 | 
            -
                  - image: rubocophq/circleci-ruby-snapshot:latest
         | 
| 38 | 
            -
                <<: *steps
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            workflows:
         | 
| 41 | 
            -
              version: 2
         | 
| 42 | 
            -
              build:
         | 
| 43 | 
            -
                jobs:
         | 
| 44 | 
            -
                  - ruby-2.4
         | 
| 45 | 
            -
                  - ruby-2.5
         | 
| 46 | 
            -
                  - ruby-2.6
         | 
| 47 | 
            -
                  - ruby-2.7
         | 
| 48 | 
            -
                  - ruby-3.0
         | 
| 49 | 
            -
                  - ruby-head
         | 
| @@ -1,20 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            # The original code is from https://github.com/rubocop-hq/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
         | 
| 4 | 
            -
            # See https://github.com/rubocop-hq/rubocop-rspec/blob/master/MIT-LICENSE.md
         | 
| 5 | 
            -
            module RuboCop
         | 
| 6 | 
            -
              module Rubycw
         | 
| 7 | 
            -
                # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
         | 
| 8 | 
            -
                # bit of our configuration.
         | 
| 9 | 
            -
                module Inject
         | 
| 10 | 
            -
                  def self.defaults!
         | 
| 11 | 
            -
                    path = CONFIG_DEFAULT.to_s
         | 
| 12 | 
            -
                    hash = ConfigLoader.send(:load_yaml_configuration, path)
         | 
| 13 | 
            -
                    config = Config.new(hash, path)
         | 
| 14 | 
            -
                    puts "configuration from #{path}" if ConfigLoader.debug?
         | 
| 15 | 
            -
                    config = ConfigLoader.merge_with_default(config, path)
         | 
| 16 | 
            -
                    ConfigLoader.instance_variable_set(:@default_configuration, config)
         | 
| 17 | 
            -
                  end
         | 
| 18 | 
            -
                end
         | 
| 19 | 
            -
              end
         | 
| 20 | 
            -
            end
         |