gitlab-styles 4.1.0 → 4.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86448d470052f87f4e8cac92516a549a08101b13ce226f9f409bbab6577eae8d
|
4
|
+
data.tar.gz: 4b4e3ad68914fcdd80e5a9d208076b697237bab2d2f469b417f985eb358f380a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5be83ec65d0f6f4f019a2357d730d1c28071c40e20f230e28fcb4caa044c16c18cc0a43f6b1dd2d9bbd6e7abfe70f42dd7b5a2b25230c1ae3bfadb932169050d
|
7
|
+
data.tar.gz: a7b2d85615687f1e8bcf85b6a89da0c1e1f93e27ea4c9bca938dbc51cb37d4287f4b0a52792232650050db25a7d7dff7e11f6fa8a7f5ad0c763f82800aab660f
|
@@ -13,6 +13,7 @@ require 'gitlab/styles/rubocop/cop/without_reactive_cache'
|
|
13
13
|
require 'gitlab/styles/rubocop/cop/rspec/single_line_hook'
|
14
14
|
require 'gitlab/styles/rubocop/cop/rspec/have_link_parameters'
|
15
15
|
require 'gitlab/styles/rubocop/cop/rspec/verbose_include_metadata'
|
16
|
+
require 'gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example'
|
16
17
|
|
17
18
|
module Gitlab
|
18
19
|
module Styles
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubocop-rspec'
|
4
|
+
|
5
|
+
module Gitlab
|
6
|
+
module Styles
|
7
|
+
module Rubocop
|
8
|
+
module Cop
|
9
|
+
module RSpec
|
10
|
+
# Checks if there is an empty line after shared example blocks.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# # bad
|
14
|
+
# RSpec.describe Foo do
|
15
|
+
# it_behaves_like 'do this first'
|
16
|
+
# it_behaves_like 'does this' do
|
17
|
+
# end
|
18
|
+
# it_behaves_like 'does that' do
|
19
|
+
# end
|
20
|
+
# it_behaves_like 'do some more'
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# # good
|
24
|
+
# RSpec.describe Foo do
|
25
|
+
# it_behaves_like 'do this first'
|
26
|
+
# it_behaves_like 'does this' do
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# it_behaves_like 'does that' do
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# it_behaves_like 'do some more'
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# # fair - it's ok to have non-separated without blocks
|
36
|
+
# RSpec.describe Foo do
|
37
|
+
# it_behaves_like 'do this first'
|
38
|
+
# it_behaves_like 'does this'
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
class EmptyLineAfterSharedExample < RuboCop::Cop::RSpec::Cop
|
42
|
+
include RuboCop::RSpec::BlankLineSeparation
|
43
|
+
|
44
|
+
MSG = 'Add an empty line after `%<example>s` block.'
|
45
|
+
|
46
|
+
def_node_matcher :shared_examples,
|
47
|
+
(SharedGroups::ALL + Includes::ALL).block_pattern
|
48
|
+
|
49
|
+
def on_block(node)
|
50
|
+
shared_examples(node) do
|
51
|
+
break if last_child?(node)
|
52
|
+
|
53
|
+
missing_separating_line(node) do |location|
|
54
|
+
add_offense(node,
|
55
|
+
location: location,
|
56
|
+
message: format(MSG, example: node.method_name))
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/rubocop-rspec.yml
CHANGED
@@ -36,6 +36,10 @@ RSpec/EmptyExampleGroup:
|
|
36
36
|
- it_should_email!
|
37
37
|
- it_should_not_email!
|
38
38
|
|
39
|
+
# Checks if there is an empty line after shared example blocks.
|
40
|
+
RSpec/EmptyLineAfterSharedExample:
|
41
|
+
Enabled: true
|
42
|
+
|
39
43
|
# Checks for long example.
|
40
44
|
RSpec/ExampleLength:
|
41
45
|
Enabled: false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-styles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb
|
156
156
|
- lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb
|
157
157
|
- lib/gitlab/styles/rubocop/cop/redirect_with_status.rb
|
158
|
+
- lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example.rb
|
158
159
|
- lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb
|
159
160
|
- lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb
|
160
161
|
- lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb
|
@@ -195,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
196
|
- !ruby/object:Gem::Version
|
196
197
|
version: '0'
|
197
198
|
requirements: []
|
198
|
-
rubygems_version: 3.1.
|
199
|
+
rubygems_version: 3.1.3
|
199
200
|
signing_key:
|
200
201
|
specification_version: 4
|
201
202
|
summary: GitLab style guides and shared style configs.
|