rubocop-netlify 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/rubocop/cop/netlify/sidekiq_keyword_arguments.rb +37 -0
- data/lib/rubocop/cop/netlify_cops.rb +1 -0
- data/lib/rubocop/netlify/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '092c0b9f7e49f8026e01360663777f4da3bad6dab2d3a35c6d732515a5024769'
|
4
|
+
data.tar.gz: a4fedfcc2fab4fb3181879e3161749b8ce8f7728a99c8c9559f8cf9811d9bbdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebb9898fb0ff12ba32d223d485d00df8e19fb9296f6355cfaf72c1f504e989a3f0ace8014656045a8f186a1f03ef9be1878e93ea06ea2af09145a02d95e11938
|
7
|
+
data.tar.gz: 196d46ad4b595304348a92ace8610ff66554c25ea8c8c44a33addd234e401beb2e0256e4163f14133f8d67204266dccc8646dbc3c2c75f548f239ff7623d772d
|
data/.gitignore
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Netlify
|
6
|
+
# This cop checks the usage of keyword arguments in Sidekiq workers.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# # bad
|
10
|
+
# def perform(user_id, name:)
|
11
|
+
#
|
12
|
+
# # good
|
13
|
+
# def perform(user_id, name)
|
14
|
+
class SidekiqKeywordArguments < Cop
|
15
|
+
MSG = "Avoid keyword arguments in workers"
|
16
|
+
OBSERVED_METHOD = :perform
|
17
|
+
|
18
|
+
def on_def(node)
|
19
|
+
return if node.method_name != OBSERVED_METHOD
|
20
|
+
|
21
|
+
node.arguments.each do |argument|
|
22
|
+
if keyword_argument?(argument)
|
23
|
+
add_offense(node, location: :expression)
|
24
|
+
break
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def keyword_argument?(argument)
|
32
|
+
argument.type == :kwarg || argument.type == :kwoptarg
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-netlify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esteban Pastorino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- bin/setup
|
56
56
|
- lib/rubocop-netlify.rb
|
57
57
|
- lib/rubocop/cop/netlify/request_tests_param_encoding.rb
|
58
|
+
- lib/rubocop/cop/netlify/sidekiq_keyword_arguments.rb
|
58
59
|
- lib/rubocop/cop/netlify_cops.rb
|
59
60
|
- lib/rubocop/netlify.rb
|
60
61
|
- lib/rubocop/netlify/version.rb
|