rubocop-capybara 2.23.0 → 3.0.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: 4d1c9d6e62bd38cf7ef34d42dcf3eabcc49cbb2ad1cb23ea96ddfb6d7b964ef0
4
- data.tar.gz: 5fe88f1d98cb8b1068c9604648f1ef18517fcd27b3552a7525913f5bcd30490d
3
+ metadata.gz: 984aeaf86c3452b30f2eab372f0ec1e1a6dcd3fb3a2efe6e6d60f4e435a9d84d
4
+ data.tar.gz: d5336d9300145f0803d3883c195cbcbdcecb0a8de54660d3fcf682166d4e8cd0
5
5
  SHA512:
6
- metadata.gz: 5f1652a43814b536fd98975128b51468b453f2665f32f97e8eb8ba9940ff92b7dd03093d29a738356bf50e11349d6b11c7e225cc23e4306bac1d94da48fd0948
7
- data.tar.gz: 9045ef2ed4d00354ca9888158c6dc6088361f476aef5105dfb120421951252d101470cdd68bdcaf71b0ae2fbebe265fab86f6b1ca0fb863603b5465f8a5c3ccb
6
+ metadata.gz: 2c08f6500d0ce4907ebea18f476a6da57411bd35b3e8c7ebe2be619efd2ef8b03999c7c5724eab4013e7febe656d043e9dd341f2cf1e4dfe8e81b945369d2e57
7
+ data.tar.gz: 578287adeb808e1c534134f17dbf2ebf4e7fe91433b90344f0704168deccc98328da9aca3210b4c653960437b788e36f067bee0b4bf7b85d5d926fbeda00b59a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Edge (Unreleased)
4
4
 
5
+ ## 3.0.0 (2026-06-22)
6
+
7
+ - Enable pending cops by default for the 3.0 release. ([@ydah])
8
+ - Remove the deprecated `Capybara/ClickLinkOrButtonStyle` cop. ([@ydah])
9
+ - Remove obsolete cop name migration config for the 2.x to 3.0 transition. ([@ydah])
10
+
5
11
  ## 2.23.0 (2026-04-30)
6
12
 
7
13
  - Bump RuboCop requirement to +1.81. ([@ydah])
data/README.md CHANGED
@@ -76,7 +76,7 @@ In your `.rubocop.yml`, you may treat the Capybara cops just like any other
76
76
  cop. For example:
77
77
 
78
78
  ```yaml
79
- Capybara/SpecificMatcher:
79
+ Capybara/RSpec/SpecificMatcher:
80
80
  Exclude:
81
81
  - spec/my_spec.rb
82
82
  ```
data/config/default.yml CHANGED
@@ -17,45 +17,38 @@ Capybara/AmbiguousClick:
17
17
 
18
18
  Capybara/AssertStyle:
19
19
  Description: Checks for usage of deprecated assert style method.
20
- Enabled: pending
20
+ Enabled: true
21
21
  VersionAdded: '2.23'
22
+ VersionChanged: '3.0'
22
23
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/AssertStyle
23
24
 
24
- Capybara/ClickLinkOrButtonStyle:
25
- Description: Checks for methods of button or link clicks.
26
- Enabled: false
27
- VersionAdded: '2.19'
28
- VersionChanged: '2.22'
29
- EnforcedStyle: link_or_button
30
- SupportedStyles:
31
- - link_or_button
32
- - strict
33
- Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/ClickLinkOrButtonStyle
34
-
35
25
  Capybara/FindAllFirst:
36
26
  Description: Enforces use of `first` instead of `all` with `first` or `[0]`.
37
- Enabled: pending
27
+ Enabled: true
38
28
  SafeAutoCorrect: false
39
29
  VersionAdded: '2.22'
40
- VersionChanged: '2.23'
30
+ VersionChanged: '3.0'
41
31
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/FindAllFirst
42
32
 
43
33
  Capybara/RedundantWithinFind:
44
34
  Description: Checks for redundant `within find(...)` calls.
45
- Enabled: pending
35
+ Enabled: true
46
36
  VersionAdded: '2.20'
37
+ VersionChanged: '3.0'
47
38
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/RedundantWithinFind
48
39
 
49
40
  Capybara/SpecificActions:
50
41
  Description: Checks for there is a more specific actions offered by Capybara.
51
- Enabled: pending
42
+ Enabled: true
52
43
  VersionAdded: '2.14'
44
+ VersionChanged: '3.0'
53
45
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/SpecificActions
54
46
 
55
47
  Capybara/SpecificFinders:
56
48
  Description: Checks if there is a more specific finder offered by Capybara.
57
- Enabled: pending
49
+ Enabled: true
58
50
  VersionAdded: '2.13'
51
+ VersionChanged: '3.0'
59
52
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/SpecificFinders
60
53
 
61
54
  Capybara/RSpec:
@@ -64,35 +57,38 @@ Capybara/RSpec:
64
57
 
65
58
  Capybara/RSpec/CurrentPathExpectation:
66
59
  Description: Checks that no expectations are set on Capybara's `current_path`.
67
- Enabled: pending
60
+ Enabled: true
68
61
  VersionAdded: '1.18'
69
- VersionChanged: '2.23'
62
+ VersionChanged: '3.0'
70
63
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/RSpec/CurrentPathExpectation
71
64
 
72
65
  Capybara/RSpec/HaveContent:
73
66
  Description: Checks for usage of `have_content` and `have_no_content`.
74
- Enabled: pending
67
+ Enabled: true
75
68
  VersionAdded: '2.23'
69
+ VersionChanged: '3.0'
76
70
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/RSpec/HaveContent
77
71
 
78
72
  Capybara/RSpec/HaveSelector:
79
73
  Description: Use `have_css` or `have_xpath` instead of `have_selector`.
80
- Enabled: pending
74
+ Enabled: true
81
75
  DefaultSelector: css
82
76
  VersionAdded: '2.19'
77
+ VersionChanged: '3.0'
83
78
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/RSpec/HaveSelector
84
79
 
85
80
  Capybara/RSpec/MatchStyle:
86
81
  Description: Checks for usage of deprecated style methods in RSpec matchers.
87
- Enabled: pending
82
+ Enabled: true
88
83
  VersionAdded: '2.23'
84
+ VersionChanged: '3.0'
89
85
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/RSpec/MatchStyle
90
86
 
91
87
  Capybara/RSpec/NegationMatcher:
92
88
  Description: Enforces use of `have_no_*` or `not_to` for negated expectations.
93
- Enabled: pending
89
+ Enabled: true
94
90
  VersionAdded: '2.14'
95
- VersionChanged: '2.23'
91
+ VersionChanged: '3.0'
96
92
  EnforcedStyle: have_no
97
93
  SupportedStyles:
98
94
  - have_no
@@ -101,14 +97,14 @@ Capybara/RSpec/NegationMatcher:
101
97
 
102
98
  Capybara/RSpec/NegationMatcherAfterVisit:
103
99
  Description: Do not allow negative matchers to be used immediately after `visit`.
104
- Enabled: pending
100
+ Enabled: true
105
101
  VersionAdded: '2.22'
106
- VersionChanged: '2.23'
102
+ VersionChanged: '3.0'
107
103
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/RSpec/NegationMatcherAfterVisit
108
104
 
109
105
  Capybara/RSpec/PredicateMatcher:
110
106
  Description: Prefer using predicate matcher over using predicate method directly.
111
- Enabled: pending
107
+ Enabled: true
112
108
  Strict: true
113
109
  EnforcedStyle: inflected
114
110
  AllowedExplicitMatchers: []
@@ -116,18 +112,19 @@ Capybara/RSpec/PredicateMatcher:
116
112
  - inflected
117
113
  - explicit
118
114
  VersionAdded: '2.19'
115
+ VersionChanged: '3.0'
119
116
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/RSpec/PredicateMatcher
120
117
 
121
118
  Capybara/RSpec/SpecificMatcher:
122
119
  Description: Checks for there is a more specific matcher offered by Capybara.
123
- Enabled: pending
120
+ Enabled: true
124
121
  VersionAdded: '2.12'
125
- VersionChanged: '2.23'
122
+ VersionChanged: '3.0'
126
123
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/RSpec/SpecificMatcher
127
124
 
128
125
  Capybara/RSpec/VisibilityMatcher:
129
126
  Description: Checks for boolean visibility in Capybara finders.
130
- Enabled: pending
127
+ Enabled: true
131
128
  VersionAdded: '1.39'
132
- VersionChanged: '2.23'
129
+ VersionChanged: '3.0'
133
130
  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/RSpec/VisibilityMatcher
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'pathname'
4
+
3
5
  require 'lint_roller'
4
6
 
5
7
  module RuboCop
@@ -24,9 +26,6 @@ module RuboCop
24
26
  def rules(_context)
25
27
  project_root = Pathname.new(__dir__).join('../../..')
26
28
 
27
- obsoletion = project_root.join('config', 'obsoletion.yml')
28
- ConfigObsoletion.files << obsoletion if obsoletion.exist?
29
-
30
29
  LintRoller::Rules.new(
31
30
  type: :path,
32
31
  config_format: :rubocop,
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Capybara
5
5
  # Version information for the Capybara RuboCop plugin.
6
6
  module Version
7
- STRING = '2.23.0'
7
+ STRING = '3.0.0'
8
8
  end
9
9
  end
10
10
  end
@@ -12,7 +12,6 @@ require_relative 'capybara/rspec/visibility_matcher'
12
12
 
13
13
  require_relative 'capybara/ambiguous_click'
14
14
  require_relative 'capybara/assert_style'
15
- require_relative 'capybara/click_link_or_button_style'
16
15
  require_relative 'capybara/find_all_first'
17
16
  require_relative 'capybara/redundant_within_find'
18
17
  require_relative 'capybara/specific_actions'
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'pathname'
4
- require 'yaml'
5
-
6
3
  require 'rubocop'
7
4
 
8
5
  require_relative 'rubocop/capybara/plugin'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.23.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yudai Takada
@@ -51,7 +51,6 @@ files:
51
51
  - MIT-LICENSE.md
52
52
  - README.md
53
53
  - config/default.yml
54
- - config/obsoletion.yml
55
54
  - lib/rubocop-capybara.rb
56
55
  - lib/rubocop/capybara/config_formatter.rb
57
56
  - lib/rubocop/capybara/cop/generator.rb
@@ -60,7 +59,6 @@ files:
60
59
  - lib/rubocop/capybara/version.rb
61
60
  - lib/rubocop/cop/capybara/ambiguous_click.rb
62
61
  - lib/rubocop/cop/capybara/assert_style.rb
63
- - lib/rubocop/cop/capybara/click_link_or_button_style.rb
64
62
  - lib/rubocop/cop/capybara/find_all_first.rb
65
63
  - lib/rubocop/cop/capybara/mixin/capybara_help.rb
66
64
  - lib/rubocop/cop/capybara/mixin/css_attributes_parser.rb
@@ -100,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
98
  - !ruby/object:Gem::Version
101
99
  version: '0'
102
100
  requirements: []
103
- rubygems_version: 4.0.6
101
+ rubygems_version: 4.0.10
104
102
  specification_version: 4
105
103
  summary: Code style checking for Capybara test files
106
104
  test_files: []
@@ -1,18 +0,0 @@
1
- #
2
- # Configuration of obsolete/deprecated cops used by `ConfigObsoletion`.
3
- #
4
- # See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions
5
- #
6
-
7
- renamed:
8
- Capybara/CurrentPathExpectation: Capybara/RSpec/CurrentPathExpectation
9
- Capybara/NegationMatcher: Capybara/RSpec/NegationMatcher
10
- Capybara/NegationMatcherAfterVisit: Capybara/RSpec/NegationMatcherAfterVisit
11
- Capybara/SpecificMatcher: Capybara/RSpec/SpecificMatcher
12
- Capybara/VisibilityMatcher: Capybara/RSpec/VisibilityMatcher
13
-
14
- split:
15
- Capybara/MatchStyle:
16
- alternatives:
17
- - Capybara/AssertStyle
18
- - Capybara/RSpec/MatchStyle
@@ -1,87 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module Capybara
6
- # Checks for methods of button or link clicks.
7
- #
8
- # This cop is deprecated.
9
- # We plan to remove this in the next major version update to 3.0.
10
- #
11
- # The migration target is `Capybara/AmbiguousClick`.
12
- # It is only migration target when `EnforcedStyle: strict`.
13
- # If you are using this cop, please plan for migration.
14
- # There is no migration target when `EnforcedStyle: link_or_button`.
15
- #
16
- # By default, prefer to use `click_link_or_button` or `click_on`.
17
- # These methods offer a weaker coupling between the test and HTML,
18
- # allowing for a more faithful reflection of how the user behaves.
19
- #
20
- # You can set `EnforcedStyle: strict` to prefer the use of
21
- # `click_link` and `click_button`, but this is a deprecated setting.
22
- #
23
- # @example EnforcedStyle: link_or_button (default)
24
- # # bad
25
- # click_link('foo')
26
- # click_button('foo')
27
- #
28
- # # good
29
- # click_link_or_button('foo')
30
- # click_on('foo')
31
- #
32
- # @example EnforcedStyle: strict
33
- # # bad
34
- # click_link_or_button('foo')
35
- # click_on('foo')
36
- #
37
- # # good
38
- # click_link('foo')
39
- # click_button('foo')
40
- #
41
- class ClickLinkOrButtonStyle < ::RuboCop::Cop::Base
42
- include ConfigurableEnforcedStyle
43
-
44
- MSG_STRICT =
45
- 'Use `click_link` or `click_button` instead of `%<method>s`.'
46
- MSG_CLICK_LINK_OR_BUTTON =
47
- 'Use `click_link_or_button` or `click_on` instead of `%<method>s`.'
48
- STRICT_METHODS = %i[click_link click_button].freeze
49
- CLICK_LINK_OR_BUTTON = %i[click_link_or_button click_on].freeze
50
- RESTRICT_ON_SEND = (STRICT_METHODS + CLICK_LINK_OR_BUTTON).freeze
51
-
52
- def on_send(node)
53
- return unless offense?(node)
54
-
55
- add_offense(node, message: offense_message(node))
56
- end
57
-
58
- private
59
-
60
- def offense?(node)
61
- (style == :strict && !strict_method?(node)) ||
62
- (style == :link_or_button && !link_or_button_method?(node))
63
- end
64
-
65
- def offense_message(node)
66
- if style == :strict
67
- format(MSG_STRICT, method: node.method_name)
68
- elsif style == :link_or_button
69
- format(MSG_CLICK_LINK_OR_BUTTON, method: node.method_name)
70
- else
71
- # :nocov:
72
- :noop
73
- # :nocov:
74
- end
75
- end
76
-
77
- def strict_method?(node)
78
- STRICT_METHODS.include?(node.method_name)
79
- end
80
-
81
- def link_or_button_method?(node)
82
- CLICK_LINK_OR_BUTTON.include?(node.method_name)
83
- end
84
- end
85
- end
86
- end
87
- end