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 +4 -4
- data/README.md +4 -6
- data/lib/rdepend/printer.rb +19 -13
- data/lib/rdepend/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a6894213865c4436fbc765769bf2f7a18d30a2d
|
4
|
+
data.tar.gz: f242a93f729d24cd145bd7cdb86785d659918c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
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
|
-
|
44
|
-
@een.start
|
42
|
+
# your code
|
45
43
|
```
|
46
44
|
|
47
45
|
## Contributing
|
48
46
|
|
49
|
-
1. Fork it ( https://github.com/
|
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`)
|
data/lib/rdepend/printer.rb
CHANGED
@@ -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(
|
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
|
-
|
45
|
-
|
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}"
|
data/lib/rdepend/version.rb
CHANGED