rubocop-openproject 0.2.0 → 0.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: 1b7762dbbe159ef129537b0da6ca121fde8f6417a92ae9d55acff9af82002456
4
- data.tar.gz: f1193f7c4cf3b908b52a29649927a6e73a5f39376a79e69e0c0540461600ed01
3
+ metadata.gz: 216a0869e29d95a92306d0d02e2bc340b7914733f86d56c4f27cce5fbcf8e466
4
+ data.tar.gz: d3ca3bc8f408a56843a5cbd7f8d69a8a1eadc6bda76c5ea8139201181a1e0de8
5
5
  SHA512:
6
- metadata.gz: 8d78e20f34afc1d1ac0ffcafa68a1a0953e49b7952d62e0ced2f78866500c43708294f5131796e0e2583c0aa0eab031fdfe818f063184313ef5747642ffcca21
7
- data.tar.gz: 0d590796e0332ab1679f46062f967d4ab0bee76a97f7f7dc85617dc1186e60437e08071c4c1b6e6981a17fd2262e834fcd9294eb53c1751f9c31d81f1d85a5ff
6
+ metadata.gz: 7041d99b3774a92ae145c93bf64ec52628aee9b04ebd08b04a3803c2d662f956404893306d8274762d0b1050c2f6787b135cc15f58d514e0d508bc8673487881
7
+ data.tar.gz: 989852deeca12ee26502f448d85e660f6539fca125cd5f174650acf2646da07eef463db5aa025c30d46976484730d2bc0cd363d9953af42fb25f688e24fd3541
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2025-07-11
4
+
5
+ - Remove redundant NoDoEndBlockWithRSpecCapybaraMatcherInExpect cop
6
+
3
7
  ## [0.2.0] - 2024-10-18
4
8
 
5
9
  - Add `OpenProject/NoSleepInFeatureSpecs` cop to check that `sleep` calls in
data/README.md CHANGED
@@ -26,6 +26,15 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
26
26
 
27
27
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
28
 
29
+ ## Releasing
30
+
31
+ 1. Update the version in `lib/rubocop/open_project/version.rb`
32
+ 2. Update the changelog in `CHANGELOG.md`
33
+ 3. Run `bundle install` to update `Gemfile.lock`
34
+ 4. Run `rake` to check everything is fine and fix any issues
35
+ 5. Commit your changes (`git commit -am 'Prepare release X.Y.Z'`)
36
+ 6. Run `bundle exec rake release`
37
+
29
38
  ## Contributing
30
39
 
31
40
  Bug reports and pull requests are welcome on GitHub at https://github.com/opf/rubocop-openproject.
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "open_project/add_preview_for_view_component"
4
- require_relative "open_project/no_do_end_block_with_rspec_capybara_matcher_in_expect"
5
4
  require_relative "open_project/use_service_result_factory_methods"
6
5
  require_relative "open_project/no_sleep_in_feature_specs"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module OpenProject
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-openproject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenProject GmbH
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 2024-10-18 00:00:00.000000000 Z
11
+ date: 2025-07-11 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: rubocop
@@ -39,7 +40,6 @@ files:
39
40
  - config/default.yml
40
41
  - lib/rubocop-openproject.rb
41
42
  - lib/rubocop/cop/open_project/add_preview_for_view_component.rb
42
- - lib/rubocop/cop/open_project/no_do_end_block_with_rspec_capybara_matcher_in_expect.rb
43
43
  - lib/rubocop/cop/open_project/no_sleep_in_feature_specs.rb
44
44
  - lib/rubocop/cop/open_project/use_service_result_factory_methods.rb
45
45
  - lib/rubocop/cop/open_project_cops.rb
@@ -54,6 +54,7 @@ metadata:
54
54
  source_code_uri: https://github.com/opf/rubocop-openproject
55
55
  changelog_uri: https://github.com/opf/rubocop-openproject/blob/main/CHANGELOG.md
56
56
  rubygems_mfa_required: 'true'
57
+ post_install_message:
57
58
  rdoc_options: []
58
59
  require_paths:
59
60
  - lib
@@ -68,7 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
69
  - !ruby/object:Gem::Version
69
70
  version: '0'
70
71
  requirements: []
71
- rubygems_version: 3.6.0.dev
72
+ rubygems_version: 3.5.11
73
+ signing_key:
72
74
  specification_version: 4
73
75
  summary: RuboCop cops for OpenProject
74
76
  test_files: []
@@ -1,89 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module OpenProject
6
- # As +do .. end+ block has less precedence than method call, a +do .. end+
7
- # block at the end of a rspec matcher will be an argument to the +to+ method,
8
- # which is not handled by Capybara matchers (teamcapybara/capybara/#2616).
9
- #
10
- # @example
11
- #
12
- # # bad
13
- # expect(page).to have_selector("input") do |input|
14
- # input.value == "hello world"
15
- # end
16
- #
17
- # # good
18
- # expect(page).to have_selector("input") { |input| input.value == "hello world" }
19
- #
20
- # # good
21
- # expect(page).to have_selector("input", value: "hello world")
22
- #
23
- # # good
24
- # match_input_with_hello_world = have_selector("input") do |input|
25
- # input.value == "hello world"
26
- # end
27
- # expect(page).to match_input_with_hello_world
28
- #
29
- # # good
30
- # expect(foo).to have_received(:bar) do |arg|
31
- # arg == :baz
32
- # end
33
- #
34
- class NoDoEndBlockWithRSpecCapybaraMatcherInExpect < Base
35
- CAPYBARA_MATCHER_METHODS = %w[selector css xpath text title current_path link button
36
- field checked_field unchecked_field select table
37
- sibling ancestor].flat_map do |matcher_type|
38
- ["have_#{matcher_type}", "have_no_#{matcher_type}"]
39
- end
40
-
41
- MSG = "The `do .. end` block is associated with `to` and not with Capybara matcher `%<matcher_method>s`."
42
-
43
- def_node_matcher :expect_to_with_block?, <<~PATTERN
44
- # ruby-parse output
45
- (block
46
- (send
47
- (send nil? :expect ...)
48
- :to
49
- ...
50
- )
51
- ...
52
- )
53
- PATTERN
54
-
55
- def_node_matcher :rspec_matcher, <<~PATTERN
56
- (send
57
- (send nil? :expect...)
58
- :to
59
- (:send nil? $_matcher_method ...)
60
- )
61
- PATTERN
62
-
63
- def on_block(node)
64
- return unless expect_to_with_block?(node)
65
- return unless capybara_matcher?(node)
66
-
67
- add_offense(offense_range(node), message: offense_message(node))
68
- end
69
-
70
- private
71
-
72
- def capybara_matcher?(node)
73
- matcher_name = node.send_node.arguments.first.method_name.to_s
74
- CAPYBARA_MATCHER_METHODS.include?(matcher_name)
75
- end
76
-
77
- def offense_range(node)
78
- node.send_node.loc.selector.join(node.loc.end)
79
- end
80
-
81
- def offense_message(node)
82
- rspec_matcher(node.send_node) do |matcher_method|
83
- format(MSG, matcher_method:)
84
- end
85
- end
86
- end
87
- end
88
- end
89
- end