gitlab-styles 2.4.1 → 2.5.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 +4 -4
- data/lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb +41 -0
- data/lib/gitlab/styles/version.rb +1 -1
- data/rubocop-rails.yml +1 -1
- data/rubocop-rspec.yml +4 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5456ef238c551c2da10ce79b0156c917d2508018d583e116548e9d16ac17341
|
4
|
+
data.tar.gz: a27c84b492eaabdaa294821443f319eb2b123e4537af2a6471ef82c928417e25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/rubocop-rails.yml
CHANGED
@@ -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:
|
55
|
+
Enabled: true
|
56
56
|
|
57
57
|
# Checks for calls to puts, print, etc.
|
58
58
|
Rails/Output:
|
data/rubocop-rspec.yml
CHANGED
@@ -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
|
+
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-
|
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.
|
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.
|