rubocop-greppable_rails 0.1.0 → 0.1.1

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: f1be36eb13930a87a25368cd98c5967555905e4839296eadc2c97071057d1f1c
4
- data.tar.gz: 6891e48304da1a776bd5a15d2b30c69742b590f081efa85a608904895f6cbc4b
3
+ metadata.gz: 8dcdbd2384385602ec76c55bbc2d3930a5a941c840a1fe9f953ea56da7841c76
4
+ data.tar.gz: ec03c27bf9b70f9c4f2306875148b32c87bda4668c7deb16fff5f5df08095033
5
5
  SHA512:
6
- metadata.gz: b8f1255afa149ed4f39338747feba0b1168c7a2f3c6a3a4c852826cc62abc526d986176fa9d315663c6a42375217b8f824a5002965af680070fa7770aad889b1
7
- data.tar.gz: d0043669fa145fb392a94b97197a100b4f81fc4a0326ff03806911b2443c33765ba97e9e730bb0d9aba33562f2e10d7d89c5df429c3078dd7abbc17866cfd6f3
6
+ metadata.gz: 2276743cc6dc3bdc68bc76b42e9490cf80488947706a7d925b9e82db3561f456ed9fcc4fe53006d4cddd54336db200f7ede2dbb6729abab5802b5264b92b2c3c
7
+ data.tar.gz: 6369f9d1abb1d2b216aca508eddc2ef47ba8ce321fb0fdc87edd91e3049af53d59e9d938c1c2871bb92e2e23982584deed65554bbbc9c5b1e6b5c21502e087e9
data/config/default.yml CHANGED
@@ -9,7 +9,7 @@ GreppableRails/DontIncludeInHelper:
9
9
  Enabled: true
10
10
  VersionAdded: '0.1.0'
11
11
  Include:
12
- - app/helper/**/*.rb
12
+ - app/helpers/**/*.rb
13
13
 
14
14
  GreppableRails/UseInlineAccessModifier:
15
15
  Description: 'Use inline style access modifier.'
@@ -17,8 +17,17 @@ module RuboCop
17
17
  (send nil? {:helper} (sym _))
18
18
  PATTERN
19
19
 
20
- def on_send(node)
20
+ def find_parent(node)
21
21
  parent_node = node.parent
22
+ if parent_node.type == :begin
23
+ parent_node.parent
24
+ else
25
+ parent_node
26
+ end
27
+ end
28
+
29
+ def on_send(node)
30
+ parent_node = find_parent(node)
22
31
  return unless parent_node.type == :class
23
32
 
24
33
  class_name = parent_node.children.first.children.last.to_s
@@ -51,8 +51,17 @@ module RuboCop
51
51
  (send _ :include (const _ _))
52
52
  PATTERN
53
53
 
54
- def on_send(node)
54
+ def find_parent(node)
55
55
  parent_node = node.parent
56
+ if parent_node.type == :begin
57
+ parent_node.parent
58
+ else
59
+ parent_node
60
+ end
61
+ end
62
+
63
+ def on_send(node)
64
+ parent_node = find_parent(node)
56
65
  return unless parent_node.type == :module
57
66
 
58
67
  module_name = parent_node.children.first.children.last.to_s
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rubocop
4
4
  module GreppableRails
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-greppable_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shia