p8-metric_fu 0.8.4.13 → 0.8.4.14

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -49,11 +49,11 @@ Which will check for updates every 24 hours and run all the metrics rake tasks (
49
49
 
50
50
  ****Notes on configuration****
51
51
 
52
+ Metric_fu can be customized to your liking by adding the following to your Rakefile
53
+
52
54
  MetricFu::Configuration.run do |config|
53
55
  #define which metrics you want to use
54
- config.metrics = [:coverage, :flog]
55
- # Don't open reports in the browser on a mac
56
- config.open_in_browser = false
56
+ config.metrics = [:coverage, :flog]
57
57
  config.churn_options = { :start_date => lambda{ 3.months.ago } }
58
58
  config.coverage_options = { :test_files => ['test/**/test_*.rb'] }
59
59
  config.flog_options = { :dirs_to_flog => ['cms/app', 'cms/lib'] }
@@ -66,39 +66,38 @@ end
66
66
 
67
67
  When creating a coverage report, metric_fu runs all the tests in the test folder and specs in spec folder using Rcov.
68
68
  You can configure the coverage test files pattern:
69
- config.coverage_test_files = ['test/**/test_*.rb']
69
+ config.coverage_options[:test_files] = ['test/**/test_*.rb']
70
70
 
71
71
  The default value is ['test/**/*_test.rb', 'spec/**/*_spec.rb']
72
72
 
73
73
 
74
74
  ****Notes on metrics:saikuro****
75
75
 
76
- Saikuro is bundled with metric_fu so you don't have to install it. Look at the SAIKURO_README (or the internet) for more documentation on Saikuro. If you wish to change the options Saikuro is run with, then set this constant in your Rakefile:
76
+ Saikuro is bundled with metric_fu so you don't have to install it. Look at the SAIKURO_README (or the internet) for more documentation on Saikuro. If you wish to change the options Saikuro is run with, then set this constant in your configuration:
77
77
 
78
78
  config.saikuro_options = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
79
79
 
80
80
  saikuro_options is a hash that gets merged with the default options hash. The above example will set the warn_cyclo to 3 and the error_cyclo to 4 (which is way too low -- it's just an example) instructing Saikuro to flag methods with a higher cyclomatic complexity in it's report.
81
81
 
82
- If you want to have Saikuro look at multiple folders you can put something like this in your rakefile:
82
+ If you want to have Saikuro look at multiple folders you can put something like this in your configuration:
83
83
 
84
84
  config.saikuro_options = {"--input_directory" => '"cms/app | cms/lib"'}
85
85
 
86
86
 
87
87
  ****Notes on metrics:flay****
88
88
 
89
- Flog is another way of measuring complexity (or tortured code as the Flog authors like to put it). You should check out the awesome, and a little scary, Flog website for more info.
90
-
91
- 'rake metrics:flog:custom' allows you to specify a custom set of directories to Flay (in your rakefile) like so:
92
-
89
+ Flay analyzes ruby code for structural similarities.
90
+ You can configure which directories need to be flayed.
91
+ The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
93
92
  config.flay_options[:dirs_to_flay] = ['cms/app', 'cms/lib']
94
93
 
95
94
  ****Notes on metrics:flog****
96
95
 
97
- Flog is another way of measuring complexity (or tortured code as the Flog authors like to put it). You should check out the awesome, and a little scary, Flog website for more info.
98
-
99
- 'rake metrics:flog:custom' allows you to specify a custom set of directories to Flog (in your rakefile) like so:
96
+ Flog is another way of measuring complexity (or tortured code as the Flog authors like to put it). You should check out the awesome, and a little scary, Flog website for more info.
97
+ 'rake metrics:flog:custom' allows you to specify a custom set of directories to Flog (in your configuration).
98
+ The defaults are 'lib' for non Rails projects and ['app', 'lib'] for Rails projects.
100
99
 
101
- config.flog_options[:dirs_to_flog] = ['cms/app', 'cms/lib']
100
+ config.flog_options[:dirs_to_flog] = ['cms/app', 'cms/lib']
102
101
 
103
102
 
104
103
  ****Notes on metrics:stats****
data/Rakefile CHANGED
@@ -8,8 +8,4 @@ Spec::Rake::SpecTask.new(:spec) do |t|
8
8
  t.spec_files = FileList['spec/**/*_spec.rb']
9
9
  end
10
10
 
11
- MetricFu::Configuration.run do |config|
12
- config.metrics = [:coverage, :flog, :flay]
13
- config.open_in_browser = false
14
- end
15
11
  task :default => [:"metrics:all"]
@@ -103,7 +103,7 @@ module MetricFu
103
103
  end
104
104
 
105
105
  def open_in_browser?
106
- PLATFORM['darwin'] && configuration.open_in_browser
106
+ PLATFORM['darwin'] && !ENV['CC_BUILD_ARTIFACTS']
107
107
  end
108
108
 
109
109
  def saikuro_options
@@ -113,7 +113,7 @@ module MetricFu
113
113
  end
114
114
 
115
115
  class Configuration
116
- attr_accessor :churn_options, :coverage_options, :flay_options, :flog_options, :metrics, :open_in_browser, :saikuro_options
116
+ attr_accessor :churn_options, :coverage_options, :flay_options, :flog_options, :metrics, :saikuro_options
117
117
  def initialize
118
118
  raise "Use config.churn_options instead of MetricFu::CHURN_OPTIONS" if defined? ::MetricFu::CHURN_OPTIONS
119
119
  raise "Use config.flog_options[:dirs_to_flog] instead of MetricFu::DIRECTORIES_TO_FLOG" if defined? ::MetricFu::DIRECTORIES_TO_FLOG
@@ -131,7 +131,6 @@ module MetricFu
131
131
  @flay_options = { :dirs_to_flay => CODE_DIRS}
132
132
  @flog_options = { :dirs_to_flog => CODE_DIRS}
133
133
  @metrics = DEFAULT_METRICS
134
- @open_in_browser = true
135
134
  @saikuro_options = {}
136
135
  end
137
136
 
data/lib/tasks/flog.rake CHANGED
@@ -4,7 +4,7 @@ begin
4
4
  Dir.glob("#{directory}/**/*.rb").each do |filename|
5
5
  output_dir = "#{MetricFu::FLOG_DIR}/#{filename.split("/")[0..-2].join("/")}"
6
6
  mkdir_p(output_dir, :verbose => false) unless File.directory?(output_dir)
7
- puts `flog #{filename} > #{MetricFu::FLOG_DIR}/#{filename.split('.')[0]}.txt` if MetricFu::MD5Tracker.file_changed?(filename, MetricFu::FLOG_DIR)
7
+ `flog #{filename} > #{MetricFu::FLOG_DIR}/#{filename.split('.')[0]}.txt` if MetricFu::MD5Tracker.file_changed?(filename, MetricFu::FLOG_DIR)
8
8
  end
9
9
  end
10
10
 
data/spec/config_spec.rb CHANGED
@@ -4,15 +4,15 @@ describe MetricFu::Configuration do
4
4
  before do
5
5
  MetricFu.configuration.reset
6
6
  end
7
+ after do
8
+ ENV['CC_BUILD_ARTIFACTS'] = nil
9
+ end
7
10
  describe "open_in_browser" do
8
- it "should be configurable" do
11
+ it "should return false if running in cruise" do
9
12
  MetricFu.open_in_browser?.should == !!PLATFORM['darwin']
10
- MetricFu::Configuration.run do |config|
11
- config.open_in_browser = false
12
- end
13
- MetricFu.configuration.open_in_browser.should == false
13
+ ENV['CC_BUILD_ARTIFACTS'] = ''
14
14
  MetricFu.open_in_browser?.should == false
15
- end
15
+ end
16
16
  end
17
17
 
18
18
  describe "metrics" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: p8-metric_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4.13
4
+ version: 0.8.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Scruggs