gitlab-styles 6.1.0 → 6.2.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: 7ffdef3ce888f639822f2931093c590fa0ef9979fc38ec290f4a7b4a18393b55
4
- data.tar.gz: d22d5faa3fbcafe4a899ad1f8315813a5b8dd0d2e9c0baa2aa80cfcf2c56f12a
3
+ metadata.gz: 8de6943529f148b2e25546b043835e1d00cb06b4b9c88124457b9556830e7c29
4
+ data.tar.gz: 44f5b72122c8626318a1914eec7e3e462eeab5c479393d2f526b6e4937123131
5
5
  SHA512:
6
- metadata.gz: 31dc65dd2a632d76307e85f9350babbda6032e9934fa9a6a363a5aecab344ef744a741f5f69c185eea7826391cfea4ad5f02ccda540f35b3b0baf9cecf331e65
7
- data.tar.gz: b39f7fead8a619e687543a451a31870b9f3c05f7c06e88b16e2d120c5ae28e71e33edbc333660ce5e8560daee737870f7049f7f2cde776ad21bfd092efab52b6
6
+ metadata.gz: 35e146b2b436d9801ee242f8867662be1b3b9febe1f6b55eebf951fbe676dfdfffd93d3f0615928940a0b68bcc5e8ea049c23ac035a468db235f28464c32e648
7
+ data.tar.gz: 9352b19250deedf7a716c576ab3f54b18e855dca95f5a18ed204bbe34ef7d395ed27a75e2dfe7ad00969552f28f474550053e8479e15c35487defe4f73bc9646
data/.gitlab-ci.yml CHANGED
@@ -14,8 +14,8 @@ workflow:
14
14
  rules:
15
15
  # For merge requests, create a pipeline.
16
16
  - if: '$CI_MERGE_REQUEST_IID'
17
- # For `master` branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
18
- - if: '$CI_COMMIT_BRANCH == "master"'
17
+ # For the default branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
18
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
19
19
  # For tags, create a pipeline.
20
20
  - if: '$CI_COMMIT_TAG'
21
21
 
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubocop-rspec'
4
+ require_relative 'base'
5
+
6
+ module Gitlab
7
+ module Styles
8
+ module Rubocop
9
+ module Cop
10
+ module RSpec
11
+ # Checks if there is an empty line after the last `let_it_be` block.
12
+ #
13
+ # @example
14
+ # # bad
15
+ # let_it_be(:foo) { bar }
16
+ # let_it_be(:something) { other }
17
+ # it { does_something }
18
+ #
19
+ # # good
20
+ # let_it_be(:foo) { bar }
21
+ # let_it_be(:something) { other }
22
+ #
23
+ # it { does_something }
24
+ class EmptyLineAfterFinalLetItBe < Base
25
+ extend RuboCop::Cop::AutoCorrector
26
+ include RuboCop::RSpec::EmptyLineSeparation
27
+
28
+ MSG = 'Add an empty line after the last `let_it_be`.'
29
+
30
+ def_node_matcher :let_it_be?, <<-PATTERN
31
+ {
32
+ (block (send #rspec? {:let_it_be :let_it_be_with_refind :let_it_be_with_reload} ...) ...)
33
+ (send #rspec? {:let_it_be :let_it_be_with_refind :let_it_be_with_reload} _ block_pass)
34
+ }
35
+ PATTERN
36
+
37
+ def on_block(node)
38
+ return unless example_group_with_body?(node)
39
+
40
+ final_let_it_be = node.body.child_nodes.reverse.find { |child| let_it_be?(child) }
41
+
42
+ return if final_let_it_be.nil?
43
+
44
+ missing_separating_line_offense(final_let_it_be) { MSG }
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -9,7 +9,8 @@ module Gitlab
9
9
  module Helpers
10
10
  include RuboCop::RSpec::Language
11
11
 
12
- LET = SelectorSet.new(%i[let_it_be]) + RuboCop::RSpec::Language::Helpers::ALL
12
+ LET_IT_BE_HELPERS = SelectorSet.new(%i[let_it_be let_it_be_with_refind let_it_be_with_reload])
13
+ LET = LET_IT_BE_HELPERS + RuboCop::RSpec::Language::Helpers::ALL
13
14
  end
14
15
  end
15
16
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Styles
5
- VERSION = '6.1.0'
5
+ VERSION = '6.2.0'
6
6
  end
7
7
  end
@@ -35,6 +35,12 @@ Performance/DoubleStartEndWith:
35
35
  Performance/MethodObjectAsBlock: # (new in 1.9)
36
36
  Enabled: true
37
37
 
38
+ # Use `Struct.new(..., keyword_init: true)` instead of `OpenStruct.new(...)`.
39
+ Performance/OpenStruct:
40
+ Enabled: true
41
+ Exclude:
42
+ - 'spec/**/*'
43
+
38
44
  # Use `Range#cover?` instead of `Range#include?`.
39
45
  Performance/RangeInclude:
40
46
  Enabled: true
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: 6.1.0
4
+ version: 6.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: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -166,6 +166,7 @@ files:
166
166
  - lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb
167
167
  - lib/gitlab/styles/rubocop/cop/redirect_with_status.rb
168
168
  - lib/gitlab/styles/rubocop/cop/rspec/base.rb
169
+ - lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_final_let_it_be.rb
169
170
  - lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block.rb
170
171
  - lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example.rb
171
172
  - lib/gitlab/styles/rubocop/cop/rspec/example_starting_character.rb