mudguard 0.1.6 → 0.1.7

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: 93199ae375f4801546571b433f77529637f7762d6e6009e849fb2a2cfba80f1f
4
- data.tar.gz: 6d17e05854f9196715323ec761e96888116fdb6d2ea9b7b1a0c3d45ccc7a0aec
3
+ metadata.gz: 52da6086ca5ad7d9cc7882c0be051e35d1a1672930d616f3929d44909b23717f
4
+ data.tar.gz: 84ba1b85b2d6cdec19ccbd80ffe6f39745054f3e8617a250c7dc613cd40dc00e
5
5
  SHA512:
6
- metadata.gz: a14b61b6b2ab350e98ac006340ea5662bb2bd695a6c5bc3d868e3ce7fae8511d4675a05929f4fc6210c85c2e05c95e35912569aa2f0f105e30efb4c47982fbd7
7
- data.tar.gz: 0b032f68f9bd97cf9322b63f29d2260b68ad3a78b34e603311884d17260d56d234f04c31e2d29714a7e997e1005c75051efacc19b2d371eb08596079d92e1c89
6
+ metadata.gz: d41681429a450ad75420b5cbe6bf78a261bc2d6d90be6547e080557d09b66c7a937c6798cd2f4603e20c7154d1540638f3861830ea4add5c5bce513d78a6dfbb
7
+ data.tar.gz: e4f6a3925f3a65496c646cf2c1d0f5143b7e9f0c103a327961479b3dd01e4307bc743934ef8152ac73d15661bd04a842906876d595414814efdc6be285ba5efb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mudguard (0.1.6)
4
+ mudguard (0.1.7)
5
5
  parser (~> 2.7)
6
6
 
7
7
  GEM
@@ -36,20 +36,27 @@ module Mudguard
36
36
  def process(node, module_name = "")
37
37
  case node
38
38
  when type?(:module)
39
- process_module(node.children)
39
+ process_module(node.children, module_name)
40
40
  when type?(:class)
41
41
  process_class(node.children, module_name)
42
42
  when type?(:const)
43
- [create_dependency(module_name, node)]
43
+ create_dependency(module_name, node)
44
44
  else
45
45
  ignore_and_continue(node, module_name)
46
46
  end
47
47
  end
48
48
 
49
49
  def create_dependency(module_name, node)
50
- dependency = "#{module_name}->#{find_const_name(node.children)}"
50
+ const_name = find_const_name(node.children)
51
+ return [] unless const_name&.include?("::")
52
+
53
+ dependency = if module_name.empty?
54
+ const_name
55
+ else
56
+ "#{module_name}->#{const_name}"
57
+ end
51
58
  location = "#{@location}:#{node.location.line}"
52
- Dependency.new(location: location, dependency: dependency)
59
+ [Dependency.new(location: location, dependency: dependency)]
53
60
  end
54
61
 
55
62
  def ignore_and_continue(node, module_name)
@@ -61,8 +68,13 @@ module Mudguard
61
68
  end
62
69
  end
63
70
 
64
- def process_module(children)
65
- module_name = find_const_name(children[0].children)
71
+ def process_module(children, module_name)
72
+ const_name = find_const_name(children[0].children)
73
+ module_name = if module_name.empty?
74
+ const_name
75
+ else
76
+ "#{module_name}::#{const_name}"
77
+ end
66
78
  process(children[1], module_name)
67
79
  end
68
80
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mudguard
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
data/mudguard.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.summary = "mudguard helps your ruby project not becoming a "\
14
14
  "'Big ball of mud'"
15
- spec.homepage = "https://gibhub.com/Enceradeira/mudguard"
15
+ spec.homepage = "https://github.com/Enceradeira/mudguard"
16
16
  spec.license = "MIT"
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mudguard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorg Jenni
@@ -186,12 +186,12 @@ files:
186
186
  - lib/tasks/test.rake
187
187
  - mudguard.gemspec
188
188
  - pkg/mudguard-0.1.0.gem
189
- homepage: https://gibhub.com/Enceradeira/mudguard
189
+ homepage: https://github.com/Enceradeira/mudguard
190
190
  licenses:
191
191
  - MIT
192
192
  metadata:
193
- homepage_uri: https://gibhub.com/Enceradeira/mudguard
194
- source_code_uri: https://gibhub.com/Enceradeira/mudguard
193
+ homepage_uri: https://github.com/Enceradeira/mudguard
194
+ source_code_uri: https://github.com/Enceradeira/mudguard
195
195
  post_install_message:
196
196
  rdoc_options: []
197
197
  require_paths: