rubocop-factory_bot 2.26.1 → 2.27.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: 60519b0d051edd3ba23a10f3dfb346dc5aaed4964c489bcfabdb7d16c084cb63
4
- data.tar.gz: effac41ed4215d5cb27295cdb0a37d8c7021c309e97a8f8e6f8fdf6e385e8226
3
+ metadata.gz: 8bb85fc163eb8e9fc141bb81dbd7d7c2d0327ec605c4aa4dcc41a1bd4bf0e841
4
+ data.tar.gz: 45987a7e1a5dc366a0c16ab841a863cc2f7866a9a8cba77e58b2a0924aaddcc1
5
5
  SHA512:
6
- metadata.gz: ee33ad705e93ffa3a68240adabd9de50735819d4d82bbf66868f2efa80d489a0032fd045878bf8fd539dc7677fed9bbf9ef0e3755340b81b4fc1881220e0b24c
7
- data.tar.gz: 89936fe77a9c8f3ff5dad656b9e30455ec2f6467ac7cba1c678e63fca22396825c3859bc1830f6e766a90109cbae3eca68f64d5a110e3bbd8cebd229cf3218e9
6
+ metadata.gz: b8ebe6d629b4f2e22a081b095abe1e2e1dc34c032e4be26b9338385e7d37c7097fe85dad3ebb03e1706594becaa680b27b1119fd6e9ab661a96aaa61a9c4cbf3
7
+ data.tar.gz: b6d6fede91a931b79919d1ae081b848787de025edd2651205d83d3de641e66fe71c417c082cc79307f4661b7065105694facbf3fe0bbfbd6eeb9ba06808f03be
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 2.27.0 (2025-03-06)
6
+
7
+ - Fix a false positive for `FactoryBot/ConsistentParenthesesStyle` when using traits and omitting hash values. ([@thejonroberts])
8
+ - Make RuboCop FactoryBot work as a RuboCop plugin. ([@bquorning])
9
+
5
10
  ## 2.26.1 (2024-06-12)
6
11
 
7
12
  - Bump RuboCop requirement to +1.61. ([@ydah])
@@ -110,6 +115,7 @@
110
115
  [@seanpdoyle]: https://github.com/seanpdoyle
111
116
  [@tdeo]: https://github.com/tdeo
112
117
  [@tejasbubane]: https://github.com/tejasbubane
118
+ [@thejonroberts]: https://github.com/thejonroberts
113
119
  [@vzvu3k6k]: https://github.com/vzvu3k6k
114
120
  [@walf443]: https://github.com/walf443
115
121
  [@ybiquitous]: https://github.com/ybiquitous
data/README.md CHANGED
@@ -31,13 +31,13 @@ ways to do this:
31
31
  Put this into your `.rubocop.yml`.
32
32
 
33
33
  ```yaml
34
- require: rubocop-factory_bot
34
+ plugins: rubocop-factory_bot
35
35
  ```
36
36
 
37
37
  Alternatively, use the following array notation when specifying multiple extensions.
38
38
 
39
39
  ```yaml
40
- require:
40
+ plugins:
41
41
  - rubocop-other-extension
42
42
  - rubocop-factory_bot
43
43
  ```
@@ -45,17 +45,20 @@ require:
45
45
  Now you can run `rubocop` and it will automatically load the RuboCop factory_bot
46
46
  cops together with the standard cops.
47
47
 
48
+ > [!NOTE]
49
+ > The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
50
+
48
51
  ### Command line
49
52
 
50
53
  ```bash
51
- rubocop --require rubocop-factory_bot
54
+ rubocop --plugin rubocop-factory_bot
52
55
  ```
53
56
 
54
57
  ### Rake task
55
58
 
56
59
  ```ruby
57
60
  RuboCop::RakeTask.new do |task|
58
- task.requires << 'rubocop-factory_bot'
61
+ task.plugins << 'rubocop-factory_bot'
59
62
  end
60
63
  ```
61
64
 
@@ -79,7 +79,7 @@ module RuboCop
79
79
  def_node_matcher :omit_hash_value?, <<~PATTERN
80
80
  (send
81
81
  #factory_call? %FACTORY_CALLS
82
- {sym str send lvar}
82
+ {sym str send lvar} _*
83
83
  (hash
84
84
  <value_omission? ...>
85
85
  )
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lint_roller'
4
+
5
+ module RuboCop
6
+ module FactoryBot
7
+ # A plugin that integrates RuboCop FactoryBot with RuboCop's plugin system.
8
+ class Plugin < LintRoller::Plugin
9
+ # :nocov:
10
+ def about
11
+ LintRoller::About.new(
12
+ name: 'rubocop-factory_bot',
13
+ version: Version::STRING,
14
+ homepage: 'https://github.com/rubocop/rubocop-factory_bot',
15
+ description: 'Code style checking for FactoryBot test files.'
16
+ )
17
+ end
18
+ # :nocov:
19
+
20
+ def supported?(context)
21
+ context.engine == :rubocop
22
+ end
23
+
24
+ def rules(_context)
25
+ project_root = Pathname.new(__dir__).join('../../..')
26
+
27
+ obsoletion = project_root.join('config', 'obsoletion.yml')
28
+ ConfigObsoletion.files << obsoletion if obsoletion.exist?
29
+
30
+ LintRoller::Rules.new(
31
+ type: :path,
32
+ config_format: :rubocop,
33
+ value: project_root.join('config/default.yml')
34
+ )
35
+ end
36
+ end
37
+ end
38
+ end
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module FactoryBot
5
5
  # Version information for the factory_bot RuboCop plugin.
6
6
  module Version
7
- STRING = '2.26.1'
7
+ STRING = '2.27.0'
8
8
  end
9
9
  end
10
10
  end
@@ -7,12 +7,8 @@ require 'rubocop'
7
7
 
8
8
  require_relative 'rubocop/factory_bot/factory_bot'
9
9
  require_relative 'rubocop/factory_bot/language'
10
+ require_relative 'rubocop/factory_bot/plugin'
10
11
 
11
12
  require_relative 'rubocop/cop/factory_bot/mixin/configurable_explicit_only'
12
13
 
13
14
  require_relative 'rubocop/cop/factory_bot_cops'
14
-
15
- project_root = File.join(__dir__, '..')
16
- RuboCop::ConfigLoader.inject_defaults!(project_root)
17
- obsoletion = File.join(project_root, 'config', 'obsoletion.yml')
18
- RuboCop::ConfigObsoletion.files << obsoletion if File.exist?(obsoletion)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-factory_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.26.1
4
+ version: 2.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Backus
@@ -9,29 +9,47 @@ authors:
9
9
  - Phil Pirozhkov
10
10
  - Maxim Krizhanovsky
11
11
  - Andrew Bromwich
12
- autorequire:
13
12
  bindir: bin
14
13
  cert_chain: []
15
- date: 2024-06-11 00:00:00.000000000 Z
14
+ date: 2025-03-06 00:00:00.000000000 Z
16
15
  dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: lint_roller
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.1'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
17
30
  - !ruby/object:Gem::Dependency
18
31
  name: rubocop
19
32
  requirement: !ruby/object:Gem::Requirement
20
33
  requirements:
21
34
  - - "~>"
22
35
  - !ruby/object:Gem::Version
23
- version: '1.61'
36
+ version: '1.72'
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 1.72.1
24
40
  type: :runtime
25
41
  prerelease: false
26
42
  version_requirements: !ruby/object:Gem::Requirement
27
43
  requirements:
28
44
  - - "~>"
29
45
  - !ruby/object:Gem::Version
30
- version: '1.61'
46
+ version: '1.72'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 1.72.1
31
50
  description: |
32
51
  Code style checking for factory_bot files.
33
52
  A plugin for the RuboCop code style enforcing & linting tool.
34
- email:
35
53
  executables: []
36
54
  extensions: []
37
55
  extra_rdoc_files:
@@ -62,6 +80,7 @@ files:
62
80
  - lib/rubocop/factory_bot/description_extractor.rb
63
81
  - lib/rubocop/factory_bot/factory_bot.rb
64
82
  - lib/rubocop/factory_bot/language.rb
83
+ - lib/rubocop/factory_bot/plugin.rb
65
84
  - lib/rubocop/factory_bot/version.rb
66
85
  homepage: https://github.com/rubocop/rubocop-factory_bot
67
86
  licenses:
@@ -70,7 +89,7 @@ metadata:
70
89
  changelog_uri: https://github.com/rubocop/rubocop-factory_bot/blob/master/CHANGELOG.md
71
90
  documentation_uri: https://docs.rubocop.org/rubocop-factory_bot/
72
91
  rubygems_mfa_required: 'true'
73
- post_install_message:
92
+ default_lint_roller_plugin: RuboCop::FactoryBot::Plugin
74
93
  rdoc_options: []
75
94
  require_paths:
76
95
  - lib
@@ -85,8 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
104
  - !ruby/object:Gem::Version
86
105
  version: '0'
87
106
  requirements: []
88
- rubygems_version: 3.5.9
89
- signing_key:
107
+ rubygems_version: 3.6.2
90
108
  specification_version: 4
91
109
  summary: Code style checking for factory_bot files
92
110
  test_files: []