metric_fu 2.1.3.7.19 → 2.1.4.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. data/.rspec +2 -0
  2. data/.travis.yml +12 -0
  3. data/Gemfile +2 -2
  4. data/HISTORY.md +15 -2
  5. data/README.md +19 -12
  6. data/TODO.md +121 -7
  7. data/bin/metric_fu +134 -2
  8. data/lib/metric_fu.rb +8 -1
  9. data/lib/metric_fu/configuration.rb +192 -0
  10. data/lib/{data_structures → metric_fu/data_structures}/careful_array.rb +0 -0
  11. data/lib/{data_structures → metric_fu/data_structures}/line_numbers.rb +0 -0
  12. data/lib/{data_structures → metric_fu/data_structures}/location.rb +0 -0
  13. data/lib/{errors → metric_fu/errors}/analysis_error.rb +0 -0
  14. data/lib/{initial_requires.rb → metric_fu/initial_requires.rb} +1 -0
  15. data/lib/{load_files.rb → metric_fu/load_files.rb} +0 -8
  16. data/lib/{logging → metric_fu/logging}/mf_debugger.rb +0 -0
  17. data/lib/{metrics → metric_fu/metrics}/base_template.rb +0 -0
  18. data/lib/metric_fu/metrics/churn/churn.rb +64 -0
  19. data/lib/{metrics → metric_fu/metrics}/churn/churn_hotspot.rb +0 -0
  20. data/lib/metric_fu/metrics/churn/init.rb +5 -0
  21. data/lib/{metrics → metric_fu/metrics}/churn/template_awesome/churn.html.erb +0 -0
  22. data/lib/{metrics → metric_fu/metrics}/churn/template_standard/churn.html.erb +0 -0
  23. data/lib/{metrics → metric_fu/metrics}/flay/flay.rb +3 -1
  24. data/lib/{metrics → metric_fu/metrics}/flay/flay_grapher.rb +0 -0
  25. data/lib/{metrics → metric_fu/metrics}/flay/flay_hotspot.rb +0 -0
  26. data/lib/metric_fu/metrics/flay/init.rb +9 -0
  27. data/lib/{metrics → metric_fu/metrics}/flay/template_awesome/flay.html.erb +0 -0
  28. data/lib/{metrics → metric_fu/metrics}/flay/template_standard/flay.html.erb +0 -0
  29. data/lib/{metrics → metric_fu/metrics}/flog/flog.rb +0 -0
  30. data/lib/{metrics → metric_fu/metrics}/flog/flog_grapher.rb +0 -0
  31. data/lib/{metrics → metric_fu/metrics}/flog/flog_hotspot.rb +0 -0
  32. data/lib/metric_fu/metrics/flog/init.rb +7 -0
  33. data/lib/{metrics → metric_fu/metrics}/flog/template_awesome/flog.html.erb +0 -0
  34. data/lib/{metrics → metric_fu/metrics}/flog/template_standard/flog.html.erb +0 -0
  35. data/lib/{metrics → metric_fu/metrics}/generator.rb +3 -4
  36. data/lib/{metrics → metric_fu/metrics}/graph.rb +0 -0
  37. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/code_issue.rb +0 -0
  38. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/grouping.rb +0 -0
  39. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/ranking.rb +0 -0
  40. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/record.rb +0 -0
  41. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/scoring_strategies.rb +0 -0
  42. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/table.rb +0 -0
  43. data/lib/{metrics → metric_fu/metrics}/hotspots/hotspot_analyzer.rb +0 -0
  44. data/lib/{metrics → metric_fu/metrics}/hotspots/hotspots.rb +0 -0
  45. data/lib/metric_fu/metrics/hotspots/init.rb +5 -0
  46. data/lib/{metrics → metric_fu/metrics}/hotspots/template_awesome/hotspots.html.erb +0 -0
  47. data/lib/{metrics → metric_fu/metrics}/hotspots/template_standard/hotspots.html.erb +0 -0
  48. data/lib/metric_fu/metrics/rails_best_practices/init.rb +7 -0
  49. data/lib/{metrics → metric_fu/metrics}/rails_best_practices/rails_best_practices.rb +4 -2
  50. data/lib/{metrics → metric_fu/metrics}/rails_best_practices/rails_best_practices_grapher.rb +0 -0
  51. data/lib/{metrics → metric_fu/metrics}/rails_best_practices/template_awesome/rails_best_practices.html.erb +0 -0
  52. data/lib/{metrics → metric_fu/metrics}/rails_best_practices/template_standard/rails_best_practices.html.erb +0 -0
  53. data/lib/metric_fu/metrics/rcov/init.rb +18 -0
  54. data/lib/{metrics → metric_fu/metrics}/rcov/rcov.rb +22 -7
  55. data/lib/{metrics → metric_fu/metrics}/rcov/rcov_grapher.rb +0 -0
  56. data/lib/{metrics → metric_fu/metrics}/rcov/rcov_hotspot.rb +0 -0
  57. data/lib/{metrics → metric_fu/metrics}/rcov/template_awesome/rcov.html.erb +0 -0
  58. data/lib/{metrics → metric_fu/metrics}/rcov/template_standard/rcov.html.erb +0 -0
  59. data/lib/metric_fu/metrics/reek/init.rb +7 -0
  60. data/lib/{metrics → metric_fu/metrics}/reek/reek.rb +3 -1
  61. data/lib/{metrics → metric_fu/metrics}/reek/reek_grapher.rb +0 -0
  62. data/lib/{metrics → metric_fu/metrics}/reek/reek_hotspot.rb +0 -0
  63. data/lib/{metrics → metric_fu/metrics}/reek/template_awesome/reek.html.erb +0 -0
  64. data/lib/{metrics → metric_fu/metrics}/reek/template_standard/reek.html.erb +0 -0
  65. data/lib/metric_fu/metrics/roodi/init.rb +7 -0
  66. data/lib/{metrics → metric_fu/metrics}/roodi/roodi.rb +3 -1
  67. data/lib/{metrics → metric_fu/metrics}/roodi/roodi_grapher.rb +0 -0
  68. data/lib/{metrics → metric_fu/metrics}/roodi/roodi_hotspot.rb +0 -0
  69. data/lib/{metrics → metric_fu/metrics}/roodi/template_awesome/roodi.html.erb +0 -0
  70. data/lib/{metrics → metric_fu/metrics}/roodi/template_standard/roodi.html.erb +0 -0
  71. data/lib/metric_fu/metrics/saikuro/init.rb +11 -0
  72. data/lib/{metrics → metric_fu/metrics}/saikuro/saikuro.rb +0 -0
  73. data/lib/{metrics → metric_fu/metrics}/saikuro/saikuro_hotspot.rb +0 -0
  74. data/lib/{metrics → metric_fu/metrics}/saikuro/template_awesome/saikuro.html.erb +0 -0
  75. data/lib/{metrics → metric_fu/metrics}/saikuro/template_standard/saikuro.html.erb +0 -0
  76. data/lib/metric_fu/metrics/stats/init.rb +7 -0
  77. data/lib/{metrics → metric_fu/metrics}/stats/stats.rb +3 -1
  78. data/lib/{metrics → metric_fu/metrics}/stats/stats_grapher.rb +0 -0
  79. data/lib/{metrics → metric_fu/metrics}/stats/stats_hotspot.rb +0 -0
  80. data/lib/{metrics → metric_fu/metrics}/stats/template_awesome/stats.html.erb +0 -0
  81. data/lib/{metrics → metric_fu/metrics}/stats/template_standard/stats.html.erb +0 -0
  82. data/lib/{reporting → metric_fu/reporting}/graphs/engines/bluff.rb +0 -0
  83. data/lib/{reporting → metric_fu/reporting}/graphs/engines/gchart.rb +0 -0
  84. data/lib/metric_fu/reporting/graphs/engines/init.rb +5 -0
  85. data/lib/{reporting → metric_fu/reporting}/graphs/grapher.rb +0 -0
  86. data/lib/{reporting → metric_fu/reporting}/report.rb +3 -2
  87. data/lib/{reporting → metric_fu/reporting}/templates/awesome/awesome_template.rb +0 -0
  88. data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/buttons.css +0 -0
  89. data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/default.css +0 -0
  90. data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/integrity.css +0 -0
  91. data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/reset.css +0 -0
  92. data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/syntax.css +0 -0
  93. data/lib/{reporting → metric_fu/reporting}/templates/awesome/index.html.erb +0 -0
  94. data/lib/{reporting → metric_fu/reporting}/templates/awesome/layout.html.erb +0 -0
  95. data/lib/{reporting → metric_fu/reporting}/templates/javascripts/bluff-min.js +0 -0
  96. data/lib/{reporting → metric_fu/reporting}/templates/javascripts/excanvas.js +0 -0
  97. data/lib/{reporting → metric_fu/reporting}/templates/javascripts/js-class.js +0 -0
  98. data/lib/{reporting → metric_fu/reporting}/templates/standard/default.css +0 -0
  99. data/lib/{reporting → metric_fu/reporting}/templates/standard/index.html.erb +0 -0
  100. data/lib/{reporting → metric_fu/reporting}/templates/standard/standard_template.rb +0 -0
  101. data/lib/{run.rb → metric_fu/run.rb} +12 -11
  102. data/lib/{tasks → metric_fu/tasks}/metric_fu.rake +0 -0
  103. data/lib/metric_fu/version.rb +3 -0
  104. data/metric_fu.gemspec +13 -21
  105. data/spec/metric_fu/configuration_spec.rb +298 -0
  106. data/spec/{base → metric_fu/data_structures}/line_numbers_spec.rb +11 -11
  107. data/spec/{base → metric_fu/data_structures}/location_spec.rb +1 -1
  108. data/spec/{base → metric_fu/metrics}/base_template_spec.rb +1 -1
  109. data/spec/metric_fu/metrics/churn/churn_spec.rb +85 -0
  110. data/spec/{graphs → metric_fu/metrics/flay}/flay_grapher_spec.rb +3 -3
  111. data/spec/{generators → metric_fu/metrics/flay}/flay_spec.rb +1 -1
  112. data/spec/{graphs → metric_fu/metrics/flog}/flog_grapher_spec.rb +4 -4
  113. data/spec/{generators → metric_fu/metrics/flog}/flog_spec.rb +1 -1
  114. data/spec/{base → metric_fu/metrics}/generator_spec.rb +4 -3
  115. data/spec/{base → metric_fu/metrics}/graph_spec.rb +1 -1
  116. data/spec/{base → metric_fu/metrics/hotspots/analysis}/ranking_spec.rb +1 -1
  117. data/spec/{base → metric_fu/metrics/hotspots/analysis}/table_spec.rb +1 -1
  118. data/spec/{base → metric_fu/metrics/hotspots}/hotspot_analyzer_spec.rb +1 -1
  119. data/spec/{generators → metric_fu/metrics/hotspots}/hotspots_spec.rb +1 -1
  120. data/spec/{graphs → metric_fu/metrics/rails_best_practices}/rails_best_practices_grapher_spec.rb +3 -3
  121. data/spec/{generators → metric_fu/metrics/rails_best_practices}/rails_best_practices_spec.rb +1 -1
  122. data/spec/{graphs → metric_fu/metrics/rcov}/rcov_grapher_spec.rb +3 -3
  123. data/spec/{generators → metric_fu/metrics/rcov}/rcov_spec.rb +1 -1
  124. data/spec/{graphs → metric_fu/metrics/reek}/reek_grapher_spec.rb +3 -3
  125. data/spec/{generators → metric_fu/metrics/reek}/reek_spec.rb +1 -1
  126. data/spec/{graphs → metric_fu/metrics/roodi}/roodi_grapher_spec.rb +3 -3
  127. data/spec/{generators → metric_fu/metrics/roodi}/roodi_spec.rb +1 -1
  128. data/spec/{generators → metric_fu/metrics/saikuro}/saikuro_spec.rb +4 -4
  129. data/spec/{graphs → metric_fu/metrics/stats}/stats_grapher_spec.rb +3 -3
  130. data/spec/{generators → metric_fu/metrics/stats}/stats_spec.rb +7 -4
  131. data/spec/{graphs → metric_fu/reporting/graphs}/engines/bluff_spec.rb +3 -3
  132. data/spec/{graphs → metric_fu/reporting/graphs}/engines/gchart_spec.rb +2 -1
  133. data/spec/{base → metric_fu/reporting}/report_spec.rb +5 -3
  134. data/spec/spec_helper.rb +17 -5
  135. data/spec/support/suite.rb +16 -0
  136. metadata +195 -183
  137. data/lib/configuration.rb +0 -227
  138. data/lib/metrics/churn/churn.rb +0 -28
  139. data/lib/version.rb +0 -3
  140. data/spec/base/configuration_spec.rb +0 -277
  141. data/spec/generators/churn_spec.rb +0 -41
  142. data/spec/spec.opts +0 -6
@@ -0,0 +1,192 @@
1
+ require 'fileutils'
2
+ MetricFu.reporting_require { 'templates/awesome/awesome_template' }
3
+ module MetricFu
4
+
5
+
6
+ # The @configuration class variable holds a global type configuration
7
+ # object for any parts of the system to use.
8
+ # TODO Configuration should probably be a singleton class
9
+ def self.configuration
10
+ @configuration ||= Configuration.new
11
+ end
12
+
13
+ # = Configuration
14
+ #
15
+ # The Configuration class, as it sounds, provides methods for
16
+ # configuring the behaviour of MetricFu.
17
+ #
18
+ # == Customization for Rails
19
+ #
20
+ # The Configuration class checks for the presence of a
21
+ # 'config/environment.rb' file. If the file is present, it assumes
22
+ # it is running in a Rails project. If it is, it will:
23
+ #
24
+ # * Add 'app' to the @code_dirs directory to include the
25
+ # code in the app directory in the processing
26
+ # * Add :stats and :rails_best_practices to the list of metrics to run
27
+ #
28
+ # == Customization for CruiseControl.rb
29
+ #
30
+ # The Configuration class checks for the presence of a
31
+ # 'CC_BUILD_ARTIFACTS' environment variable. If it's found
32
+ # it will change the default output directory from the default
33
+ # "tmp/metric_fu to the directory represented by 'CC_BUILD_ARTIFACTS'
34
+ #
35
+ # == Metric Configuration
36
+ #
37
+ # Each metric can be configured by e.g. config.churn, config.flog, config.saikuro
38
+ class Configuration
39
+
40
+ def initialize #:nodoc:#
41
+ reset
42
+ end
43
+
44
+ def verbose
45
+ MfDebugger::Logger.debug_on
46
+ end
47
+
48
+ def verbose=(toggle)
49
+ MfDebugger::Logger.debug_on = toggle
50
+ end
51
+
52
+ # TODO review if these code is functionally duplicated in the
53
+ # base generator initialize
54
+ def reset
55
+ set_directories
56
+ configure_template
57
+ add_promiscuous_instance_variable(:metrics, [])
58
+ add_promiscuous_instance_variable(:graphs, [])
59
+ add_promiscuous_instance_variable(:graph_engines, [])
60
+ add_promiscuous_method(:graph_engine)
61
+ end
62
+
63
+ # This allows us to have a nice syntax like:
64
+ #
65
+ # MetricFu.run do |config|
66
+ # config.base_directory = 'tmp/metric_fu'
67
+ # end
68
+ #
69
+ # See the README for more information on configuration options.
70
+ def self.run
71
+ yield MetricFu.configuration
72
+ end
73
+
74
+ attr_accessor :metrics
75
+ # e.g. :churn
76
+ def add_metric(metric)
77
+ add_promiscuous_method(metric)
78
+ self.metrics = (metrics << metric).uniq
79
+ end
80
+
81
+ # e.g. :reek
82
+ def add_graph(metric)
83
+ add_promiscuous_method(metric)
84
+ self.graphs = (graphs << metric).uniq
85
+ end
86
+
87
+ # e.g. :reek, {}
88
+ def configure_metric(metric, metric_configuration)
89
+ add_promiscuous_instance_variable(metric, metric_configuration)
90
+ end
91
+
92
+ # e.g. :bluff
93
+ def add_graph_engine(graph_engine)
94
+ add_promiscuous_method(graph_engine)
95
+ self.graph_engines = (graph_engines << graph_engine).uniq
96
+ end
97
+
98
+ # e.g. :bluff
99
+ def configure_graph_engine(graph_engine)
100
+ add_promiscuous_instance_variable(:graph_engine, graph_engine)
101
+ end
102
+
103
+ # Perform a simple check to try and guess if we're running
104
+ # against a rails app.
105
+ #
106
+ # TODO This should probably be made a bit more robust.
107
+ def rails?
108
+ add_promiscuous_instance_variable(:rails, File.exist?("config/environment.rb"))
109
+ end
110
+
111
+ def is_cruise_control_rb?
112
+ !!ENV['CC_BUILD_ARTIFACTS']
113
+ end
114
+
115
+ def platform #:nodoc:
116
+ return RUBY_PLATFORM
117
+ end
118
+
119
+ def self.ruby_strangely_makes_accessors_private?
120
+ !!(RUBY_VERSION =~ /1.9.2/)
121
+ end
122
+ protected unless ruby_strangely_makes_accessors_private?
123
+
124
+ def add_promiscuous_instance_variable(name,value)
125
+ instance_variable_set("@#{name}", value)
126
+ add_promiscuous_method(name)
127
+ value
128
+ end
129
+
130
+ def add_promiscuous_method(method_name)
131
+ add_promiscuous_class_method_to_metric_fu(method_name)
132
+ add_accessor_to_config(method_name)
133
+ end
134
+
135
+ def add_promiscuous_class_method_to_metric_fu(method_name)
136
+ metric_fu_method = <<-EOF
137
+ def self.#{method_name}
138
+ configuration.send(:#{method_name})
139
+ end
140
+ EOF
141
+ MetricFu.module_eval(metric_fu_method)
142
+ end
143
+
144
+
145
+ def add_accessor_to_config(method_name)
146
+ self.class.send(:attr_accessor, method_name)
147
+ end
148
+
149
+ private
150
+
151
+ def configure_template
152
+ add_promiscuous_instance_variable(:template_class, AwesomeTemplate)
153
+ add_promiscuous_instance_variable(:link_prefix, nil)
154
+ add_promiscuous_instance_variable(:darwin_txmt_protocol_no_thanks, true)
155
+ # turning off syntax_highlighting may avoid some UTF-8 issues
156
+ add_promiscuous_instance_variable(:syntax_highlighting, true)
157
+ end
158
+
159
+ def set_directories
160
+ add_promiscuous_instance_variable(:base_directory,MetricFu.artifact_dir)
161
+ add_promiscuous_instance_variable(:scratch_directory,MetricFu.scratch_dir)
162
+ add_promiscuous_instance_variable(:output_directory,MetricFu.output_dir)
163
+ add_promiscuous_instance_variable(:data_directory,MetricFu.data_dir)
164
+ # due to behavior differences between ruby 1.8.7 and 1.9.3
165
+ # this is good enough for now
166
+ create_directories [base_directory, scratch_directory, output_directory]
167
+
168
+ add_promiscuous_instance_variable(:metric_fu_root_directory,MetricFu.root_dir)
169
+ add_promiscuous_instance_variable(:template_directory,
170
+ File.join(metric_fu_root_directory,
171
+ 'lib', 'templates'))
172
+ add_promiscuous_instance_variable(:file_globs_to_ignore,[])
173
+ set_code_dirs
174
+ end
175
+
176
+ def create_directories(*dirs)
177
+ Array(*dirs).each do |dir|
178
+ FileUtils.mkdir_p dir
179
+ end
180
+ end
181
+
182
+ # Add the 'app' directory if we're running within rails.
183
+ def set_code_dirs
184
+ if rails?
185
+ add_promiscuous_instance_variable(:code_dirs,['app', 'lib'])
186
+ else
187
+ add_promiscuous_instance_variable(:code_dirs,['lib'])
188
+ end
189
+ end
190
+
191
+ end
192
+ end
File without changes
@@ -20,6 +20,7 @@ begin
20
20
  rescue LoadError
21
21
  require 'activesupport' unless defined?(ActiveSupport)
22
22
  end
23
+ MetricFu.configure
23
24
  MetricFu.logging_require { 'mf_debugger' }
24
25
  include MfDebugger
25
26
  MfDebugger::Logger.debug_on = !!(ENV['MF_DEBUG'] =~ /true/i)
@@ -5,7 +5,6 @@ MetricFu.metrics_require { 'graph' }
5
5
  MetricFu.reporting_require { 'graphs/grapher' }
6
6
  MetricFu.metrics_require { 'hotspots/analysis/scoring_strategies' }
7
7
 
8
- # Now load everything else that's in the directory
9
8
  Dir.glob(File.join(MetricFu.lib_dir, '*.rb')).each do |file|
10
9
  require file
11
10
  end
@@ -29,10 +28,3 @@ end
29
28
  Dir.glob(File.join(MetricFu.reporting_dir, '**/*.rb')).each do |file|
30
29
  require file
31
30
  end
32
- # Dir[File.expand_path File.join(base_dir, '*.rb')].each{|l| require l }
33
- # Dir[File.expand_path File.join(generator_dir, '*.rb')].each {|l| require l }
34
- # Dir[File.expand_path File.join(template_dir, 'standard/*.rb')].each {|l| require l}
35
- # Dir[File.expand_path File.join(template_dir, 'awesome/*.rb')].each {|l| require l}
36
- # require graph_dir + "/grapher"
37
- # Dir[File.expand_path File.join(graph_dir, '*.rb')].each {|l| require l}
38
- # Dir[File.expand_path File.join(graph_dir, 'engines', '*.rb')].each {|l| require l}
File without changes
File without changes
@@ -0,0 +1,64 @@
1
+ module MetricFu
2
+
3
+ class Churn < Generator
4
+
5
+ def emit
6
+ @output = generate_churn_metrics
7
+ end
8
+
9
+ def analyze
10
+ if @output.match(/Churning requires a subversion or git repo/)
11
+ @churn = [:churn => {}]
12
+ else
13
+ @churn = YAML::load(@output)
14
+ end
15
+ end
16
+
17
+ # ensure hash only has the :churn key
18
+ def to_h
19
+ {:churn => @churn[:churn]}
20
+ end
21
+
22
+ private
23
+
24
+ def generate_churn_metrics
25
+ ensure_output_is_valid_yaml(churn_code)
26
+ end
27
+
28
+ def ensure_output_is_valid_yaml(output)
29
+ yaml_start = output.index("---")
30
+ if yaml_start
31
+ output[yaml_start...output.length]
32
+ else
33
+ nil
34
+ end
35
+ end
36
+
37
+ def churn_code
38
+ command = "churn #{build_churn_options}"
39
+ mf_debug "** #{command}"
40
+ `#{command}`
41
+ end
42
+
43
+ def build_churn_options
44
+ opts = ["--yaml"]
45
+ churn_options.each do |churn_option, command_flag|
46
+ if has_option?(churn_option)
47
+ opts << "#{command_flag}=#{options[churn_option]}"
48
+ end
49
+ end
50
+ opts.join(" ")
51
+ end
52
+
53
+ def has_option?(churn_option)
54
+ options.include?(churn_option)
55
+ end
56
+ def churn_options
57
+ {
58
+ :minimum_churn_count => '--minimum_churn_count'
59
+ }
60
+ end
61
+
62
+ end
63
+
64
+ end
@@ -0,0 +1,5 @@
1
+ MetricFu::Configuration.run do |config|
2
+ config.add_metric(:churn)
3
+ config.configure_metric(:churn,
4
+ { :start_date => "1 year ago", :minimum_churn_count => 10})
5
+ end
@@ -7,7 +7,9 @@ module MetricFu
7
7
  def emit
8
8
  mimimum_score_parameter = MetricFu.flay[:minimum_score] ? "--mass #{MetricFu.flay[:minimum_score]} " : ""
9
9
 
10
- @output = `flay #{mimimum_score_parameter} #{MetricFu.flay[:dirs_to_flay].join(" ")}`
10
+ command = %Q(flay #{mimimum_score_parameter} #{MetricFu.flay[:dirs_to_flay].join(" ")})
11
+ mf_debug "** #{command}"
12
+ @output = `#{command}`
11
13
  end
12
14
 
13
15
  def analyze
@@ -0,0 +1,9 @@
1
+ MetricFu::Configuration.run do |config|
2
+ config.add_metric(:flay)
3
+ config.add_graph(:flay)
4
+ config.configure_metric(:flay,
5
+ { :dirs_to_flay => MetricFu.code_dirs, # was @code_dirs
6
+ :minimum_score => 100,
7
+ :filetypes => ['rb'] }
8
+ )
9
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ MetricFu::Configuration.run do |config|
2
+ config.add_metric(:flog)
3
+ config.add_graph(:flog)
4
+ config.configure_metric(:flog,
5
+ { :dirs_to_flog => MetricFu.code_dirs }
6
+ )
7
+ end
@@ -30,9 +30,10 @@ module MetricFu
30
30
  # in general setup the directory structure that the MetricFu system
31
31
  # expects.
32
32
  class Generator
33
- attr_reader :report, :template
33
+ attr_reader :report, :template, :options
34
34
 
35
35
  def initialize(options={})
36
+ @options = options
36
37
  create_metric_dir_if_missing
37
38
  create_output_dir_if_missing
38
39
  create_data_dir_if_missing
@@ -121,9 +122,7 @@ module MetricFu
121
122
  # methods to allow extra hooks into the processing methods, and help
122
123
  # to keep the logic of your Generators clean.
123
124
  def generate_report
124
- if MetricFu.configuration.verbose
125
- puts "Executing #{self.class.to_s.gsub(/.*::/, '')}"
126
- end
125
+ mf_debug "Executing #{self.class.to_s.gsub(/.*::/, '')}"
127
126
 
128
127
  %w[emit analyze].each do |meth|
129
128
  send("before_#{meth}".to_sym)
File without changes
@@ -0,0 +1,5 @@
1
+ MetricFu::Configuration.run do |config|
2
+ config.add_metric(:hotspots)
3
+ config.configure_metric(:hotspots,
4
+ { :start_date => "1 year ago", :minimum_churn_count => 10})
5
+ end
@@ -0,0 +1,7 @@
1
+ MetricFu::Configuration.run do |config|
2
+ if config.rails?
3
+ config.add_metric(:rails_best_practices)
4
+ config.add_graph(:rails_best_practices)
5
+ config.configure_metric(:rails_best_practices, {})
6
+ end
7
+ end
@@ -1,8 +1,10 @@
1
1
  module MetricFu
2
2
  class RailsBestPractices < Generator
3
- VERSION = '0.10.1'
3
+ VERSION = '1.13.2'
4
4
  def emit
5
- @output = `rails_best_practices _#{VERSION}_ --without-color .`
5
+ command = %Q(rails_best_practices _#{VERSION}_ --without-color .)
6
+ mf_debug "** #{command}"
7
+ @output = `#{command}`
6
8
  end
7
9
 
8
10
  def analyze