File tree Expand file tree Collapse file tree 9 files changed +50
-35
lines changed
Expand file tree Collapse file tree 9 files changed +50
-35
lines changed Original file line number Diff line number Diff line change 11inherit_from : .rubocop_todo.yml
2+
3+ plugins :
4+ - rubocop-internal_affairs
5+
26require :
3- - rubocop/cop/internal_affairs
47 - rubocop-rake
58 - rubocop-rspec
69 - rubocop-performance
710
811AllCops :
9- TargetRubyVersion : 2.5
12+ TargetRubyVersion : 2.7
1013 NewCops : enable
1114
1215# rubocop-i18n does not have config/default.
Original file line number Diff line number Diff line change 22
33### [ master (Unreleased)] ( https://github.com/rubocop/rubocop-i18n/compare/v3.1.0...master )
44
5+ * Pluginfy rubocop-i18n (#65 )
6+
57### [ 3.1.0] ( https://github.com/rubocop/rubocop-i18n/compare/v3.0.0...v3.1.0 )
68
79* Transfer ownership of rubocop-i18n from puppetlabs org to rubocop org (#62 )
Original file line number Diff line number Diff line change @@ -28,8 +28,9 @@ Or install it yourself as:
2828## Usage
2929
3030In your ` rubocop.yml ` :
31- ```
32- require:
31+
32+ ``` yaml
33+ plugins :
3334 - rubocop-i18n
3435...
3536# You *must* choose GetText or Rails-i18n style checking
@@ -58,6 +59,9 @@ I18n/RailsI18n/DecorateString:
5859 Enabled : false
5960` ` `
6061
62+ > [!NOTE]
63+ > The plugin system is supported in RuboCop 1.72+. In earlier versions, use ` require` instead of `plugins`.
64+
6165# # Cops
6266
6367# ## I18n/GetText/DecorateString
Original file line number Diff line number Diff line change 33require 'rubocop'
44
55require_relative 'rubocop/i18n'
6- require_relative 'rubocop/i18n/inject'
7-
8- RuboCop ::I18n ::Inject . defaults!
9-
6+ require_relative 'rubocop/i18n/plugin'
107require_relative 'rubocop/cop/i18n_cops'
Original file line number Diff line number Diff line change 33module RuboCop
44 # RuboCop I18n project namespace
55 module I18n
6- PROJECT_ROOT = Pathname . new ( __dir__ ) . parent . parent . expand_path . freeze
7- CONFIG_DEFAULT = PROJECT_ROOT . join ( 'config' , 'default.yml' ) . freeze
8-
9- private_constant ( :CONFIG_DEFAULT , :PROJECT_ROOT )
106 end
117end
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require 'lint_roller'
4+
5+ module RuboCop
6+ module I18n
7+ # A plugin that integrates rubocop-i18n with RuboCop's plugin system.
8+ class Plugin < LintRoller ::Plugin
9+ def about
10+ LintRoller ::About . new (
11+ name : 'rubocop-i18n' ,
12+ version : Version ::STRING ,
13+ homepage : 'https://github.com/rubocop/rubocop-i18n' ,
14+ description : 'RuboCop rules for i18n.'
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
Original file line number Diff line number Diff line change @@ -20,11 +20,13 @@ Gem::Specification.new do |spec|
2020 spec . executables = spec . files . grep ( %r{^exe/} ) { |f | File . basename ( f ) }
2121 spec . require_paths = [ 'lib' ]
2222
23- spec . required_ruby_version = '>= 2.5.8 '
23+ spec . required_ruby_version = '>= 2.7.0 '
2424
2525 spec . metadata = {
26- 'rubygems_mfa_required' => 'true'
26+ 'rubygems_mfa_required' => 'true' ,
27+ 'default_lint_roller_plugin' => 'RuboCop::I18n::Plugin'
2728 }
2829
29- spec . add_dependency 'rubocop' , '~> 1.0'
30+ spec . add_dependency 'lint_roller' , '~> 1.1'
31+ spec . add_dependency 'rubocop' , '~> 1.72.1'
3032end
Original file line number Diff line number Diff line change 3636 mocks . syntax = :expect # Disable `should_receive` and `stub`
3737 mocks . verify_partial_doubles = true
3838 end
39-
40- config . include ( RuboCop ::RSpec ::ExpectOffense )
4139end
You can’t perform that action at this time.
0 commit comments