sevencop 0.44.0 → 0.45.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4a073f5b385308c7b105b2d11310c12a6229eac04694cb44bcf4e8af1b6b05a
4
- data.tar.gz: 3aa8ed6a5880381f800fff2312939a35aebd225616bd91c073373ad2f48c25a9
3
+ metadata.gz: 6397930dce89363902d194be1a0b259969d18fcf1224068130f9959178c77ff8
4
+ data.tar.gz: 51efafab1bd74a671469f4aca611d47892a9cefd3d862ce9795e444b57bbffca
5
5
  SHA512:
6
- metadata.gz: 296aae3f377473ffc650d3c61935d2d1126ea8b82a78335deef530e32841fc3d34228a0b203d454eac4ec626c0c32d6a876f1968ece38682c3e58eb187a7fdc9
7
- data.tar.gz: f95da5da6b03c6c88484e205184a048670f3c41b8fbbf7642f9f0c19908c655b0d2885e5bde3bf68959b92211e5c96a8cbd8d7410999320ac0936b94b282c292
6
+ metadata.gz: 255171a35cbf105447f400f82e8ecce903a478a9b9dd3fff3e270ad9ee4b78a72c7f66502bfbae9c3d02d717a6787cc40d97a1f608c587563566b6d96f613a2d
7
+ data.tar.gz: 5a985d8e7ffd6fe1442f1f8992987618878bacbde3ea36137cb68d36340f66149d94653cd14e3bfe6640dc877eafbef34874514b59271d8ce58df7adfaf69dc4
data/.rubocop.yml CHANGED
@@ -43,6 +43,7 @@ RSpec/SpecFilePathFormat:
43
43
  RSpecExamplesInSameGroup: rspec_examples_in_same_group
44
44
  RSpecMatcherConsistentParentheses: rspec_matcher_consistent_parentheses
45
45
  RSpecMemoizedHelperBlockDelimiter: rspec_memoized_helper_block_delimiter
46
+ RSpecPendingOnlyExampleGroup: rspec_pending_only_example_group
46
47
  RSpecRailsHaveHttpStatus: rspec_rails_have_http_status
47
48
  RSpecRailsStatusCodeCheckBySubject: rspec_rails_status_code_check_by_subject
48
49
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sevencop (0.44.0)
4
+ sevencop (0.45.0)
5
5
  activesupport
6
6
  rubocop
7
7
 
data/README.md CHANGED
@@ -49,6 +49,7 @@ Note that all cops are `Enabled: false` by default.
49
49
  - [Sevencop/RSpecExamplesInSameGroup](lib/rubocop/cop/sevencop/rspec_examples_in_same_group.rb)
50
50
  - [Sevencop/RSpecMatcherConsistentParentheses](lib/rubocop/cop/sevencop/rspec_matcher_consistent_parentheses.rb)
51
51
  - [Sevencop/RSpecMemoizedHelperBlockDelimiter](lib/rubocop/cop/sevencop/rspec_memoized_helper_block_delimiter.rb)
52
+ - [Sevencop/RSpecPendingOnlyExampleGroup](lib/rubocop/cop/sevencop/rspec_pending_only_example_group.rb)
52
53
  - [Sevencop/RSpecRailsHaveHttpStatus](lib/rubocop/cop/sevencop/rspec_rails_have_http_status.rb)
53
54
  - [Sevencop/RSpecRailsStatusCodeCheckBySubject](lib/rubocop/cop/sevencop/rspec_rails_status_code_check_by_subject.rb)
54
55
 
data/config/default.yml CHANGED
@@ -142,6 +142,12 @@ Sevencop/RSpecMemoizedHelperBlockDelimiter:
142
142
  Include:
143
143
  - "**/spec/**/*.rb"
144
144
 
145
+ Sevencop/RSpecPendingOnlyExampleGroup:
146
+ Description: Remove pending-only test files.
147
+ Enabled: false
148
+ Include:
149
+ - "**/spec/**/*.rb"
150
+
145
151
  Sevencop/RSpecRailsHaveHttpStatus:
146
152
  Description: |
147
153
  Always check status code with `have_http_status`.
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Sevencop
6
+ # Remove pending-only test files.
7
+ #
8
+ # @example
9
+ # # bad
10
+ # RSpec.describe Post do
11
+ # pending "add some examples to (or delete) #{__FILE__}"
12
+ # end
13
+ class RSpecPendingOnlyExampleGroup < ::RuboCop::Cop::Base
14
+ MSG = 'Remove pending-only test files.'
15
+
16
+ RESTRICT_ON_SEND = %i[
17
+ describe
18
+ ].freeze
19
+
20
+ def on_send(node)
21
+ block_node = node.parent
22
+ return unless pending_only_example_group?(block_node)
23
+
24
+ add_offense(block_node)
25
+ end
26
+
27
+ private
28
+
29
+ # @!method pending_only_example_group?(node)
30
+ def_node_matcher :pending_only_example_group?, <<~PATTERN
31
+ (block
32
+ (send (const nil? :RSpec) :describe ...)
33
+ (args)
34
+ (send nil? :pending ...)
35
+ )
36
+ PATTERN
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sevencop
4
- VERSION = '0.44.0'
4
+ VERSION = '0.45.0'
5
5
  end
data/lib/sevencop.rb CHANGED
@@ -25,5 +25,6 @@ require_relative 'rubocop/cop/sevencop/rspec_empty_line_after_let'
25
25
  require_relative 'rubocop/cop/sevencop/rspec_examples_in_same_group'
26
26
  require_relative 'rubocop/cop/sevencop/rspec_matcher_consistent_parentheses'
27
27
  require_relative 'rubocop/cop/sevencop/rspec_memoized_helper_block_delimiter'
28
+ require_relative 'rubocop/cop/sevencop/rspec_pending_only_example_group'
28
29
  require_relative 'rubocop/cop/sevencop/rspec_rails_have_http_status'
29
30
  require_relative 'rubocop/cop/sevencop/rspec_rails_status_code_check_by_subject'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sevencop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.44.0
4
+ version: 0.45.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
@@ -77,6 +77,7 @@ files:
77
77
  - lib/rubocop/cop/sevencop/rspec_examples_in_same_group.rb
78
78
  - lib/rubocop/cop/sevencop/rspec_matcher_consistent_parentheses.rb
79
79
  - lib/rubocop/cop/sevencop/rspec_memoized_helper_block_delimiter.rb
80
+ - lib/rubocop/cop/sevencop/rspec_pending_only_example_group.rb
80
81
  - lib/rubocop/cop/sevencop/rspec_rails_have_http_status.rb
81
82
  - lib/rubocop/cop/sevencop/rspec_rails_status_code_check_by_subject.rb
82
83
  - lib/sevencop.rb