rubocop-factory_bot 2.25.0 → 2.25.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7993f668b5e14662f3d5d7a7c5252d1bdbc019320d5a364f9ab8645b3ca022ef
|
4
|
+
data.tar.gz: a69f938e6e63b6b12c76f64e3d62cda12b33f2a58fec11af1df2e321e8f19e32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e74eab6cd66daf17505e8452b5e422084ecf14d3ffe73fd6321197c4134fac3d0d8d9f1a34c67e92be5f2beae7e81bbfcd68c4bb5e1a39b69d778d7915c22118
|
7
|
+
data.tar.gz: 2410c754ae9bb83837d5c924ff2c4cfb022ec00e36c9768b9b6b60ad4ff5efa8fee51aa94f3f0ad48e7083910b70fb189613f6488c8551e44737f9e0e5cdc25c
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## Master (Unreleased)
|
4
4
|
|
5
|
+
## 2.25.1 (2024-01-08)
|
6
|
+
|
7
|
+
- Fix a false positive for `FactoryBot/CreateList` when create call does have method calls and repeat multiple times with other argument. ([@ydah])
|
8
|
+
- Fix an error occurred for `FactoryBot/IdSequence` when `sequence` with non-symbol argument or without argument. ([@ydah])
|
9
|
+
|
5
10
|
## 2.25.0 (2024-01-04)
|
6
11
|
|
7
12
|
- Fix a false positive for `FactoryBot/FactoryNameStyle` when namespaced models. ([@ydah])
|
@@ -69,7 +69,7 @@ module RuboCop
|
|
69
69
|
RESTRICT_ON_SEND = %i[create_list].freeze
|
70
70
|
|
71
71
|
# @!method repeat_count(node)
|
72
|
-
def_node_matcher :repeat_count,
|
72
|
+
def_node_matcher :repeat_count, <<~PATTERN
|
73
73
|
(block
|
74
74
|
{
|
75
75
|
(send (const {nil? cbase} :Array) :new (int $_)) # Array.new(3) { create(:user) }
|
@@ -90,7 +90,7 @@ module RuboCop
|
|
90
90
|
|
91
91
|
# @!method arguments_include_method_call?(node)
|
92
92
|
def_node_matcher :arguments_include_method_call?, <<~PATTERN
|
93
|
-
(send #factory_call? :create sym `(send ...))
|
93
|
+
(send #factory_call? :create sym ... `(send ...))
|
94
94
|
PATTERN
|
95
95
|
|
96
96
|
# @!method factory_call(node)
|
@@ -104,7 +104,7 @@ module RuboCop
|
|
104
104
|
PATTERN
|
105
105
|
|
106
106
|
# @!method factory_calls_in_array?(node)
|
107
|
-
def_node_search :factory_calls_in_array?,
|
107
|
+
def_node_search :factory_calls_in_array?, <<~PATTERN
|
108
108
|
(array #factory_call+)
|
109
109
|
PATTERN
|
110
110
|
|
@@ -19,12 +19,15 @@ module RuboCop
|
|
19
19
|
class IdSequence < ::RuboCop::Cop::Base
|
20
20
|
extend AutoCorrector
|
21
21
|
include RangeHelp
|
22
|
+
include RuboCop::FactoryBot::Language
|
22
23
|
|
23
24
|
MSG = 'Do not create a sequence for an id attribute'
|
24
25
|
RESTRICT_ON_SEND = %i[sequence].freeze
|
25
26
|
|
26
27
|
def on_send(node)
|
27
|
-
return unless node.
|
28
|
+
return unless node.receiver.nil? || factory_bot?(node.receiver)
|
29
|
+
return unless node.first_argument&.sym_type? &&
|
30
|
+
node.first_argument.value == :id
|
28
31
|
|
29
32
|
add_offense(node) do |corrector|
|
30
33
|
range_to_remove = range_by_whole_lines(
|
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.25.
|
4
|
+
version: 2.25.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Backus
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2024-01-
|
15
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rubocop
|
@@ -20,14 +20,14 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - "~>"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '1.
|
23
|
+
version: '1.41'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
28
|
- - "~>"
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: '1.
|
30
|
+
version: '1.41'
|
31
31
|
description: |
|
32
32
|
Code style checking for factory_bot files.
|
33
33
|
A plugin for the RuboCop code style enforcing & linting tool.
|