rubocop-faker 1.2.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fefc520bc2c3f5e85c7b2f31a55f524dc4a5a2456485b769e34028514b302c0
4
- data.tar.gz: e4273cf0dcc43e125821a694a208d6a4cf0140fc76fb49e80456bb3f018d5265
3
+ metadata.gz: 9411434bc51ae4bd5aeb3ec021d79472ac55c39d8fd96785d46094ada5380049
4
+ data.tar.gz: a53752635232f959e334ed106edbb0c4b7dcb3f76cc0958c39b2380971fb9388
5
5
  SHA512:
6
- metadata.gz: 76fed47690e635e7b4ee4b01480154887ddb8ead6a6fec28df504d73280f2e85be33f08b5856a3b201102548a8b5c9a05e735ab18f94d8e9276663eb5ce8038b
7
- data.tar.gz: e69bba8304c3b045e348840dabe447bfe3128e33b3076ba856cf8233413540ee0a7bc96c5463aed5c3a9fcf572c111602b3f55d92f9b58e0730cc52ed5f2c7c5
6
+ metadata.gz: e7c01bad74e1fb97f64e254d39858289ec5ba710460662d6e06e7e5baac4ff569c9a382ee24c426031489b3a291267c5b7229165f3483c342da274aacf282d02
7
+ data.tar.gz: 55ab7dad2875123dcdd9d5cd7b6257fc69b3ac11d1739ca91453ec53f7693d66a9a404d896394f15fb308f7c20f91241205e1025c883563a2dff8a61bf2dfa83
data/.rubocop.yml CHANGED
@@ -2,8 +2,8 @@ inherit_from: .rubocop_todo.yml
2
2
 
3
3
  # This is the configuration used to check the rubocop source code.
4
4
 
5
- require:
6
- - rubocop/cop/internal_affairs
5
+ plugins:
6
+ - rubocop-internal_affairs
7
7
  - rubocop-performance
8
8
 
9
9
  AllCops:
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 1.3.0 (2025-02-18)
6
+
7
+ ### New features
8
+
9
+ * Pluginfy RuboCop Faker. ([@koic][])
10
+ * Support safe navigation operator for `Faker/DeprecatedArguments`. ([@koic][])
11
+
5
12
  ## 1.2.0 (2024-10-22)
6
13
 
7
14
  ### Bug fixes
data/Gemfile CHANGED
@@ -8,8 +8,8 @@ gemspec
8
8
 
9
9
  gem 'rake'
10
10
  gem 'rspec'
11
- gem 'rubocop', github: 'rubocop-hq/rubocop'
12
- gem 'rubocop-performance', '~> 1.22.0'
11
+ gem 'rubocop', github: 'rubocop/rubocop'
12
+ gem 'rubocop-performance', '~> 1.24.0'
13
13
  # Workaround for YARD 0.9.20 or lower.
14
14
  # It specifies `github` until the release that includes the following changes:
15
15
  # https://github.com/lsegal/yard/pull/1290
data/README.md CHANGED
@@ -48,13 +48,13 @@ This gem offers the only `Faker/DeprecatedArguments` cop. It is intended to conv
48
48
  Check positional argument style before Faker 2.
49
49
 
50
50
  ```console
51
- % rubocop --require rubocop-faker --only Faker/DeprecatedArguments
51
+ % rubocop --plugin rubocop-faker --only Faker/DeprecatedArguments
52
52
  ```
53
53
 
54
54
  Auto-correction to keyword argument style on Faker 2.
55
55
 
56
56
  ```console
57
- % rubocop --require rubocop-faker --only Faker/DeprecatedArguments --autocorrect
57
+ % rubocop --plugin rubocop-faker --only Faker/DeprecatedArguments --autocorrect
58
58
  ```
59
59
 
60
60
  ### RuboCop configuration file
@@ -63,10 +63,13 @@ Add `rubocop-faker` to required extension.
63
63
 
64
64
  ```yaml
65
65
  # .rubocop.yml
66
- require:
66
+ plugins:
67
67
  - rubocop-faker
68
68
  ```
69
69
 
70
+ > [!NOTE]
71
+ > The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
72
+
70
73
  ## Contributing
71
74
 
72
75
  Bug reports and pull requests are welcome on GitHub at https://github.com/koic/rubocop-faker.
@@ -45,6 +45,7 @@ module RuboCop
45
45
  add_offense_for_arguments(node, argument, message)
46
46
  end
47
47
  end
48
+ alias on_csend on_send
48
49
 
49
50
  private
50
51
 
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lint_roller'
4
+
5
+ module RuboCop
6
+ module Faker
7
+ # A plugin that integrates RuboCop Faker with RuboCop's plugin system.
8
+ class Plugin < LintRoller::Plugin
9
+ def about
10
+ LintRoller::About.new(
11
+ name: 'rubocop-faker',
12
+ version: VERSION,
13
+ homepage: 'https://github.com/koic/rubocop-faker',
14
+ description: 'A RuboCop extension for Faker.'
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Faker
5
- VERSION = '1.2.0'
5
+ VERSION = '1.3.0'
6
6
  end
7
7
  end
data/lib/rubocop/faker.rb CHANGED
@@ -1,12 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RuboCop
4
- # RuboCop Faker project namespace
4
+ # RuboCop Faker project namespace.
5
5
  module Faker
6
- PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
7
- CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
8
- CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
9
-
10
- private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
11
6
  end
12
7
  end
data/lib/rubocop-faker.rb CHANGED
@@ -4,8 +4,5 @@ require 'rubocop'
4
4
 
5
5
  require_relative 'rubocop/faker'
6
6
  require_relative 'rubocop/faker/version'
7
- require_relative 'rubocop/faker/inject'
8
-
9
- RuboCop::Faker::Inject.defaults!
10
-
7
+ require_relative 'rubocop/faker/plugin'
11
8
  require_relative 'rubocop/cop/faker_cops'
@@ -16,7 +16,8 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata = {
18
18
  'homepage_uri' => spec.homepage,
19
- 'rubygems_mfa_required' => 'true'
19
+ 'rubygems_mfa_required' => 'true',
20
+ 'default_lint_roller_plugin' => 'RuboCop::Faker::Plugin'
20
21
  }
21
22
 
22
23
  # Specify which files should be added to the gem when it is released.
@@ -29,5 +30,6 @@ Gem::Specification.new do |spec|
29
30
  spec.require_paths = ['lib']
30
31
 
31
32
  spec.add_dependency 'faker', '>= 2.12.0'
32
- spec.add_dependency 'rubocop', '>= 1.13.0'
33
+ spec.add_dependency 'lint_roller', '~> 1.1'
34
+ spec.add_dependency 'rubocop', '>= 1.72.1'
33
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-faker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi ITO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-21 00:00:00.000000000 Z
11
+ date: 2025-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faker
@@ -24,20 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.12.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: lint_roller
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rubocop
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: 1.13.0
47
+ version: 1.72.1
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: 1.13.0
54
+ version: 1.72.1
41
55
  description: A RuboCop extension for Faker.
42
56
  email:
43
57
  - koic.ito@gmail.com
@@ -63,7 +77,7 @@ files:
63
77
  - lib/rubocop/cop/faker/deprecated_arguments.rb
64
78
  - lib/rubocop/cop/faker_cops.rb
65
79
  - lib/rubocop/faker.rb
66
- - lib/rubocop/faker/inject.rb
80
+ - lib/rubocop/faker/plugin.rb
67
81
  - lib/rubocop/faker/version.rb
68
82
  - manual/cops.md
69
83
  - manual/cops_faker.md
@@ -75,6 +89,7 @@ licenses:
75
89
  metadata:
76
90
  homepage_uri: https://github.com/koic/rubocop-faker
77
91
  rubygems_mfa_required: 'true'
92
+ default_lint_roller_plugin: RuboCop::Faker::Plugin
78
93
  post_install_message:
79
94
  rdoc_options: []
80
95
  require_paths:
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Faker
5
- # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
6
- # bit of our configuration.
7
- module Inject
8
- def self.defaults!
9
- path = CONFIG_DEFAULT.to_s
10
- hash = ConfigLoader.send(:load_yaml_configuration, path)
11
- config = Config.new(hash, path)
12
- puts "configuration from #{path}" if ConfigLoader.debug?
13
- config = ConfigLoader.merge_with_default(config, path)
14
- ConfigLoader.instance_variable_set(:@default_configuration, config)
15
- end
16
- end
17
- end
18
- end