rubocop-vendor 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: 258d2b7bbbebb511c338bdd04579bae2c6e0bb7e08ae292b39dc45b27174d11b
4
- data.tar.gz: 531b18092f1058d1b68c151e63dbf1e2d252601ae980b78115e72c2ad5f0464f
3
+ metadata.gz: 5072a6d34dc157a8067353787c18de1f0d29391bcd444200db28663b207a69ba
4
+ data.tar.gz: 13f6b9f89c3f88aff7933d52d3f62eaa52e6ced21a90a25add5321a20083ea96
5
5
  SHA512:
6
- metadata.gz: 0d460a6b2433b8530ae862e1fe79436c47340a45a83739253e1e89894cba05f03924e55c80c93b3d2fd5aebc7d14edd268ba8902e46c9e2a9d7adf366e9804fe
7
- data.tar.gz: 11c90c0c37f76378f3c2b385bbcd1d1b20d5a0283a9a9b8023f3bf6c315953d3a05784a8b7ef20765f6da82a2c495fec5f0c046b06339d2a4746c32c26fb745d
6
+ metadata.gz: 5850e36f8d60e097beffbea26dd32453a3201ec49447dbec1e033eb200f99b54af2ebdc63557ed45e6741a09d0413c346134717b6b786f27a9dec22e22843ee1
7
+ data.tar.gz: f38f8b445d42bd1eef44dfd270a9a3c89d8093e9572de51acb0bbe1cfaba50bfa57444eda0b3aadd11fc1047e79d46ef2b43be5d4dc4b923d54230411029cf6d
data/config/default.yml CHANGED
@@ -5,6 +5,11 @@ Vendor/RollbarInterpolation:
5
5
  Enabled: true
6
6
  VersionAdded: '0.1.0'
7
7
 
8
+ Vendor/RollbarLog:
9
+ Description: 'Avoid calls to `Rollbar.log`.'
10
+ Enabled: true
11
+ VersionAdded: '0.2.0'
12
+
8
13
  Vendor/RollbarLogger:
9
14
  Description: 'Use logger instead of `Rollbar.debug`, `info` or `warning` calls.'
10
15
  Enabled: true
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Vendor
6
+ # This cop checks for `Rollbar.log` usage and suggests specialized
7
+ # method calls instead.
8
+ #
9
+ # The main reason for this suggestion is consistency.
10
+ #
11
+ # @example
12
+ # # bad
13
+ # Rollbar.log('info', 'Stale message')
14
+ #
15
+ # # good
16
+ # Rollbar.info('Stale message')
17
+ #
18
+ class RollbarLog < Cop
19
+ MSG = 'Use `Rollbar.%<method>s` instead of `Rollbar.log`.'
20
+
21
+ def_node_matcher :bad_method?, <<-PATTERN
22
+ (send
23
+ (const nil? :Rollbar) :log
24
+ $({str sym} _) ...)
25
+ PATTERN
26
+
27
+ def on_send(node)
28
+ level = bad_method?(node)
29
+ return unless level
30
+
31
+ add_offense(level)
32
+ end
33
+
34
+ private
35
+
36
+ def message(node)
37
+ format(MSG, method: node.value)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -4,5 +4,6 @@ module RuboCop
4
4
  end
5
5
 
6
6
  require_relative 'vendor/rollbar_interpolation'
7
+ require_relative 'vendor/rollbar_log'
7
8
  require_relative 'vendor/rollbar_logger'
8
9
  require_relative 'vendor/rollbar_with_exception'
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Vendor
5
5
  module Version
6
- STRING = '0.1.0'
6
+ STRING = '0.2.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-vendor
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
  - Danilo Cabello
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-04-23 00:00:00.000000000 Z
13
+ date: 2019-04-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop
@@ -55,6 +55,7 @@ files:
55
55
  - config/default.yml
56
56
  - lib/rubocop-vendor.rb
57
57
  - lib/rubocop/cop/vendor/rollbar_interpolation.rb
58
+ - lib/rubocop/cop/vendor/rollbar_log.rb
58
59
  - lib/rubocop/cop/vendor/rollbar_logger.rb
59
60
  - lib/rubocop/cop/vendor/rollbar_with_exception.rb
60
61
  - lib/rubocop/cop/vendor_cops.rb