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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b607bc3ba0d08d4f74b90299d806b4c3e9947c1222e6619913c2a58a42ca54c5
4
- data.tar.gz: b6ae2064eca55a0439e888b885f75c16e400228115264681cb90c6a606a6ea2a
3
+ metadata.gz: '092c0b9f7e49f8026e01360663777f4da3bad6dab2d3a35c6d732515a5024769'
4
+ data.tar.gz: a4fedfcc2fab4fb3181879e3161749b8ce8f7728a99c8c9559f8cf9811d9bbdb
5
5
  SHA512:
6
- metadata.gz: 3b8874f14ab1f1086d340f18cba3a7509fef83f26ad781aeb905712f06aa3f3cde68909801a50da1d615bbaf2abe7ef7bdf266abdf426eeaa8fa4895b1450a2c
7
- data.tar.gz: 5e6396f1f0a6ef3ab06a460c19443066390229f40b32a107f9e343f4c016e2e23f18eb285cd01869ac7613c90065c69633fd906514ec179a65f157fbbc72c64f
6
+ metadata.gz: ebb9898fb0ff12ba32d223d485d00df8e19fb9296f6355cfaf72c1f504e989a3f0ace8014656045a8f186a1f03ef9be1878e93ea06ea2af09145a02d95e11938
7
+ data.tar.gz: 196d46ad4b595304348a92ace8610ff66554c25ea8c8c44a33addd234e401beb2e0256e4163f14133f8d67204266dccc8646dbc3c2c75f548f239ff7623d772d
data/.gitignore CHANGED
@@ -6,3 +6,5 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ Gemfile.lock
10
+ *.gem
@@ -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
@@ -1,3 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "netlify/request_tests_param_encoding"
4
+ require_relative "netlify/sidekiq_keyword_arguments"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Netlify
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  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.1.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-04-09 00:00:00.000000000 Z
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