metric_fu 4.1.2 → 4.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/.travis.yml +7 -4
  2. data/.yardopts +5 -0
  3. data/CONTRIBUTING.md +28 -13
  4. data/Gemfile +7 -3
  5. data/HISTORY.md +12 -0
  6. data/README.md +17 -0
  7. data/TODO.md +74 -79
  8. data/lib/metric_fu.rb +8 -0
  9. data/lib/metric_fu/configuration.rb +8 -3
  10. data/lib/metric_fu/core_ext.rb +2 -0
  11. data/lib/metric_fu/core_ext/inflector/inflections.rb +214 -0
  12. data/lib/metric_fu/core_ext/inflector/methods.rb +153 -0
  13. data/lib/metric_fu/core_ext/object.rb +3 -0
  14. data/lib/metric_fu/core_ext/object/blank.rb +106 -0
  15. data/lib/metric_fu/core_ext/object/to_json.rb +12 -0
  16. data/lib/metric_fu/core_ext/string.rb +2 -0
  17. data/lib/metric_fu/core_ext/string/inflections.rb +195 -0
  18. data/lib/metric_fu/initial_requires.rb +0 -8
  19. data/lib/metric_fu/metrics/base_template.rb +28 -1
  20. data/lib/metric_fu/metrics/churn/churn.rb +2 -2
  21. data/lib/metric_fu/metrics/churn/template_awesome/churn.html.erb +8 -6
  22. data/lib/metric_fu/metrics/hotspots/analysis/code_issue.rb +6 -0
  23. data/lib/metric_fu/metrics/hotspots/init.rb +1 -0
  24. data/lib/metric_fu/reporting/templates/awesome/awesome_template.rb +37 -20
  25. data/lib/metric_fu/reporting/templates/awesome/css/bluff.css +15 -0
  26. data/lib/metric_fu/reporting/templates/awesome/css/default.css +0 -48
  27. data/lib/metric_fu/reporting/templates/awesome/css/rcov.css +32 -0
  28. data/lib/metric_fu/reporting/templates/awesome/index.html.erb +4 -32
  29. data/lib/metric_fu/reporting/templates/awesome/layout.html.erb +2 -0
  30. data/lib/metric_fu/version.rb +1 -1
  31. data/metric_fu.gemspec +23 -11
  32. data/spec/cli/helper_spec.rb +38 -28
  33. data/spec/metric_fu/configuration_spec.rb +35 -22
  34. data/spec/metric_fu/metrics/base_template_spec.rb +7 -7
  35. data/spec/metric_fu/metrics/churn/churn_spec.rb +9 -2
  36. data/spec/metric_fu/metrics/flog/flog_spec.rb +57 -55
  37. data/spec/metric_fu/metrics/hotspots/hotspot_analyzer_spec.rb +0 -2
  38. data/spec/run_spec.rb +0 -8
  39. data/spec/support/suite.rb +3 -1
  40. metadata +74 -125
  41. data/home_page/back_all.jpg +0 -0
  42. data/home_page/cc.rb.gif +0 -0
  43. data/home_page/churn.gif +0 -0
  44. data/home_page/cruise_control_1.gif +0 -0
  45. data/home_page/cyclomatic.gif +0 -0
  46. data/home_page/flay.gif +0 -0
  47. data/home_page/flog.gif +0 -0
  48. data/home_page/flog2.gif +0 -0
  49. data/home_page/footer.gif +0 -0
  50. data/home_page/header.jpg +0 -0
  51. data/home_page/hotspot.gif +0 -0
  52. data/home_page/img09.gif +0 -0
  53. data/home_page/index.html +0 -138
  54. data/home_page/rcov.gif +0 -0
  55. data/home_page/reek.gif +0 -0
  56. data/home_page/robots.txt +0 -5
  57. data/home_page/roodi.gif +0 -0
  58. data/home_page/saikuro.gif +0 -0
  59. data/home_page/stats.gif +0 -0
  60. data/home_page/styles.css +0 -245
  61. data/home_page/title.gif +0 -0
  62. data/home_page/title_back.gif +0 -0
  63. data/lib/metric_fu/metrics/cane/template_standard/cane.html.erb +0 -95
  64. data/lib/metric_fu/metrics/churn/template_standard/churn.html.erb +0 -31
  65. data/lib/metric_fu/metrics/flay/template_standard/flay.html.erb +0 -34
  66. data/lib/metric_fu/metrics/flog/template_standard/flog.html.erb +0 -57
  67. data/lib/metric_fu/metrics/hotspots/template_standard/hotspots.html.erb +0 -54
  68. data/lib/metric_fu/metrics/rails_best_practices/template_standard/rails_best_practices.html.erb +0 -29
  69. data/lib/metric_fu/metrics/rcov/template_standard/rcov.html.erb +0 -43
  70. data/lib/metric_fu/metrics/reek/template_standard/reek.html.erb +0 -42
  71. data/lib/metric_fu/metrics/roodi/template_standard/roodi.html.erb +0 -29
  72. data/lib/metric_fu/metrics/saikuro/template_standard/saikuro.html.erb +0 -84
  73. data/lib/metric_fu/metrics/stats/template_standard/stats.html.erb +0 -55
  74. data/lib/metric_fu/reporting/templates/standard/default.css +0 -64
  75. data/lib/metric_fu/reporting/templates/standard/index.html.erb +0 -44
  76. data/lib/metric_fu/reporting/templates/standard/standard_template.rb +0 -26
@@ -1,31 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Source Control Churn Results</title>
4
- <style>
5
- <%= inline_css("default.css") %>
6
- </style>
7
- </head>
8
-
9
- <body>
10
- <h1>Source Control Churn Results</h1>
11
- <a href="index.html">back to menu</a>
12
- <p>Files that change a lot in your project may be bad a sign.
13
- This task uses your source control log to identify those files.
14
- </p>
15
- <table>
16
- <tr>
17
- <th>File Path</th>
18
- <th>Times Changed</th>
19
- </tr>
20
- <% count = 0 %>
21
- <% @churn[:changes].each do |change| %>
22
- <tr>
23
- <td><%= change[:file_path] %></td>
24
- <td><%= change[:times_changed] %></td>
25
- </tr>
26
- <% count += 1 %>
27
- <% end %>
28
- </table>
29
- <p>Generated on <%= Time.now.localtime %></p>
30
- </body>
31
- </html>
@@ -1,34 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Flay Results</title>
4
- <style>
5
- <%= inline_css("default.css") %>
6
- </style>
7
- </head>
8
-
9
- <body>
10
- <h1>Flay Results</h1>
11
- <a href="index.html">back to menu</a>
12
- <h2>Total Score (lower is better): <%= @flay[:total_score] %></h2>
13
- <p><a href='http://ruby.sadi.st/Flay.html'>Flay</a> analyzes ruby code for structural similarities.</p>
14
- <table>
15
- <tr>
16
- <th>Files</th>
17
- <th>Matches</th>
18
- </tr>
19
- <% count = 0 %>
20
- <% @flay[:matches].each do |match| %>
21
- <tr class='<%= cycle("light", "dark", count) %>'>
22
- <td>
23
- <% match[:matches].each do |file| %>
24
- <%= file[:name] %>:<%= file[:line] %><br />
25
- <% end %>
26
- </td>
27
- <td><%= match[:reason] %></td>
28
- </tr>
29
- <% count += 1 %>
30
- <% end %>
31
- </table>
32
- <p>Generated on <%= Time.now.localtime %></p>
33
- </body>
34
- </html>
@@ -1,57 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Flog Reporter</title>
4
- <style>
5
- <%= inline_css("default.css") %>
6
- </style>
7
- </head>
8
- <body>
9
- <h1>Flog Results</h1>
10
- <a href="index.html">back to menu</a>
11
- <p><a href='http://ruby.sadi.st/Flog.html'>Flog</a> measures code complexity.</p>
12
- <h2>Total Flog score for all methods: <%= round_to_tenths @flog[:total]%></h2>
13
- <h2>Average Flog score for all methods: <%= round_to_tenths @flog[:average]%></h2>
14
-
15
- <table>
16
- <tr>
17
- <th>File</th>
18
- <th>Total score</th>
19
- <th>Methods</th>
20
- <th>Average score</th>
21
- <th>Highest score</th>
22
- </tr>
23
- <% @flog[:method_containers].each do |method_container| %>
24
- <tr>
25
- <td><a href="#<%= method_container[:path].gsub(/[^a-z]+/, '_') %>"><%= method_container[:path] %></a></td>
26
- <td><%= round_to_tenths method_container[:total_score] %></td>
27
- <td><%= method_container[:methods].size %></td>
28
- <td><%= round_to_tenths method_container[:average_score] %></td>
29
- <td><%= round_to_tenths method_container[:highest_score] %></td>
30
- </tr>
31
- <% end %>
32
- </table>
33
-
34
- <% @flog[:method_containers].each do |method_container| %>
35
- <h2 id="<%= method_container[:path].gsub(/[^a-z]+/, '_') %>"><%= link_to_filename(method_container[:path]) %></h2>
36
-
37
- <% method_container[:methods].each do |full_method_name, method_info| %>
38
- <% path, line = method_info[:path].split(":") if method_info[:path] %>
39
- <p><%= link_to_filename(path, line, full_method_name) %></p>
40
- <p>Total Score: <%= round_to_tenths method_info[:score]%></p>
41
- <table>
42
- <tr>
43
- <th>Score</th>
44
- <th>Operator</th>
45
- </tr>
46
- <% method_info[:operators].each do |operator, score| %>
47
- <tr>
48
- <td><%= round_to_tenths score %></td>
49
- <td><%= operator %></td>
50
- </tr>
51
- <% end %>
52
- </table>
53
- <% end %>
54
- <% end %>
55
- <p>Generated on <%= Time.now.localtime %></p>
56
- </body>
57
- </html>
@@ -1,54 +0,0 @@
1
- <h3>Hotspot Results</h3>
2
- <p>Meta analysis of your metrics to find hotspots in your code.</p>
3
- <br/>
4
-
5
- <% if !@hotspots || @hotspots.size == 0 %>
6
- No Hotspots were found.
7
- <% elsif @hotspots && @hotspots.size > 0 %>
8
-
9
- <% granularities = [:files, :classes, :methods] %>
10
- <table>
11
- <tr valign="top">
12
- <% granularities.each do |granularity| %>
13
- <th width='33%'>
14
- <%= granularity.to_s.capitalize %></th>
15
- <% end %>
16
- </tr>
17
-
18
- <% items = [] %>
19
- <% granularities.each_index do |index| %>
20
- <% granularity = granularities[index] %>
21
- <% items << @hotspots[granularity] %>
22
- <% end %>
23
-
24
- <% items_length = 0 %>
25
- <% columns = [0, 1, 2] %>
26
- <% while (items_length < items[0].length || items_length < items[1].length || items_length < items[2].length) do %>
27
- <tr valign="top">
28
- <% columns.each do |column| %>
29
- <% item = items[column].length >= items_length ? items[column][items_length] : nil %>
30
- <% if item %>
31
- <td>
32
- <b>
33
- <%= display_location(item[:location], nil) %>
34
- </b>
35
- <br/><br/>
36
- <!-- TODO HOTSPOTS for metric fu nice metric_link method -->
37
- <% item[:details].each do |metric, info| %>
38
- <%#= metric_link(@stat, metric, h(metric.to_s.capitalize)) + ": " + h(info)%><br/>
39
- <%= "#{metric.to_s.capitalize}: #{info}" %><br/>
40
- <% end %>
41
- </td>
42
- <% else %>
43
- <td> &nbsp; </td>
44
- <% end %>
45
- <% end %>
46
- <% items_length += 1 %>
47
- </tr>
48
- <% end %>
49
-
50
- </table>
51
- <% end %>
52
-
53
-
54
- <p>Generated on <%= Time.now.localtime %></p>
@@ -1,29 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Rails Best Practices Results</title>
4
- <style>
5
- <%= inline_css("default.css") %>
6
- </style>
7
- </head>
8
-
9
- <body>
10
- <h1>Rails Best Practices Results</h1>
11
- <a href="index.html">back to menu</a>
12
- <p><a href="http://github.com/railsbp/rails_best_practices">rails_best_practices</a> checks quality of rails app files according to ihower’s presentation from Kungfu RailsConf in Shanghai China.</p>
13
- <table>
14
- <tr>
15
- <th>File Path</th>
16
- <th>Warning</th>
17
- </tr>
18
- <% count = 0 %>
19
- <% @rails_best_practices[:problems].each do |problem| %>
20
- <tr class='<%= cycle("light", "dark", count) %>'>
21
- <td><%= problem[:file] %>:<%= problem[:line] %></td>
22
- <td><%= problem[:problem] %></td>
23
- </tr>
24
- <% count += 1 %>
25
- <% end %>
26
- </table>
27
- <p>Generated on <%= Time.now.localtime %></p>
28
- </body>
29
- </html>
@@ -1,43 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Rcov Code Coverage Results</title>
4
- <style>
5
- <%= inline_css("default.css") %>
6
- </style>
7
- </head>
8
-
9
- <body>
10
- <h1>Rcov Code Coverage Results</h1>
11
- <a href="index.html">back to menu</a>
12
- <p>C0 code coverage information.</p>
13
- <p>Total Coverage: <%= @rcov.delete(:global_percent_run) %>% </p>
14
- <table>
15
- <tr>
16
- <th>File Path</th>
17
- <th>Percent run</th>
18
- </tr>
19
- <% count = 0 %>
20
- <% @rcov.sort_by{|k,v| v[:percent_run]}.each do |e| %>
21
- <tr>
22
- <td><a href="#<%= e[0].gsub(/[^a-z]+/, '_') %>"><%= e[0] %></a></td>
23
- <td><%= e[1][:percent_run] %></td>
24
- </tr>
25
- <% count += 1 %>
26
- <% end %>
27
- </table>
28
-
29
- <% @rcov.each_pair do |fname, file| %>
30
- <h2 id="<%= fname.gsub(/[^a-z]+/, '_') %>"> <%= fname %></h2>
31
- <table class="rcov_code">
32
- <% file[:lines].each do |line| %>
33
- <tr>
34
- <% css_class = line[:was_run] ? "rcov_run" : "rcov_not_run" %>
35
- <td class="<%= css_class %>"><pre><%= line[:content] %></pre></td>
36
- </tr>
37
- <% end %>
38
- </table>
39
- <% end %>
40
- <p>Generated on <%= Time.now.localtime %></p>
41
- </body>
42
- </html>
43
-
@@ -1,42 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Reek Results</title>
4
- <style>
5
- <%= inline_css("default.css") %>
6
- </style>
7
- </head>
8
-
9
- <body>
10
- <h1>Reek Results</h1>
11
- <a href="index.html">back to menu</a>
12
- <p><a href="http://reek.rubyforge.org/">Reek</a> detects common code smells in ruby code.</p>
13
- <table>
14
- <tr>
15
- <th>File Path</th>
16
- <th>Method</th>
17
- <th>Description</th>
18
- <th>Type</th>
19
- </tr>
20
- <% count = 0 %>
21
- <% @reek[:matches].each do |match| %>
22
- <% match[:code_smells].each do |smell| %>
23
- <tr class='<%= cycle("light", "dark", count) %>'>
24
- <td><%= match[:file_path] %></td>
25
- <td>
26
- <%= smell[:method] %>
27
- </td>
28
- <td>
29
- <%= smell[:message] %>
30
- </td>
31
- <td>
32
- <%= smell[:type] %>
33
- </td>
34
- </tr>
35
- <% count += 1 %>
36
- <% end %>
37
- <% end %>
38
-
39
- </table>
40
- <p>Generated on <%= Time.now.localtime %></p>
41
- </body>
42
- </html>
@@ -1,29 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Roodi Results</title>
4
- <style>
5
- <%= inline_css("default.css") %>
6
- </style>
7
- </head>
8
-
9
- <body>
10
- <h1>Roodi Results</h1>
11
- <a href="index.html">back to menu</a>
12
- <p><a href="http://roodi.rubyforge.org/">Roodi</a> parses your Ruby code and warns you about design issues you have based on the checks that is has configured.</p>
13
- <table>
14
- <tr>
15
- <th>File Path</th>
16
- <th>Warning</th>
17
- </tr>
18
- <% count = 0 %>
19
- <% @roodi[:problems].each do |problem| %>
20
- <tr class='<%= cycle("light", "dark", count) %>'>
21
- <td><%= problem[:file] %>:<%= problem[:line] %></td>
22
- <td><%= problem[:problem] %></td>
23
- </tr>
24
- <% count += 1 %>
25
- <% end %>
26
- </table>
27
- <p>Generated on <%= Time.now.localtime %></p>
28
- </body>
29
- </html>
@@ -1,84 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Saikuro Results</title>
4
- <style>
5
- <%= inline_css("default.css") %>
6
- </style>
7
- </head>
8
-
9
- <body>
10
- <h1>Saikuro Results</h1>
11
- <a href="index.html">back to menu</a>
12
- <p><a href='http://saikuro.rubyforge.org/'>Saikuro</a> analyzes ruby code for cyclomatic complexity.</p>
13
-
14
- <h2>Analyzed Methods</h2>
15
- <table>
16
- <tr>
17
- <th>Method Name</th>
18
- <th>Complexity</th>
19
- <th># Lines</th>
20
- </tr>
21
- <% @saikuro[:methods].each do |method| %>
22
- <tr>
23
- <td><%= method[:name] %></td>
24
- <td><%= method[:complexity] %></td>
25
- <td><%= method[:lines] %></td>
26
- </tr>
27
- <% end %>
28
- </table>
29
-
30
-
31
-
32
- <h2>Analyzed Classes</h2>
33
- <table>
34
- <tr>
35
- <th>Class Name</th>
36
- <th>Complexity</th>
37
- <th># Lines</th>
38
- </tr>
39
- <% @saikuro[:classes].each do |klass| %>
40
- <tr>
41
- <td><%= klass[:name] %></td>
42
- <td><%= klass[:complexity] %></td>
43
- <td><%= klass[:lines] %></td>
44
- </tr>
45
- <% end %>
46
- </table>
47
-
48
-
49
- <h2>Analyzed Files</h2>
50
- <% @saikuro[:files].each do |file| %>
51
- <% file[:classes].each do |klass| %>
52
- <% if !klass[:methods].empty? %>
53
- <h3><%= file[:filename] %></h3>
54
- <h4>Class : <%= klass[:class_name] %></h4>
55
- <h5>Total complexity : <%= klass[:complexity] %></h5>
56
- <h5>Total lines : <%= klass[:lines] %></h5>
57
- <table>
58
- <tr>
59
- <th>Method</th>
60
- <th>Complexity</th>
61
- <th># Lines</th>
62
- </tr>
63
- <% klass[:methods].each do |method| %>
64
- <tr>
65
- <td>
66
- <%= method[:name] %>
67
- </td>
68
- <td>
69
- <%= method[:complexity] %>
70
- </td>
71
- <td>
72
- <%= method[:lines] %>
73
- </td>
74
- </tr>
75
- <% end %>
76
- </table>
77
- <% end %>
78
- <% end %>
79
- <% end %>
80
-
81
- <p>Generated on <%= Time.now.localtime %></p>
82
- </body>
83
- </html>
84
-
@@ -1,55 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Rake Stats Results</title>
4
- <style>
5
- <%= inline_css("default.css") %>
6
- </style>
7
- </head>
8
-
9
- <body>
10
- <h1>Rake Stats Results</h1>
11
- <a href="index.html">back to menu</a>
12
- <p>Rails rake stats results.</p>
13
- <table>
14
- <tr>
15
- <th>Lines of Code</th>
16
- <th>Lines of Test</th>
17
- <th>Code to test ratio</th>
18
- </tr>
19
- <tr>
20
- <td><%= @stats[:codeLOC] %></td>
21
- <td><%= @stats[:testLOC] %></td>
22
- <td>1:<%= @stats[:code_to_test_ratio] %></td>
23
- </tr>
24
- </table>
25
-
26
- <table>
27
- <tr>
28
- <th>Name</th>
29
- <th>Lines</th>
30
- <th>LOC</th>
31
- <th>Classes</th>
32
- <th>Methods</th>
33
- <th>Methods per class</th>
34
- <th>LOC per method</th>
35
- </tr>
36
- <% count = 0 %>
37
- <% @stats[:lines].each do |line| %>
38
- <tr>
39
- <td><%= line[:name] %></td>
40
- <td><%= line[:lines] %></td>
41
- <td><%= line[:loc] %></td>
42
- <td><%= line[:classes] %></td>
43
- <td><%= line[:methods] %></td>
44
- <td><%= line[:methods_per_class] %></td>
45
- <td><%= line[:loc_per_method] %></td>
46
- </tr>
47
- <% count += 1 %>
48
- <% end %>
49
- </table>
50
-
51
- <p>Generated on <%= Time.now.localtime %></p>
52
- </body>
53
- </html>
54
-
55
-