rdepend 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f7a2efdd9fdd2cc0310465cac7a761bb95e403e
4
- data.tar.gz: 98dbb422eaa304892d3e6e867d3172b1f6273693
3
+ metadata.gz: 8a6894213865c4436fbc765769bf2f7a18d30a2d
4
+ data.tar.gz: f242a93f729d24cd145bd7cdb86785d659918c56
5
5
  SHA512:
6
- metadata.gz: 60c1b739a32928b6ccb592fffcf98f67edc58e9c8b6930d0762b5f2cca81484d699bb37848b5a8b17870711550e1d1b0a3bba1a9dc47871cd6e1f874743edd76
7
- data.tar.gz: 008ea25590dbffccaebbdf9105cf1737b8e5699030e8de43b8dfbceaa8b7089bd43ed5b7483341ae080a3865bb6dd45a36045736df620fa972c4291ad2302a8a
6
+ metadata.gz: fe3dbba89809ccd3124627934016cbcfa72e9368dfa5399b396b34fef65965de5ee3a95a9c7b3d8b870868dae2d0f8c47c42e93c8307f67952679e4f5365efb2
7
+ data.tar.gz: 4ff3e49adf5919ed124b832d4da6c7420c55a270bc2bd55b5116cd81fafbec46a44d944b3132e731614d38e57c09687d12e17c8caf0c6510bc069de9cb94b71f
data/README.md CHANGED
@@ -9,7 +9,7 @@ re-used a lot.
9
9
  A lot of outgoing links is bad, as that means that that part of the code has
10
10
  a lot of dependencies.
11
11
 
12
- See also http://www.whiteboxtest.com/information-flow-metrics.php
12
+ See http://www.whiteboxtest.com/information-flow-metrics.php
13
13
 
14
14
  ## Installation
15
15
 
@@ -31,8 +31,7 @@ Or install it yourself as:
31
31
 
32
32
  ```ruby
33
33
  Rdepend.with_trace do
34
- @een = Een.new
35
- @een.start
34
+ # your code
36
35
  end
37
36
  ```
38
37
 
@@ -40,13 +39,12 @@ or
40
39
 
41
40
  ```ruby
42
41
  Rdepend.trace
43
- @een = Een.new
44
- @een.start
42
+ # your code
45
43
  ```
46
44
 
47
45
  ## Contributing
48
46
 
49
- 1. Fork it ( https://github.com/[my-github-username]/rdepend/fork )
47
+ 1. Fork it ( https://github.com/suhrawardi/rdepend/fork )
50
48
  2. Create your feature branch (`git checkout -b my-new-feature`)
51
49
  3. Commit your changes (`git commit -am 'Add some feature'`)
52
50
  4. Push to the branch (`git push origin my-new-feature`)
@@ -26,35 +26,41 @@ module Rdepend
26
26
  @result.threads.each do |thread|
27
27
  add("subgraph \"Thread #{thread.id}\" {")
28
28
  print_thread(thread)
29
- add("}")
29
+ add('}')
30
30
  print_classes(thread)
31
31
  end
32
32
  end
33
33
 
34
34
  def print_thread(thread)
35
35
  thread.methods.sort_by(&sort_method).reverse_each do |method|
36
- name = method_name(method).split("#").last
36
+ name = method_name(method).split('#').last
37
37
  add("#{method.object_id} [label=\"#{name}\"];")
38
38
  @seen_methods << method
39
39
  print_edges(method)
40
40
  end
41
41
  end
42
42
 
43
+ def grouped_methods(thread)
44
+ thread.methods.inject({}) { |m, method|
45
+ m[method.klass_name] = (m[method.klass_name] || []) << method; m
46
+ }
47
+ end
48
+
43
49
  def print_classes(thread)
44
- grouped = {}
45
- thread.methods.each{|m| grouped[m.klass_name] ||= []; grouped[m.klass_name] << m}
46
- grouped.each do |cls, methods2|
47
- big_methods = methods2.select { |m| @seen_methods.include?(m) }
48
- if !big_methods.empty?
49
- add("subgraph cluster_#{cls.object_id} {")
50
- add("label = \"#{cls}\";", "fontcolor = #{CLASS_COLOR};")
51
- add("fontsize = 16;", "color = #{CLASS_COLOR};")
52
- big_methods.each { |m| add("#{m.object_id};") }
53
- add("}")
54
- end
50
+ grouped_methods(thread).each do |cls, methods|
51
+ print_methods(cls, methods.select { |m| @seen_methods.include?(m) })
55
52
  end
56
53
  end
57
54
 
55
+ def print_methods(cls, methods)
56
+ return if methods.empty?
57
+ add("subgraph cluster_#{cls.object_id} {")
58
+ add("label = \"#{cls}\";", "fontcolor = #{CLASS_COLOR};")
59
+ add('fontsize = 16;', "color = #{CLASS_COLOR};")
60
+ methods.each { |m| add("#{m.object_id};") }
61
+ add('}')
62
+ end
63
+
58
64
  def print_edges(method)
59
65
  method.aggregate_children.each do |child|
60
66
  label = "#{child.called}/#{child.target.called}"
@@ -1,3 +1,3 @@
1
1
  module Rdepend
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdepend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - jarra