metric_fu 4.4.4 → 4.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +14 -6
  2. checksums.yaml.gz.sig +3 -0
  3. data.tar.gz.sig +0 -0
  4. data/.gitignore +1 -0
  5. data/.metrics +0 -3
  6. data/.travis.yml +1 -1
  7. data/.yardopts +0 -1
  8. data/CONTRIBUTING.md +1 -0
  9. data/CONTRIBUTORS +61 -2
  10. data/Gemfile +14 -11
  11. data/Gemfile.devtools +40 -0
  12. data/Guardfile +30 -0
  13. data/HISTORY.md +54 -1
  14. data/README.md +86 -56
  15. data/bin/mf-cane +8 -6
  16. data/bin/mf-churn +8 -7
  17. data/bin/mf-flay +8 -7
  18. data/bin/mf-reek +8 -7
  19. data/bin/mf-roodi +8 -7
  20. data/bin/mf-saikuro +8 -6
  21. data/certs/bf4.pem +22 -0
  22. data/checksum/metric_fu-4.4.4.gem.sha512 +1 -0
  23. data/checksum/metric_fu-4.5.0.gem.sha512 +1 -0
  24. data/etc/README.md +16 -0
  25. data/etc/erd.dot +173 -0
  26. data/etc/erd.png +0 -0
  27. data/lib/metric_fu.rb +56 -12
  28. data/lib/metric_fu/cli/helper.rb +8 -2
  29. data/lib/metric_fu/cli/parser.rb +86 -50
  30. data/lib/metric_fu/configuration.rb +4 -31
  31. data/lib/metric_fu/environment.rb +1 -1
  32. data/lib/metric_fu/formatter/html.rb +5 -5
  33. data/lib/metric_fu/gem_run.rb +68 -0
  34. data/lib/metric_fu/gem_version.rb +57 -0
  35. data/lib/metric_fu/io.rb +1 -1
  36. data/lib/metric_fu/load_files.rb +3 -5
  37. data/lib/metric_fu/loader.rb +31 -2
  38. data/lib/metric_fu/logging/mf_debugger.rb +1 -0
  39. data/lib/metric_fu/metric.rb +23 -1
  40. data/lib/metric_fu/metrics/cane/cane.rb +7 -3
  41. data/lib/metric_fu/metrics/cane/cane_grapher.rb +19 -0
  42. data/lib/metric_fu/metrics/cane/template_awesome/cane.html.erb +0 -4
  43. data/lib/metric_fu/metrics/churn/churn.rb +6 -7
  44. data/lib/metric_fu/metrics/flay/flay.rb +2 -4
  45. data/lib/metric_fu/metrics/flay/flay_grapher.rb +19 -0
  46. data/lib/metric_fu/metrics/flay/template_awesome/flay.html.erb +0 -4
  47. data/lib/metric_fu/metrics/flog/flog.rb +0 -2
  48. data/lib/metric_fu/metrics/flog/flog_grapher.rb +19 -0
  49. data/lib/metric_fu/metrics/flog/template_awesome/flog.html.erb +0 -4
  50. data/lib/metric_fu/metrics/generator.rb +34 -24
  51. data/lib/metric_fu/metrics/graph.rb +8 -14
  52. data/lib/metric_fu/metrics/hotspots/hotspot.rb +7 -5
  53. data/lib/metric_fu/metrics/hotspots/template_awesome/hotspots.html.erb +4 -6
  54. data/lib/metric_fu/metrics/rails_best_practices/rails_best_practices.rb +0 -2
  55. data/lib/metric_fu/metrics/rails_best_practices/rails_best_practices_grapher.rb +19 -0
  56. data/lib/metric_fu/metrics/rails_best_practices/template_awesome/rails_best_practices.html.erb +0 -4
  57. data/lib/metric_fu/metrics/rcov/rcov_grapher.rb +19 -0
  58. data/lib/metric_fu/metrics/rcov/template_awesome/rcov.html.erb +0 -4
  59. data/lib/metric_fu/metrics/reek/init.rb +1 -1
  60. data/lib/metric_fu/metrics/reek/reek.rb +12 -8
  61. data/lib/metric_fu/metrics/reek/reek_grapher.rb +19 -0
  62. data/lib/metric_fu/metrics/reek/template_awesome/reek.html.erb +0 -4
  63. data/lib/metric_fu/metrics/roodi/roodi.rb +2 -3
  64. data/lib/metric_fu/metrics/roodi/roodi_grapher.rb +19 -0
  65. data/lib/metric_fu/metrics/roodi/template_awesome/roodi.html.erb +0 -4
  66. data/lib/metric_fu/metrics/saikuro/saikuro.rb +69 -33
  67. data/lib/metric_fu/metrics/saikuro/scratch_file.rb +8 -9
  68. data/lib/metric_fu/metrics/stats/stats_grapher.rb +20 -0
  69. data/lib/metric_fu/metrics/stats/template_awesome/stats.html.erb +0 -4
  70. data/lib/metric_fu/reporting/graphs/grapher.rb +69 -3
  71. data/lib/metric_fu/reporting/result.rb +5 -1
  72. data/lib/metric_fu/reporting/templates/awesome/awesome_template.rb +7 -3
  73. data/lib/metric_fu/run.rb +13 -7
  74. data/lib/metric_fu/tasks/metric_fu.rake +50 -3
  75. data/lib/metric_fu/utility.rb +10 -0
  76. data/lib/metric_fu/version.rb +1 -1
  77. data/metric_fu.gemspec +7 -4
  78. data/spec/dummy/.gitignore +1 -0
  79. data/spec/dummy/.gitkeep +0 -0
  80. data/spec/dummy/.metrics +4 -0
  81. data/spec/dummy/lib/.gitkeep +0 -0
  82. data/spec/dummy/spec/.gitkeep +0 -0
  83. data/spec/{resources/yml → fixtures}/20090630.yml +1 -1
  84. data/spec/{resources/yml → fixtures}/hotspots/flog.yml +0 -0
  85. data/spec/{resources/yml → fixtures}/hotspots/generator.yml +0 -0
  86. data/spec/{resources/yml → fixtures}/hotspots/generator_analysis.yml +0 -0
  87. data/spec/{resources/yml → fixtures}/hotspots/reek.yml +0 -0
  88. data/spec/{resources/yml → fixtures}/hotspots/roodi.yml +0 -0
  89. data/spec/{resources/yml → fixtures}/hotspots/saikuro.yml +0 -0
  90. data/spec/{resources/yml → fixtures}/hotspots/several_metrics.yml +0 -0
  91. data/spec/{resources/yml → fixtures}/hotspots/stats.yml +0 -0
  92. data/spec/{resources/yml → fixtures}/hotspots/three_metrics_on_same_file.yml +0 -0
  93. data/spec/{resources → fixtures}/line_numbers/foo.rb +0 -0
  94. data/spec/{resources → fixtures}/line_numbers/module.rb +0 -0
  95. data/spec/{resources → fixtures}/line_numbers/module_surrounds_class.rb +0 -0
  96. data/spec/{resources → fixtures}/line_numbers/two_classes.rb +0 -0
  97. data/spec/{resources/yml → fixtures}/metric_missing.yml +0 -0
  98. data/spec/{resources → fixtures}/saikuro/app/controllers/sessions_controller.rb_cyclo.html +0 -0
  99. data/spec/{resources → fixtures}/saikuro/app/controllers/users_controller.rb_cyclo.html +0 -0
  100. data/spec/{resources → fixtures}/saikuro/index_cyclo.html +0 -0
  101. data/spec/{resources → fixtures}/saikuro_sfiles/thing.rb_cyclo.html +0 -0
  102. data/spec/metric_fu/configuration_spec.rb +1 -1
  103. data/spec/metric_fu/data_structures/line_numbers_spec.rb +13 -11
  104. data/spec/metric_fu/formatter/html_spec.rb +2 -2
  105. data/spec/metric_fu/gem_version_spec.rb +14 -0
  106. data/spec/metric_fu/loader_spec.rb +12 -0
  107. data/spec/metric_fu/metrics/base_template_spec.rb +9 -7
  108. data/spec/metric_fu/metrics/cane/cane_spec.rb +7 -7
  109. data/spec/metric_fu/metrics/churn/churn_spec.rb +1 -1
  110. data/spec/metric_fu/metrics/flay/flay_grapher_spec.rb +2 -2
  111. data/spec/metric_fu/metrics/flay/flay_spec.rb +2 -2
  112. data/spec/metric_fu/metrics/flog/flog_grapher_spec.rb +3 -3
  113. data/spec/metric_fu/metrics/generator_spec.rb +1 -35
  114. data/spec/metric_fu/metrics/graph_spec.rb +7 -24
  115. data/spec/metric_fu/metrics/hotspots/analysis/analyzed_problems_spec.rb +2 -2
  116. data/spec/metric_fu/metrics/hotspots/analysis/analyzer_tables_spec.rb +2 -2
  117. data/spec/metric_fu/metrics/hotspots/analysis/rankings_spec.rb +5 -5
  118. data/spec/metric_fu/metrics/hotspots/hotspots_spec.rb +2 -3
  119. data/spec/metric_fu/metrics/rails_best_practices/rails_best_practices_grapher_spec.rb +2 -2
  120. data/spec/metric_fu/metrics/rails_best_practices/rails_best_practices_spec.rb +1 -1
  121. data/spec/metric_fu/metrics/rcov/rcov_grapher_spec.rb +2 -2
  122. data/spec/metric_fu/metrics/rcov/rcov_spec.rb +1 -4
  123. data/spec/metric_fu/metrics/reek/reek_grapher_spec.rb +2 -2
  124. data/spec/metric_fu/metrics/reek/reek_spec.rb +1 -1
  125. data/spec/metric_fu/metrics/roodi/roodi_grapher_spec.rb +2 -2
  126. data/spec/metric_fu/metrics/roodi/roodi_spec.rb +3 -3
  127. data/spec/metric_fu/metrics/saikuro/saikuro_spec.rb +14 -10
  128. data/spec/metric_fu/metrics/stats/stats_grapher_spec.rb +2 -2
  129. data/spec/metric_fu/reporting/graphs/{engines/bluff_spec.rb → grapher_spec.rb} +8 -2
  130. data/spec/{run_spec.rb → metric_fu/run_spec.rb} +8 -13
  131. data/spec/spec_helper.rb +30 -5
  132. data/spec/support/deferred_garbaged_collection.rb +34 -0
  133. data/spec/support/helper_methods.rb +1 -15
  134. data/spec/support/suite.rb +4 -24
  135. data/spec/support/test_fixtures.rb +39 -0
  136. data/spec/support/timeout.rb +7 -0
  137. metadata +129 -104
  138. metadata.gz.sig +1 -0
  139. data/lib/metric_fu/metrics/cane/cane_bluff_grapher.rb +0 -16
  140. data/lib/metric_fu/metrics/cane/cane_gchart_grapher.rb +0 -25
  141. data/lib/metric_fu/metrics/flay/flay_bluff_grapher.rb +0 -16
  142. data/lib/metric_fu/metrics/flay/flay_gchart_grapher.rb +0 -20
  143. data/lib/metric_fu/metrics/flog/flog_bluff_grapher.rb +0 -17
  144. data/lib/metric_fu/metrics/flog/flog_gchart_grapher.rb +0 -28
  145. data/lib/metric_fu/metrics/rails_best_practices/rails_best_practices_bluff_grapher.rb +0 -16
  146. data/lib/metric_fu/metrics/rails_best_practices/rails_best_practices_gchart_grapher.rb +0 -27
  147. data/lib/metric_fu/metrics/rcov/rcov_bluff_grapher.rb +0 -16
  148. data/lib/metric_fu/metrics/rcov/rcov_gchart_grapher.rb +0 -22
  149. data/lib/metric_fu/metrics/reek/reek_bluff_grapher.rb +0 -16
  150. data/lib/metric_fu/metrics/reek/reek_gchart_grapher.rb +0 -30
  151. data/lib/metric_fu/metrics/roodi/roodi_bluff_grapher.rb +0 -16
  152. data/lib/metric_fu/metrics/roodi/roodi_gchart_grapher.rb +0 -20
  153. data/lib/metric_fu/metrics/stats/stats_bluff_grapher.rb +0 -17
  154. data/lib/metric_fu/metrics/stats/stats_gchart_grapher.rb +0 -27
  155. data/lib/metric_fu/reporting/graphs/engines/bluff.rb +0 -33
  156. data/lib/metric_fu/reporting/graphs/engines/gchart.rb +0 -72
  157. data/lib/metric_fu/reporting/graphs/engines/init.rb +0 -19
  158. data/lib/metric_fu_requires.rb +0 -63
  159. data/spec/metric_fu/reporting/graphs/engines/gchart_spec.rb +0 -161
@@ -1,8 +1,10 @@
1
- #!/usr/bin/env ruby_noexec_wrapper
1
+ #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
 
4
- require 'metric_fu_requires'
5
-
6
- version = MetricFu::MetricVersion.cane
7
- gem 'cane', version
8
- load Gem.bin_path('cane', 'cane', version)
4
+ require 'metric_fu/gem_run'
5
+ options = {
6
+ gem_name: 'cane',
7
+ metric_name: 'cane',
8
+ args: ARGV.dup,
9
+ }
10
+ STDOUT.puts MetricFu::GemRun.new(options).run.output
@@ -1,9 +1,10 @@
1
- #!/usr/bin/env ruby_noexec_wrapper
1
+ #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
 
4
-
5
- require 'metric_fu_requires'
6
-
7
- version = MetricFu::MetricVersion.churn
8
- gem 'churn', version
9
- load Gem.bin_path('churn', 'churn', version)
4
+ require 'metric_fu/gem_run'
5
+ options = {
6
+ gem_name: 'churn',
7
+ metric_name: 'churn',
8
+ args: ARGV.dup,
9
+ }
10
+ STDOUT.puts MetricFu::GemRun.new(options).run.output
@@ -1,9 +1,10 @@
1
- #!/usr/bin/env ruby_noexec_wrapper
1
+ #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
 
4
-
5
- require 'metric_fu_requires'
6
-
7
- version = MetricFu::MetricVersion.flay
8
- gem 'flay', version
9
- load Gem.bin_path('flay', 'flay', version)
4
+ require 'metric_fu/gem_run'
5
+ options = {
6
+ gem_name: 'flay',
7
+ metric_name: 'flay',
8
+ args: ARGV.dup,
9
+ }
10
+ STDOUT.puts MetricFu::GemRun.new(options).run.output
@@ -1,9 +1,10 @@
1
- #!/usr/bin/env ruby_noexec_wrapper
1
+ #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
 
4
-
5
- require 'metric_fu_requires'
6
-
7
- version = MetricFu::MetricVersion.reek
8
- gem 'reek', version
9
- load Gem.bin_path('reek', 'reek', version)
4
+ require 'metric_fu/gem_run'
5
+ options = {
6
+ gem_name: 'reek',
7
+ metric_name: 'reek',
8
+ args: ARGV.dup,
9
+ }
10
+ STDOUT.puts MetricFu::GemRun.new(options).run.output
@@ -1,9 +1,10 @@
1
- #!/usr/bin/env ruby_noexec_wrapper
1
+ #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
 
4
-
5
- require 'metric_fu_requires'
6
-
7
- version = MetricFu::MetricVersion.roodi
8
- gem 'roodi', version
9
- load Gem.bin_path('roodi', 'roodi', version)
4
+ require 'metric_fu/gem_run'
5
+ options = {
6
+ gem_name: 'roodi',
7
+ metric_name: 'roodi',
8
+ args: ARGV.dup,
9
+ }
10
+ STDOUT.puts MetricFu::GemRun.new(options).run.output
@@ -1,8 +1,10 @@
1
- #!/usr/bin/env ruby_noexec_wrapper
1
+ #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
 
4
- require 'metric_fu_requires'
5
-
6
- version = MetricFu::MetricVersion.saikuro
7
- gem 'metric_fu-Saikuro', version
8
- load Gem.bin_path('metric_fu-Saikuro', 'saikuro', version)
4
+ require 'metric_fu/gem_run'
5
+ options = {
6
+ gem_name: 'metric_fu-Saikuro',
7
+ metric_name: 'saikuro',
8
+ args: ARGV.dup,
9
+ }
10
+ STDOUT.puts MetricFu::GemRun.new(options).run.output
@@ -0,0 +1,22 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDjjCCAnagAwIBAgIBATANBgkqhkiG9w0BAQUFADBGMQwwCgYDVQQDDANkZXYx
3
+ ITAfBgoJkiaJk/IsZAEZFhFiZW5qYW1pbmZsZWlzY2hlcjETMBEGCgmSJomT8ixk
4
+ ARkWA2NvbTAeFw0xMzExMDcyMTQ0MDBaFw0xNDExMDcyMTQ0MDBaMEYxDDAKBgNV
5
+ BAMMA2RldjEhMB8GCgmSJomT8ixkARkWEWJlbmphbWluZmxlaXNjaGVyMRMwEQYK
6
+ CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
7
+ ncZFu7VMbliIBhiGj6J5aKXSuHF6gXZuA8gkpgM7dgVzkLhuud6hSYXoC8UZIr+M
8
+ N9hvV/F2F3gLlj2J7aLHr8C0for4KVjc5N/b249vGoH9nIl0qZVE3qI+R7MIdYlO
9
+ ONoeHgiymSKyssCzGFRzv8ZVrpWuUmcB3qixb6d2aiv1kcsZZnLjY4EO5jVW9X92
10
+ d9VMuNdYYtZ0l88prmUM+1fVfaDdY+KGrigeffHUGD0j7pHOZnRCYKwGHG/7Nkg8
11
+ 0vEtYVBKSpHIQThBMWXIQu69gIpr6AmQd/kVnhejAdQgvsDz43n9h5iZvrwcedWY
12
+ x2wz+FrUdJzZZhitUFGrnwIDAQABo4GGMIGDMAkGA1UdEwQCMAAwCwYDVR0PBAQD
13
+ AgSwMB0GA1UdDgQWBBTGwGJtyo8nUoRuxbYfcI5bzuHL3zAkBgNVHREEHTAbgRlk
14
+ ZXZAYmVuamFtaW5mbGVpc2NoZXIuY29tMCQGA1UdEgQdMBuBGWRldkBiZW5qYW1p
15
+ bmZsZWlzY2hlci5jb20wDQYJKoZIhvcNAQEFBQADggEBAI/gyzcFn4XvrzXhqKWc
16
+ zLUbOp0349rVIF6f0PlQvf3ZJZS76HKZ2EqSQJwzpcAboypvsRWk0kVmOwvzae4Y
17
+ bB0ac2WuRf7AntS84VkZQmI/1AIxkaQUIQvHJacaw8yJKNggbDBKugHjcrIWWg2V
18
+ vDvyjvJx4sQFpJ84LSDbAVkB92YaP6CUwoeXwrcsvvfrvo9x5AkBECz9KZGD532g
19
+ o78P4WmzIWLgan5GIyNFtGxCsYAug+h0jnC4yujauKqr8hKDLu4K+quCGjX/6LL6
20
+ WONz9vT6h053kHZYMrd4Gs/NdaA4tJSxrhZlXdajAm/0vAOzLIqUHHQk3R0tf7aY
21
+ d/w=
22
+ -----END CERTIFICATE-----
@@ -0,0 +1 @@
1
+ 287c0e2d61b94453f05b6c6b8d4666c49337022af56d4b3066ff6f9856747ef6ce5830b121bed2cfbe747716049c88ac1c9edc19a4cccc9b408454107899c663
@@ -0,0 +1 @@
1
+ 60fdd77882c1eac658fec94a3207b00d3556e082ee9a01ce4097d8fa297df32d66de4ec2fc780b7566dc331975ad4469143dd8eb0dcd8df985c01405ce57c580
@@ -0,0 +1,16 @@
1
+ # Scripts
2
+
3
+ [Scripts used in this project](https://gist.github.com/bf4/7209165)
4
+
5
+
6
+ Generate list of contributors in descending number of code changes
7
+
8
+ ```sh
9
+ ruby git-rank-contributors.rb > CONTRIBUTORS
10
+ ```
11
+
12
+ Generate entity diagram
13
+
14
+ ```sh
15
+ ruby erd.rb
16
+ ```
@@ -0,0 +1,173 @@
1
+ digraph classes {
2
+ graph [rotate=0, rankdir="LR"]
3
+ node [fillcolor="#c4ddec", style="filled", fontname="Helvetica Neue"]
4
+ edge [color="#444444"]
5
+ Exception [label="Exception"]
6
+ MetricFu__AnalysisError [label="MetricFu::AnalysisError"]
7
+ MetricFu__AnalyzerTables [label="MetricFu::AnalyzerTables"]
8
+ MetricFu__CaneGenerator [label="MetricFu::CaneGenerator"]
9
+ MetricFu__CaneGrapher [label="MetricFu::CaneGrapher"]
10
+ MetricFu__CaneViolations__AbcComplexity [label="MetricFu::CaneViolations::AbcComplexity"]
11
+ MetricFu__CaneViolations__Comment [label="MetricFu::CaneViolations::Comment"]
12
+ MetricFu__CaneViolations__Documentation [label="MetricFu::CaneViolations::Documentation"]
13
+ MetricFu__CaneViolations__LineStyle [label="MetricFu::CaneViolations::LineStyle"]
14
+ MetricFu__CaneViolations__Others [label="MetricFu::CaneViolations::Others"]
15
+ MetricFu__ChurnGenerator [label="MetricFu::ChurnGenerator"]
16
+ MetricFu__ChurnHotspot [label="MetricFu::ChurnHotspot"]
17
+ MetricFu__ClassMethodNode [label="MetricFu::ClassMethodNode"]
18
+ MetricFu__Configuration [label="MetricFu::Configuration"]
19
+ MetricFu__FlayGenerator [label="MetricFu::FlayGenerator"]
20
+ MetricFu__FlayGrapher [label="MetricFu::FlayGrapher"]
21
+ MetricFu__FlayHotspot [label="MetricFu::FlayHotspot"]
22
+ MetricFu__FlogGenerator [label="MetricFu::FlogGenerator"]
23
+ MetricFu__FlogGrapher [label="MetricFu::FlogGrapher"]
24
+ MetricFu__FlogHotspot [label="MetricFu::FlogHotspot"]
25
+ MetricFu__Formatter__HTML [label="MetricFu::Formatter::HTML"]
26
+ MetricFu__Formatter__YAML [label="MetricFu::Formatter::YAML"]
27
+ MetricFu__GemRun [label="MetricFu::GemRun"]
28
+ MetricFu__GemVersion [label="MetricFu::GemVersion"]
29
+ MetricFu__Generator [label="MetricFu::Generator"]
30
+ MetricFu__Graph [label="MetricFu::Graph"]
31
+ MetricFu__Grapher [label="MetricFu::Grapher"]
32
+ MetricFu__Grouping [label="MetricFu::Grouping"]
33
+ MetricFu__Hotspot [label="MetricFu::Hotspot"]
34
+ MetricFu__HotspotAnalyzedProblems [label="MetricFu::HotspotAnalyzedProblems"]
35
+ MetricFu__HotspotAnalyzer [label="MetricFu::HotspotAnalyzer"]
36
+ MetricFu__HotspotGroupings [label="MetricFu::HotspotGroupings"]
37
+ MetricFu__HotspotProblems [label="MetricFu::HotspotProblems"]
38
+ MetricFu__HotspotRankedProblemLocation [label="MetricFu::HotspotRankedProblemLocation"]
39
+ MetricFu__HotspotRankings [label="MetricFu::HotspotRankings"]
40
+ MetricFu__HotspotsGenerator [label="MetricFu::HotspotsGenerator"]
41
+ MetricFu__InstanceMethodNode [label="MetricFu::InstanceMethodNode"]
42
+ MetricFu__LineNumbers [label="MetricFu::LineNumbers"]
43
+ MetricFu__Loader [label="MetricFu::Loader"]
44
+ MetricFu__Location [label="MetricFu::Location"]
45
+ MetricFu__MethodContainer [label="MetricFu::MethodContainer"]
46
+ MetricFu__Metric [label="MetricFu::Metric"]
47
+ MetricFu__MetricCane [label="MetricFu::MetricCane"]
48
+ MetricFu__MetricChurn [label="MetricFu::MetricChurn"]
49
+ MetricFu__MetricFlay [label="MetricFu::MetricFlay"]
50
+ MetricFu__MetricFlog [label="MetricFu::MetricFlog"]
51
+ MetricFu__MetricHotspots [label="MetricFu::MetricHotspots"]
52
+ MetricFu__MetricRailsBestPractices [label="MetricFu::MetricRailsBestPractices"]
53
+ MetricFu__MetricRcov [label="MetricFu::MetricRcov"]
54
+ MetricFu__MetricReek [label="MetricFu::MetricReek"]
55
+ MetricFu__MetricRoodi [label="MetricFu::MetricRoodi"]
56
+ MetricFu__MetricSaikuro [label="MetricFu::MetricSaikuro"]
57
+ MetricFu__MetricStats [label="MetricFu::MetricStats"]
58
+ MetricFu__RailsBestPracticesGenerator [label="MetricFu::RailsBestPracticesGenerator"]
59
+ MetricFu__RailsBestPracticesGrapher [label="MetricFu::RailsBestPracticesGrapher"]
60
+ MetricFu__Ranking [label="MetricFu::Ranking"]
61
+ MetricFu__RcovGenerator [label="MetricFu::RcovGenerator"]
62
+ MetricFu__RcovGenerator__Line [label="MetricFu::RcovGenerator::Line"]
63
+ MetricFu__RcovGrapher [label="MetricFu::RcovGrapher"]
64
+ MetricFu__RcovHotspot [label="MetricFu::RcovHotspot"]
65
+ MetricFu__Record [label="MetricFu::Record"]
66
+ MetricFu__ReekGenerator [label="MetricFu::ReekGenerator"]
67
+ MetricFu__ReekGrapher [label="MetricFu::ReekGrapher"]
68
+ MetricFu__Reporter [label="MetricFu::Reporter"]
69
+ MetricFu__Result [label="MetricFu::Result"]
70
+ MetricFu__RoodiGenerator [label="MetricFu::RoodiGenerator"]
71
+ MetricFu__RoodiGrapher [label="MetricFu::RoodiGrapher"]
72
+ MetricFu__RoodiHotspot [label="MetricFu::RoodiHotspot"]
73
+ MetricFu__Run [label="MetricFu::Run"]
74
+ MetricFu__SaikuroGenerator [label="MetricFu::SaikuroGenerator"]
75
+ MetricFu__SaikuroHotspot [label="MetricFu::SaikuroHotspot"]
76
+ MetricFu__SaikuroParsingElement [label="MetricFu::SaikuroParsingElement"]
77
+ MetricFu__SaikuroScratchFile [label="MetricFu::SaikuroScratchFile"]
78
+ MetricFu__SexpNode [label="MetricFu::SexpNode"]
79
+ MetricFu__SingletonMethodNode [label="MetricFu::SingletonMethodNode"]
80
+ MetricFu__StatsGenerator [label="MetricFu::StatsGenerator"]
81
+ MetricFu__StatsGrapher [label="MetricFu::StatsGrapher"]
82
+ MetricFu__StatsHotspot [label="MetricFu::StatsHotspot"]
83
+ MetricFu__Table [label="MetricFu::Table"]
84
+ MetricFu__Template [label="MetricFu::Template"]
85
+ Object [label="Object"]
86
+ RuntimeError [label="RuntimeError"]
87
+ StandardError [label="StandardError"]
88
+ Struct [label="Struct"]
89
+ Exception -> Object
90
+ MetricFu__AnalysisError -> RuntimeError
91
+ MetricFu__AnalyzerTables -> Object
92
+ MetricFu__CaneGenerator -> MetricFu__Generator
93
+ MetricFu__CaneGrapher -> MetricFu__Grapher
94
+ MetricFu__CaneViolations__AbcComplexity -> Object
95
+ MetricFu__CaneViolations__Comment -> Object
96
+ MetricFu__CaneViolations__Documentation -> Object
97
+ MetricFu__CaneViolations__LineStyle -> Object
98
+ MetricFu__CaneViolations__Others -> Object
99
+ MetricFu__ChurnGenerator -> MetricFu__Generator
100
+ MetricFu__ChurnHotspot -> MetricFu__Hotspot
101
+ MetricFu__ClassMethodNode -> MetricFu__SexpNode
102
+ MetricFu__Configuration -> Object
103
+ MetricFu__FlayGenerator -> MetricFu__Generator
104
+ MetricFu__FlayGrapher -> MetricFu__Grapher
105
+ MetricFu__FlayHotspot -> MetricFu__Hotspot
106
+ MetricFu__FlogGenerator -> MetricFu__Generator
107
+ MetricFu__FlogGrapher -> MetricFu__Grapher
108
+ MetricFu__FlogHotspot -> MetricFu__Hotspot
109
+ MetricFu__Formatter__HTML -> Object
110
+ MetricFu__Formatter__YAML -> Object
111
+ MetricFu__GemRun -> Object
112
+ MetricFu__GemVersion -> Object
113
+ MetricFu__Generator -> Object
114
+ MetricFu__Graph -> Object
115
+ MetricFu__Grapher -> Object
116
+ MetricFu__Grouping -> Object
117
+ MetricFu__Hotspot -> Object
118
+ MetricFu__HotspotAnalyzedProblems -> Object
119
+ MetricFu__HotspotAnalyzer -> Object
120
+ MetricFu__HotspotGroupings -> Object
121
+ MetricFu__HotspotProblems -> Object
122
+ MetricFu__HotspotRankedProblemLocation -> Object
123
+ MetricFu__HotspotRankings -> Object
124
+ MetricFu__HotspotsGenerator -> MetricFu__Generator
125
+ MetricFu__InstanceMethodNode -> MetricFu__SexpNode
126
+ MetricFu__LineNumbers -> Object
127
+ MetricFu__Loader -> Object
128
+ MetricFu__Location -> Object
129
+ MetricFu__MethodContainer -> Object
130
+ MetricFu__Metric -> Object
131
+ MetricFu__MetricCane -> MetricFu__Metric
132
+ MetricFu__MetricChurn -> MetricFu__Metric
133
+ MetricFu__MetricFlay -> MetricFu__Metric
134
+ MetricFu__MetricFlog -> MetricFu__Metric
135
+ MetricFu__MetricHotspots -> MetricFu__Metric
136
+ MetricFu__MetricRailsBestPractices -> MetricFu__Metric
137
+ MetricFu__MetricRcov -> MetricFu__Metric
138
+ MetricFu__MetricReek -> MetricFu__Metric
139
+ MetricFu__MetricRoodi -> MetricFu__Metric
140
+ MetricFu__MetricSaikuro -> MetricFu__Metric
141
+ MetricFu__MetricStats -> MetricFu__Metric
142
+ MetricFu__RailsBestPracticesGenerator -> MetricFu__Generator
143
+ MetricFu__RailsBestPracticesGrapher -> MetricFu__Grapher
144
+ MetricFu__Ranking -> Object
145
+ MetricFu__RcovGenerator -> MetricFu__Generator
146
+ MetricFu__RcovGenerator__Line -> Object
147
+ MetricFu__RcovGrapher -> MetricFu__Grapher
148
+ MetricFu__RcovHotspot -> MetricFu__Hotspot
149
+ MetricFu__Record -> Object
150
+ MetricFu__ReekGenerator -> MetricFu__Generator
151
+ MetricFu__ReekGrapher -> MetricFu__Grapher
152
+ MetricFu__Reporter -> Object
153
+ MetricFu__Result -> Object
154
+ MetricFu__RoodiGenerator -> MetricFu__Generator
155
+ MetricFu__RoodiGrapher -> MetricFu__Grapher
156
+ MetricFu__RoodiHotspot -> MetricFu__Hotspot
157
+ MetricFu__Run -> Object
158
+ MetricFu__SaikuroGenerator -> MetricFu__Generator
159
+ MetricFu__SaikuroHotspot -> MetricFu__Hotspot
160
+ MetricFu__SaikuroParsingElement -> Object
161
+ MetricFu__SaikuroScratchFile -> Object
162
+ MetricFu__SexpNode -> Struct
163
+ MetricFu__SingletonMethodNode -> MetricFu__SexpNode
164
+ MetricFu__StatsGenerator -> MetricFu__Generator
165
+ MetricFu__StatsGrapher -> MetricFu__Grapher
166
+ MetricFu__StatsHotspot -> MetricFu__Hotspot
167
+ MetricFu__Table -> Object
168
+ MetricFu__Template -> Object
169
+ Object -> BasicObject
170
+ RuntimeError -> StandardError
171
+ StandardError -> Exception
172
+ Struct -> Object
173
+ }
Binary file
@@ -1,42 +1,66 @@
1
1
  require 'metric_fu/version'
2
+ require 'forwardable'
3
+ require 'pathname'
2
4
  module MetricFu
3
5
  APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__),'..'))
4
6
  LIB_ROOT = File.join(APP_ROOT,'lib/metric_fu')
5
- def self.root_dir
7
+
8
+ module_function
9
+
10
+ def run_dir
11
+ @run_dir ||= Dir.pwd
12
+ end
13
+
14
+ def run_path
15
+ Pathname(run_dir)
16
+ end
17
+
18
+ def run_dir=(run_dir)
19
+ @run_dir = run_dir
20
+ end
21
+
22
+ def root_dir
6
23
  APP_ROOT
7
24
  end
8
- def self.lib_dir
25
+ def lib_dir
9
26
  LIB_ROOT
10
27
  end
11
28
 
12
29
  require 'metric_fu/loader'
13
30
  LOADER = MetricFu::Loader.new(LIB_ROOT)
14
- def self.lib_require(base='',&block)
15
- LOADER.lib_require(base,&block)
31
+ def loader
32
+ LOADER
16
33
  end
34
+ extend SingleForwardable
35
+
36
+ def_delegators :loader, :lib_require, :load_tasks
17
37
 
18
- LOADER.create_dirs(self) do
38
+ def library_dirs
19
39
  %w(metrics formatter reporting logging errors data_structures tasks)
20
40
  end
21
41
 
42
+ loader.create_dirs(self) do
43
+ library_dirs
44
+ end
45
+
22
46
  # @note artifact_dir is relative to where the task is being run,
23
- # not to the metric_fu library
47
+ # not to the metric_fu library
24
48
  require 'metric_fu/io'
25
- def self.artifact_dir
49
+ def artifact_dir
26
50
  MetricFu::Io::FileSystem.artifact_dir
27
51
  end
28
52
 
29
- LOADER.create_artifact_subdirs(self) do
53
+ def artifact_subdirs
30
54
  %w(scratch output _data)
31
55
  end
32
56
 
33
- def self.tasks_load(tasks_relative_path)
34
- LOADER.load_tasks(tasks_relative_path)
57
+ loader.create_artifact_subdirs(self) do
58
+ artifact_subdirs
35
59
  end
36
60
 
37
- LOADER.setup
61
+ loader.setup
38
62
 
39
- def self.reset
63
+ def reset
40
64
  # TODO Don't like how this method needs to know
41
65
  # all of these class variables that are defined
42
66
  # in separate classes.
@@ -44,4 +68,24 @@ module MetricFu
44
68
  @graph = nil
45
69
  @result = nil
46
70
  end
71
+
72
+ def run(options)
73
+ MetricFu::Run.new.run(options)
74
+ end
75
+ def run_only(metrics_to_run_names, options)
76
+ metrics_to_run_names = Array(metrics_to_run_names).map(&:to_s)
77
+ MetricFu::Configuration.run do |config|
78
+ config.configure_metrics.each do |metric|
79
+ metric_name = metric.name.to_s
80
+ if metrics_to_run_names.include?(metric_name)
81
+ p "Enabling #{metric_name}"
82
+ metric.enabled = true
83
+ else
84
+ p "Disabling #{metric_name}"
85
+ metric.enabled = false
86
+ end
87
+ end
88
+ end
89
+ run(options)
90
+ end
47
91
  end
@@ -3,6 +3,12 @@ require 'metric_fu/cli/parser'
3
3
  # see https://github.com/grosser/pru/blob/master/bin/pru
4
4
  module MetricFu
5
5
  module Cli
6
+ def self.immediate_shutdown!
7
+ exit(1)
8
+ end
9
+ def self.complete!
10
+ exit(0)
11
+ end
6
12
  class Helper
7
13
  def initialize
8
14
  @metric_fu = MetricFu::Run.new
@@ -16,7 +22,7 @@ module MetricFu
16
22
  end
17
23
  def shutdown
18
24
  out "\nShuting down. Bye"
19
- exit(1)
25
+ MetricFu::Cli.immediate_shutdown!
20
26
  end
21
27
  def banner
22
28
  "MetricFu: A Fistful of code metrics"
@@ -57,7 +63,7 @@ module MetricFu
57
63
  end
58
64
  def complete
59
65
  out "all done"
60
- exit(0)
66
+ MetricFu::Cli.complete!
61
67
  end
62
68
  end
63
69
  end