rubocop-nri 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/rubocop-nri.rb +3 -0
- data/lib/rubocop/cop/nri/more_rollbar_information.rb +38 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 40c6c0d0946c8de00446f8952a2fc29eb58b1475
|
4
|
+
data.tar.gz: 94a2e3171b53360d0cddc182932d9fc2ae54600e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b191c5c987d078e57eccb36cb7366cb18c603fc0e97218ba416c11c7fcd2bb293c27cca712d045e4740191162b4c2eec2987a02b31d9ad4b074cc35b0ff2196a
|
7
|
+
data.tar.gz: 13d51f4abb5813014a83d2f5b9d5a5f5b7f020e2651a46962a394583ed95105473fefcced9a1c42a6fa37a3800f55158788f2665b635d5e4cc0e5e126736e613
|
data/lib/rubocop-nri.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Nri
|
6
|
+
##
|
7
|
+
# Catches uses of Rollbar missing `advisory` and `impact` keywords.
|
8
|
+
class MoreRollbarInformation < Cop
|
9
|
+
MSG = 'Must include advisory and impact as keyword arguments.'
|
10
|
+
|
11
|
+
def_node_matcher :missing_fields?, <<-PATTERN
|
12
|
+
{(send (const nil :Rollbar) {:critical :error} ... (hash $...))}
|
13
|
+
PATTERN
|
14
|
+
|
15
|
+
def_node_matcher :advisory?, <<-PATTERN
|
16
|
+
(pair (sym :advisory) _)
|
17
|
+
PATTERN
|
18
|
+
|
19
|
+
def_node_matcher :impact?, <<-PATTERN
|
20
|
+
(pair (sym :impact) _)
|
21
|
+
PATTERN
|
22
|
+
|
23
|
+
def on_send(node)
|
24
|
+
missing_fields?(node) do |pairs|
|
25
|
+
add_offense(node, :expression) unless all_fields?(pairs)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def all_fields?(pairs)
|
32
|
+
pairs.any? { |pair| advisory?(pair) } &&
|
33
|
+
pairs.any? { |pair| impact?(pair) }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubocop-nri
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hardy Jones
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-07-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.49'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.49'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Cops we use internally at NoRedInk
|
42
|
+
email: engineering@noredink.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/rubocop-nri.rb
|
48
|
+
- lib/rubocop/cop/nri/more_rollbar_information.rb
|
49
|
+
homepage: https://github.com/NoRedInk/cops
|
50
|
+
licenses:
|
51
|
+
- MIT
|
52
|
+
metadata: {}
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 2.6.11
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: Cops we use internally at NoRedInk
|
73
|
+
test_files: []
|