gitlab-styles 2.4.1 → 2.5.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: aeca885328893c47690fb115fdc821e2255fb7e21142a6edbf2611903aa02a2a
4
- data.tar.gz: 225b86b35e811c7757619520e93b63caf65c62039d26938d07a8b8803c7f141c
3
+ metadata.gz: e5456ef238c551c2da10ce79b0156c917d2508018d583e116548e9d16ac17341
4
+ data.tar.gz: a27c84b492eaabdaa294821443f319eb2b123e4537af2a6471ef82c928417e25
5
5
  SHA512:
6
- metadata.gz: ed7b77a8f0f191d2db69628e3d38c574b53b667da357cb5776c1d0fda05e28ce8e5b66c1275f202bd6d9e721a2e1c28aa00cb17548dddf09e4064a9109c43c4c
7
- data.tar.gz: 682b6007b316b01c6b3f13d8b3c2b0cdf7d3f00adbe8901d71ebfd1f8dee622c0afadc0748d31e61b407c517399416c22bbb24cb958be798aacc960b2f042050
6
+ metadata.gz: 1c2634e54f417f5efb69acdd10f708b3a6b91fb368303249ca44f3f7936180f59c2b939ca47252ccd59b9beabf5b7bec0b48a60ab5f98380231c0f5a27ad1393
7
+ data.tar.gz: d5561e402bfc11239cd1964f432bdac38e0781281e29dcf0da99e124aaf550133fdd047470a1920689ac30ec21711749f68183200593e0ed6e4b608c1ef6d55c
@@ -0,0 +1,41 @@
1
+ require 'rubocop-rspec'
2
+
3
+ module Gitlab
4
+ module Styles
5
+ module Rubocop
6
+ module Cop
7
+ module RSpec
8
+ # This cop checks for unused parameters to the `have_link` matcher.
9
+ #
10
+ # @example
11
+ #
12
+ # # bad
13
+ # expect(page).to have_link('Link', 'https://example.com')
14
+ #
15
+ # # good
16
+ # expect(page).to have_link('Link', href: 'https://example.com')
17
+ # expect(page).to have_link('Example')
18
+ class HaveLinkParameters < RuboCop::Cop::RSpec::Cop
19
+ MESSAGE = "The second argument to `have_link` should be a Hash.".freeze
20
+
21
+ def_node_matcher :unused_parameters?, <<~PATTERN
22
+ (send nil? :have_link
23
+ _ !{hash nil}
24
+ )
25
+ PATTERN
26
+
27
+ def on_send(node)
28
+ return unless unused_parameters?(node)
29
+
30
+ location = node.arguments[1..-1]
31
+ .map(&:source_range)
32
+ .reduce(:join)
33
+
34
+ add_offense(node, location: location, message: MESSAGE)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Styles
3
- VERSION = '2.4.1'.freeze
3
+ VERSION = '2.5.0'.freeze
4
4
  end
5
5
  end
@@ -52,7 +52,7 @@ Rails/HasAndBelongsToMany:
52
52
  # `put`, `patch` without the usage of keyword arguments in your tests and
53
53
  # change them to use keyword args.
54
54
  Rails/HttpPositionalArguments:
55
- Enabled: false
55
+ Enabled: true
56
56
 
57
57
  # Checks for calls to puts, print, etc.
58
58
  Rails/Output:
@@ -62,10 +62,6 @@ RSpec/ExpectOutput:
62
62
  RSpec/FilePath:
63
63
  Enabled: true
64
64
  IgnoreMethods: true
65
- Exclude:
66
- - 'qa/**/*'
67
- - 'spec/javascripts/fixtures/*'
68
- - 'spec/requests/api/v3/*'
69
65
 
70
66
  # Checks if there are focused specs.
71
67
  RSpec/Focus:
@@ -76,6 +72,10 @@ RSpec/HookArgument:
76
72
  Enabled: true
77
73
  EnforcedStyle: implicit
78
74
 
75
+ # Checks for unused parameters to the `have_link` matcher.
76
+ RSpec/HaveLinkParameters:
77
+ Enabled: true
78
+
79
79
  # Configuration parameters: EnforcedStyle, SupportedStyles.
80
80
  # SupportedStyles: is_expected, should
81
81
  RSpec/ImplicitExpect:
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: 2.4.1
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2018-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -125,6 +125,7 @@ files:
125
125
  - lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb
126
126
  - lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb
127
127
  - lib/gitlab/styles/rubocop/cop/redirect_with_status.rb
128
+ - lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb
128
129
  - lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb
129
130
  - lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb
130
131
  - lib/gitlab/styles/rubocop/migration_helpers.rb
@@ -163,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
164
  version: '0'
164
165
  requirements: []
165
166
  rubyforge_project:
166
- rubygems_version: 2.7.7
167
+ rubygems_version: 2.7.6
167
168
  signing_key:
168
169
  specification_version: 4
169
170
  summary: GitLab style guides and shared style configs.