metric_fu 2.1.3.5 → 2.1.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,5 +1,9 @@
1
1
  source :rubygems
2
2
 
3
- gem 'rake', '<=0.9.2'
4
-
3
+ gem 'rake', '<0.9.3'
4
+ group :development, :test do
5
+ gem "rspec", "= 1.3.0"
6
+ gem "test-construct", ">= 1.2.0"
7
+ gem "googlecharts"
8
+ end
5
9
  gemspec
data/HISTORY.md CHANGED
@@ -1,3 +1,12 @@
1
+ === MetricFu 2.1.3.6 / 2013-01-02
2
+
3
+ * Fixed bug that wasn't show stats or rails_best_practices graphs
4
+ * Updated churn and rails_best_practices gems
5
+ * Move the metrics code in the rake task into its own file
6
+ * Remove executable metric_fu dependency on rake
7
+ * TODO: some unclear dependency issues may make metrics in 1.9 crash, esp Flog, Flay, Stats
8
+
9
+
1
10
  === MetricFu 2.1.3.5 / 2013-01-01
2
11
 
3
12
  * Issue #35, Namespace MetricFu::Table. -Benjamin Fleischer
data/README.md CHANGED
@@ -26,6 +26,11 @@ __Code Quality__
26
26
 
27
27
  This project runs [https://codeclimate.com/](https://codeclimate.com/)
28
28
 
29
+ __Gem Dependencies__
30
+
31
+ [![Dependency Status](https://gemnasium.com/metricfu/metric_fu.png)](https://gemnasium.com/metricfu/metric_fu)
32
+
33
+ This project runs [https://gemnasium.com/metricfu](https://gemnasium.com/metricfu)
29
34
 
30
35
  ===============================================================================
31
36
 
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env rake
2
+ require 'bundler/setup'
2
3
  require 'bundler/gem_tasks'
3
4
  # $LOAD_PATH << '.'
4
5
  begin
@@ -15,10 +16,4 @@ end
15
16
 
16
17
  require File.expand_path File.join(File.dirname(__FILE__),'lib/metric_fu')
17
18
 
18
- MetricFu::Configuration.run do |config|
19
- config.roodi = config.roodi.merge(:roodi_config => 'config/roodi_config.yml')
20
- config.churn = { :start_date => "1 year ago", :minimum_churn_count => 10}
21
- config.hotspots = { :start_date => "1 year ago", :minimum_churn_count => 10}
22
- end
23
-
24
19
  task :default => :spec
data/TODO.md ADDED
@@ -0,0 +1,42 @@
1
+ # TODO list
2
+
3
+
4
+ ## Features
5
+
6
+ * Look into removing rcov and churn, and adding
7
+ * https://github.com/metricfu/code_statistics
8
+ * brakeman https://github.com/metricfu/brakeman
9
+ * cane https://github.com/square/cane
10
+ * laser https://github.com/metricfu/laser
11
+ * Add configurable logger to all output streams
12
+ * Color code flog results with scale from: http://jakescruggs.blogspot.com/2008/08/whats-good-flog-score.html
13
+ * Make running metric_fu on metric_fu less embarrassing
14
+ * Load all gems at config time so you fail fast if one is missing
15
+
16
+ ## Testing
17
+
18
+ * Determine how to test metric_fu against codebases that are not metric_fu, to ensure it works on most applications
19
+ * Re-organize test files structure to align with changed structure of library files
20
+ * Remove / Modify Devver code from the generators/hotspots_spec and base/hotspot_analzyer_spec
21
+
22
+ ## Bugs / Fixes
23
+
24
+ * Fix occasional gem install metric_fu failures such as with ripper in Ruby 1.9
25
+ * Fork roodi and correct the yaml
26
+ * See https://github.com/metricfu/metric_fu/issues/2 about updating gems
27
+
28
+ ## Ruby 1.9 compatibility
29
+
30
+ * Consider `RUBYOPT='-rpsych'` e.g. from https://github.com/jscruggs/metric_fu/pull/77
31
+ * Look into using the sexp_processor for ruby parsing in brakeman https://github.com/presidentbeef/brakeman/blob/cdc85962d589fb37e37ed53333bb0b7bd913e028/lib/ruby_parser/bm_sexp_processor.rb
32
+
33
+ ## Misc
34
+
35
+ * Determine if CodeIssue is used, else remove it
36
+ * Update the homepage http://metric-fu.rubyforge.org/
37
+ * Other intersting libraries to consider:
38
+ * https://github.com/vinibaggio/discover-unused-partials
39
+ * https://github.com/metricfu/heckle
40
+ * https://github.com/metricfu/gauntlet
41
+ * https://github.com/metricfu/repodepot-ruby
42
+ * https://github.com/eladmeidar/rails_indexes
@@ -1,4 +1,2 @@
1
- gem 'rake', '<= 0.9.2'
2
- require 'rake'
3
1
  require File.expand_path(File.join(File.dirname(__FILE__),'..','lib','metric_fu'))
4
- Rake::Task['metrics:all'].invoke
2
+ MetricFu::Run.new.run
@@ -138,7 +138,7 @@ module MetricFu
138
138
  @reek = { :dirs_to_reek => @code_dirs,
139
139
  :config_file_pattern => nil}
140
140
  @roodi = { :dirs_to_roodi => @code_dirs,
141
- :roodi_config => nil}
141
+ :roodi_config => nil }
142
142
  @saikuro = { :output_directory => "#{@scratch_directory}/saikuro",
143
143
  :input_directory => @code_dirs,
144
144
  :cyclo => "",
@@ -22,7 +22,7 @@ module MetricFu
22
22
  end
23
23
  rescue Exception => e
24
24
  #catch errors for files ruby_parser fails on
25
- puts "RUBY PARSE FAILURE: #{e.class}\t#{e.message}\tCONTENT:#{contents.inspect}\SEXP:#{file_sexp.inspect}\tn#{e.backtrace}"
25
+ puts "RUBY PARSE FAILURE: #{e.class}\t#{e.message}\tSEXP:#{file_sexp.inspect}\n\tCONTENT:#{contents.inspect}\n\t#{e.backtrace}"
26
26
  @locations
27
27
  end
28
28
 
@@ -3,18 +3,17 @@ MetricFu.reporting_require { 'report' }
3
3
  MetricFu.metrics_require { 'generator' }
4
4
  MetricFu.metrics_require { 'graph' }
5
5
  MetricFu.reporting_require { 'graphs/grapher' }
6
- MetricFu.lib_require { 'scoring_strategies' }
6
+ MetricFu.metrics_require { 'hotspots/analysis/scoring_strategies' }
7
7
 
8
+ # Now load everything else that's in the directory
9
+ Dir.glob(File.join(MetricFu.lib_dir, '*.rb')).each do |file|
10
+ require file
11
+ end
8
12
  # prevent the task from being run multiple times.
9
13
  unless Rake::Task.task_defined? "metrics:all"
10
14
  # Load the rakefile so users of the gem get the default metric_fu task
11
15
  MetricFu.tasks_load 'metric_fu.rake'
12
16
  end
13
-
14
- # Now load everything else that's in the directory
15
- Dir.glob(File.join(MetricFu.lib_dir, '*.rb')).each do |file|
16
- require file
17
- end
18
17
  Dir.glob(File.join(MetricFu.data_structures_dir, '**/*.rb')).each do |file|
19
18
  require file
20
19
  end
@@ -50,7 +50,7 @@ module MetricFu
50
50
  # @return String
51
51
  # A file path
52
52
  def template(section)
53
- if MetricFu::AVAILABLE_METRICS.include?(section) # expects a symbol
53
+ if MetricFu.metrics.include?(section) # expects a symbol
54
54
  File.join(template_dir(section.to_s), "#{section}.html.erb")
55
55
  else
56
56
  File.join(template_directory, section.to_s + ".html.erb")
@@ -1,6 +1,6 @@
1
1
  require 'delegate'
2
2
 
3
- [ 'hotspot_analyzer',
3
+ [ 'hotspots/hotspot_analyzer',
4
4
  'flog/flog_hotspot',
5
5
  'saikuro/saikuro_hotspot',
6
6
  'churn/churn_hotspot',
@@ -8,9 +8,10 @@ require 'delegate'
8
8
  'flay/flay_hotspot'].each do |path|
9
9
  MetricFu.metrics_require { path }
10
10
  end
11
- %w(careful_array record).each do |path|
11
+ %w(careful_array).each do |path|
12
12
  MetricFu.data_structures_require { path }
13
13
  end
14
+ MetricFu.metrics_require { "hotspots/analysis/record" }
14
15
 
15
16
  module MetricFu
16
17
  class CodeIssue < DelegateClass(MetricFu::Record) #DelegateClass(Ruport::Data::Record)
@@ -1,5 +1,5 @@
1
1
  %w(table).each do |path|
2
- MetricFu.data_structures_require { path }
2
+ MetricFu.metrics_require { "hotspots/analysis/#{path}" }
3
3
  end
4
4
  module MetricFu
5
5
  class Grouping
@@ -1,5 +1,5 @@
1
1
  %w(record code_issue).each do |path|
2
- MetricFu.data_structures_require { path }
2
+ MetricFu.metrics_require { "hotspots/analysis/#{path}" }
3
3
  end
4
4
 
5
5
  module MetricFu
@@ -1,5 +1,10 @@
1
- %w(record grouping).each do |path|
2
- MetricFu.data_structures_require { path }
1
+ require File.expand_path('analysis_error', MetricFu.errors_dir)
2
+ MetricFu.data_structures_require { 'location' }
3
+ %w(table record grouping ranking).each do |path|
4
+ MetricFu.metrics_require { "hotspots/analysis/#{path}" }
5
+ end
6
+ %w(reek roodi flog churn saikuro flay stats rcov).each do |path|
7
+ MetricFu.metrics_require { "#{path}/#{path}_hotspot" }
3
8
  end
4
9
 
5
10
  module MetricFu
@@ -1,3 +1,4 @@
1
+ MetricFu.metrics_require { 'hotspots/hotspot_analyzer' }
1
2
  module MetricFu
2
3
 
3
4
  class Hotspots < Generator
@@ -1,8 +1,8 @@
1
1
  module MetricFu
2
2
  class RailsBestPractices < Generator
3
-
3
+ VERSION = '0.10.1'
4
4
  def emit
5
- @output = `rails_best_practices --without-color .`
5
+ @output = `rails_best_practices _#{VERSION}_ --without-color .`
6
6
  end
7
7
 
8
8
  def analyze
@@ -5,7 +5,7 @@ module MetricFu
5
5
  files_to_analyze = MetricFu.roodi[:dirs_to_roodi].map{|dir| Dir[File.join(dir, "**/*.rb")] }
6
6
  files = remove_excluded_files(files_to_analyze.flatten)
7
7
  config = MetricFu.roodi[:roodi_config] ? "-config=#{MetricFu.roodi[:roodi_config]}" : ""
8
- @output = `roodi #{config} #{files.join(" ")}`
8
+ @output = `metric_fu-roodi #{config} #{files.join(" ")}`
9
9
  end
10
10
 
11
11
  def analyze
@@ -0,0 +1,54 @@
1
+ MetricFu::Configuration.run do |config|
2
+ config.roodi = config.roodi.merge(:roodi_config => "#{MetricFu.root_dir}/config/roodi_config.yml")
3
+ config.churn = { :start_date => "1 year ago", :minimum_churn_count => 10}
4
+ config.hotspots = { :start_date => "1 year ago", :minimum_churn_count => 10}
5
+ end
6
+ module MetricFu
7
+ class Run
8
+ def initialize
9
+ STDOUT.sync = true
10
+ MetricFu::Configuration.run {}
11
+ end
12
+ def run
13
+ add_metrics
14
+ save_reports
15
+ save_graphs
16
+ display_results
17
+ end
18
+ def add_metrics
19
+ MetricFu.metrics.each {|metric|
20
+ mf_debug "** STARTING METRIC #{metric}"
21
+ MetricFu.report.add(metric)
22
+ mf_debug "** ENDING METRIC #{metric}"
23
+ }
24
+ end
25
+ def save_reports
26
+ mf_debug "** SAVING REPORT YAML OUTPUT TO #{MetricFu.base_directory}"
27
+ MetricFu.report.save_output(MetricFu.report.to_yaml,
28
+ MetricFu.base_directory,
29
+ "report.yml")
30
+ mf_debug "** SAVING REPORT DATA OUTPUT TO #{MetricFu.data_directory}"
31
+ MetricFu.report.save_output(MetricFu.report.to_yaml,
32
+ MetricFu.data_directory,
33
+ "#{Time.now.strftime("%Y%m%d")}.yml")
34
+ mf_debug "** SAVING TEMPLATIZED REPORT"
35
+ MetricFu.report.save_templatized_report
36
+ end
37
+ def save_graphs
38
+ mf_debug "** PREPARING TO GRAPH"
39
+ MetricFu.graphs.each {|graph|
40
+ mf_debug "** Graphing #{graph} with #{MetricFu.graph_engine}"
41
+ MetricFu.graph.add(graph, MetricFu.graph_engine)
42
+ }
43
+ mf_debug "** GENERATING GRAPH"
44
+ MetricFu.graph.generate
45
+ end
46
+ def display_results
47
+ if MetricFu.report.open_in_browser?
48
+ mf_debug "** OPENING IN BROWSER FROM #{MetricFu.output_directory}"
49
+ MetricFu.report.show_in_browser(MetricFu.output_directory)
50
+ end
51
+ end
52
+ end
53
+ end
54
+
@@ -2,35 +2,6 @@ require 'rake'
2
2
  namespace :metrics do
3
3
  desc "Generate all metrics reports"
4
4
  task :all do
5
- STDOUT.sync = true
6
- MetricFu::Configuration.run {}
7
- MetricFu.metrics.each {|metric|
8
- mf_debug "** STARTING METRIC #{metric}"
9
- MetricFu.report.add(metric)
10
- mf_debug "** ENDING METRIC #{metric}"
11
- }
12
- mf_debug "** SAVING REPORT YAML OUTPUT TO #{MetricFu.base_directory}"
13
- MetricFu.report.save_output(MetricFu.report.to_yaml,
14
- MetricFu.base_directory,
15
- "report.yml")
16
- mf_debug "** SAVING REPORT DATA OUTPUT TO #{MetricFu.data_directory}"
17
- MetricFu.report.save_output(MetricFu.report.to_yaml,
18
- MetricFu.data_directory,
19
- "#{Time.now.strftime("%Y%m%d")}.yml")
20
- mf_debug "** SAVING TEMPLATIZED REPORT"
21
- MetricFu.report.save_templatized_report
22
-
23
- mf_debug "** PREPARING TO GRAPH"
24
- MetricFu.graphs.each {|graph|
25
- mf_debug "** Graphing #{graph} with #{MetricFu.graph_engine}"
26
- MetricFu.graph.add(graph, MetricFu.graph_engine)
27
- }
28
- mf_debug "** GENERATING GRAPH"
29
- MetricFu.graph.generate
30
-
31
- if MetricFu.report.open_in_browser?
32
- mf_debug "** OPENING IN BROWSER FROM #{MetricFu.output_directory}"
33
- MetricFu.report.show_in_browser(MetricFu.output_directory)
34
- end
5
+ MetricFu::Run.new.run
35
6
  end
36
7
  end
@@ -1,3 +1,3 @@
1
1
  module MetricFu
2
- VERSION = "2.1.3.5"
2
+ VERSION = "2.1.3.6"
3
3
  end
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "http://github.com/metricfu/metric_fu"
11
11
  s.description = "Code metrics from Flog, Flay, Simplecov-RCov, Saikuro, Churn, Reek, Roodi, Rails' stats task and Rails Best Practices"
12
12
  s.authors = ["Jake Scruggs", "Sean Soper", "Andre Arko", "Petrik de Heus", "Grant McInnes", "Nick Quaranto", "Édouard Brière", "Carl Youngblood", "Richard Huang", "Dan Mayer", "Benjamin Fleischer"]
13
+ s.rubyforge_project = 'metric_fu'
13
14
  s.required_ruby_version = ">= 1.8.7"
14
15
  s.required_rubygems_version = ">= 1.3.6"
15
16
  s.files = `git ls-files`.split($\)
@@ -22,12 +23,11 @@ Gem::Specification.new do |s|
22
23
  "flay" => ["= 1.2.1"],
23
24
  "flog" => ["= 2.3.0"],
24
25
  "reek" => ["= 1.2.12"],
25
- "roodi" => ["= 2.1.0"],
26
- "rails_best_practices" => ["~> 0.6"],
27
- "churn" => ["= 0.0.7"],
28
- "sexp_processor" => ["~> 3.0.3"], # required because of churn.
29
- "chronic" => ["= 0.2.3"], # required by churn
30
- "main" => ["= 4.7.1"], # required by churn
26
+ "metric_fu-roodi" => [">= 2.2.0"],
27
+ "rails_best_practices" => ["~> 0.10.1"],
28
+ "churn" => ["= 0.0.25"],
29
+ "sexp_processor" => ["~> 3.0.3"], # required because of churn, flog, reek 1.2.12, ripper_ruby_parser 0.0.8
30
+ # "ruby_parser" => ["~> 2.3"], # required because of churn, flog, reek 1.2.12, ripper_ruby_parser 0.0.8
31
31
  "activesupport" => [">= 2.0.0"], # ok
32
32
  # "syntax" => ["= 1.0.0"],
33
33
  "coderay" => [],
@@ -57,9 +57,5 @@ Gem::Specification.new do |s|
57
57
  end
58
58
 
59
59
 
60
- s.add_development_dependency("rake", '<=0.9.2')
61
- s.add_development_dependency("rspec", ["= 1.3.0"])
62
- s.add_development_dependency("test-construct", [">= 1.2.0"])
63
- s.add_development_dependency("googlecharts")
64
60
  end
65
61
 
@@ -56,7 +56,7 @@ describe MetricFu::Template do
56
56
  describe "#template" do
57
57
  it 'should generate the filename of the template file' do
58
58
  section = mock('section')
59
- section.should_receive(:to_s).and_return('section')
59
+ section.should_receive(:to_s).any_number_of_times.and_return('section')
60
60
  @template.should_receive(:template_directory).and_return('dir')
61
61
  result = @template.send(:template, section)
62
62
  result.should == "dir/section.html.erb"
@@ -5,7 +5,7 @@ describe RailsBestPractices do
5
5
  it "should gather the raw data" do
6
6
  MetricFu::Configuration.run {}
7
7
  practices = MetricFu::RailsBestPractices.new
8
- practices.should_receive(:`).with("rails_best_practices --without-color .")
8
+ practices.should_receive(:`).with("rails_best_practices _#{MetricFu::RailsBestPractices::VERSION}_ --without-color .")
9
9
  practices.emit
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metric_fu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 97
4
+ hash: 103
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
9
  - 3
10
- - 5
11
- version: 2.1.3.5
10
+ - 6
11
+ version: 2.1.3.6
12
12
  platform: ruby
13
13
  authors:
14
14
  - Jake Scruggs
@@ -29,117 +29,114 @@ cert_chain: []
29
29
  date: 2013-01-02 00:00:00 Z
30
30
  dependencies:
31
31
  - !ruby/object:Gem::Dependency
32
- name: bluff
33
- prerelease: false
34
32
  requirement: &id001 !ruby/object:Gem::Requirement
35
33
  none: false
36
34
  requirements:
37
- - - ">="
35
+ - - "="
38
36
  - !ruby/object:Gem::Version
39
- hash: 3
37
+ hash: 45
40
38
  segments:
41
39
  - 0
42
- version: "0"
43
- type: :runtime
40
+ - 0
41
+ - 25
42
+ version: 0.0.25
43
+ prerelease: false
44
+ name: churn
44
45
  version_requirements: *id001
46
+ type: :runtime
45
47
  - !ruby/object:Gem::Dependency
46
- name: map
47
- prerelease: false
48
48
  requirement: &id002 !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - "="
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
- hash: 39
53
+ hash: 3
54
54
  segments:
55
- - 6
56
- - 2
57
55
  - 0
58
- version: 6.2.0
59
- type: :runtime
56
+ version: "0"
57
+ prerelease: false
58
+ name: bluff
60
59
  version_requirements: *id002
60
+ type: :runtime
61
61
  - !ruby/object:Gem::Dependency
62
- name: activesupport
63
- prerelease: false
64
62
  requirement: &id003 !ruby/object:Gem::Requirement
65
63
  none: false
66
64
  requirements:
67
- - - ">="
65
+ - - "="
68
66
  - !ruby/object:Gem::Version
69
- hash: 15
67
+ hash: 5
70
68
  segments:
71
69
  - 2
72
- - 0
73
- - 0
74
- version: 2.0.0
75
- type: :runtime
70
+ - 2
71
+ - 1
72
+ version: 2.2.1
73
+ prerelease: false
74
+ name: fattr
76
75
  version_requirements: *id003
76
+ type: :runtime
77
77
  - !ruby/object:Gem::Dependency
78
- name: main
79
- prerelease: false
80
78
  requirement: &id004 !ruby/object:Gem::Requirement
81
79
  none: false
82
80
  requirements:
83
81
  - - "="
84
82
  - !ruby/object:Gem::Version
85
- hash: 33
83
+ hash: 39
86
84
  segments:
87
- - 4
88
- - 7
89
- - 1
90
- version: 4.7.1
91
- type: :runtime
85
+ - 6
86
+ - 2
87
+ - 0
88
+ version: 6.2.0
89
+ prerelease: false
90
+ name: map
92
91
  version_requirements: *id004
92
+ type: :runtime
93
93
  - !ruby/object:Gem::Dependency
94
- name: churn
95
- prerelease: false
96
94
  requirement: &id005 !ruby/object:Gem::Requirement
97
95
  none: false
98
96
  requirements:
99
- - - "="
97
+ - - ">="
100
98
  - !ruby/object:Gem::Version
101
- hash: 17
99
+ hash: 3
102
100
  segments:
103
101
  - 0
104
- - 0
105
- - 7
106
- version: 0.0.7
107
- type: :runtime
102
+ version: "0"
103
+ prerelease: false
104
+ name: googlecharts
108
105
  version_requirements: *id005
106
+ type: :runtime
109
107
  - !ruby/object:Gem::Dependency
110
- name: rails_best_practices
111
- prerelease: false
112
108
  requirement: &id006 !ruby/object:Gem::Requirement
113
109
  none: false
114
110
  requirements:
115
- - - ~>
111
+ - - "="
116
112
  - !ruby/object:Gem::Version
117
- hash: 7
113
+ hash: 43
118
114
  segments:
119
- - 0
120
- - 6
121
- version: "0.6"
122
- type: :runtime
115
+ - 4
116
+ - 7
117
+ - 4
118
+ version: 4.7.4
119
+ prerelease: false
120
+ name: arrayfields
123
121
  version_requirements: *id006
122
+ type: :runtime
124
123
  - !ruby/object:Gem::Dependency
125
- name: roodi
126
- prerelease: false
127
124
  requirement: &id007 !ruby/object:Gem::Requirement
128
125
  none: false
129
126
  requirements:
130
127
  - - "="
131
128
  - !ruby/object:Gem::Version
132
- hash: 11
129
+ hash: 7
133
130
  segments:
134
- - 2
135
131
  - 1
136
- - 0
137
- version: 2.1.0
138
- type: :runtime
132
+ - 2
133
+ - 12
134
+ version: 1.2.12
135
+ prerelease: false
136
+ name: reek
139
137
  version_requirements: *id007
138
+ type: :runtime
140
139
  - !ruby/object:Gem::Dependency
141
- name: googlecharts
142
- prerelease: false
143
140
  requirement: &id008 !ruby/object:Gem::Requirement
144
141
  none: false
145
142
  requirements:
@@ -149,138 +146,108 @@ dependencies:
149
146
  segments:
150
147
  - 0
151
148
  version: "0"
152
- type: :runtime
149
+ prerelease: false
150
+ name: coderay
153
151
  version_requirements: *id008
152
+ type: :runtime
154
153
  - !ruby/object:Gem::Dependency
155
- name: chronic
156
- prerelease: false
157
154
  requirement: &id009 !ruby/object:Gem::Requirement
158
155
  none: false
159
156
  requirements:
160
- - - "="
157
+ - - ">="
161
158
  - !ruby/object:Gem::Version
162
- hash: 17
159
+ hash: 15
163
160
  segments:
164
- - 0
165
161
  - 2
166
- - 3
167
- version: 0.2.3
168
- type: :runtime
162
+ - 0
163
+ - 0
164
+ version: 2.0.0
165
+ prerelease: false
166
+ name: activesupport
169
167
  version_requirements: *id009
168
+ type: :runtime
170
169
  - !ruby/object:Gem::Dependency
171
- name: flay
172
- prerelease: false
173
170
  requirement: &id010 !ruby/object:Gem::Requirement
174
171
  none: false
175
172
  requirements:
176
- - - "="
173
+ - - ~>
177
174
  - !ruby/object:Gem::Version
178
- hash: 29
175
+ hash: 1
179
176
  segments:
180
- - 1
181
- - 2
182
- - 1
183
- version: 1.2.1
184
- type: :runtime
177
+ - 3
178
+ - 0
179
+ - 3
180
+ version: 3.0.3
181
+ prerelease: false
182
+ name: sexp_processor
185
183
  version_requirements: *id010
184
+ type: :runtime
186
185
  - !ruby/object:Gem::Dependency
187
- name: fattr
188
- prerelease: false
189
186
  requirement: &id011 !ruby/object:Gem::Requirement
190
187
  none: false
191
188
  requirements:
192
- - - "="
189
+ - - ~>
193
190
  - !ruby/object:Gem::Version
194
- hash: 5
191
+ hash: 53
195
192
  segments:
196
- - 2
197
- - 2
193
+ - 0
194
+ - 10
198
195
  - 1
199
- version: 2.2.1
200
- type: :runtime
196
+ version: 0.10.1
197
+ prerelease: false
198
+ name: rails_best_practices
201
199
  version_requirements: *id011
200
+ type: :runtime
202
201
  - !ruby/object:Gem::Dependency
203
- name: flog
204
- prerelease: false
205
202
  requirement: &id012 !ruby/object:Gem::Requirement
206
203
  none: false
207
204
  requirements:
208
- - - "="
205
+ - - ">="
209
206
  - !ruby/object:Gem::Version
210
- hash: 3
207
+ hash: 7
211
208
  segments:
212
209
  - 2
213
- - 3
210
+ - 2
214
211
  - 0
215
- version: 2.3.0
216
- type: :runtime
212
+ version: 2.2.0
213
+ prerelease: false
214
+ name: metric_fu-roodi
217
215
  version_requirements: *id012
216
+ type: :runtime
218
217
  - !ruby/object:Gem::Dependency
219
- name: arrayfields
220
- prerelease: false
221
218
  requirement: &id013 !ruby/object:Gem::Requirement
222
219
  none: false
223
220
  requirements:
224
221
  - - "="
225
- - !ruby/object:Gem::Version
226
- hash: 43
227
- segments:
228
- - 4
229
- - 7
230
- - 4
231
- version: 4.7.4
232
- type: :runtime
233
- version_requirements: *id013
234
- - !ruby/object:Gem::Dependency
235
- name: coderay
236
- prerelease: false
237
- requirement: &id014 !ruby/object:Gem::Requirement
238
- none: false
239
- requirements:
240
- - - ">="
241
222
  - !ruby/object:Gem::Version
242
223
  hash: 3
243
224
  segments:
244
- - 0
245
- version: "0"
246
- type: :runtime
247
- version_requirements: *id014
248
- - !ruby/object:Gem::Dependency
249
- name: sexp_processor
250
- prerelease: false
251
- requirement: &id015 !ruby/object:Gem::Requirement
252
- none: false
253
- requirements:
254
- - - ~>
255
- - !ruby/object:Gem::Version
256
- hash: 1
257
- segments:
225
+ - 2
258
226
  - 3
259
227
  - 0
260
- - 3
261
- version: 3.0.3
228
+ version: 2.3.0
229
+ prerelease: false
230
+ name: flog
231
+ version_requirements: *id013
262
232
  type: :runtime
263
- version_requirements: *id015
264
233
  - !ruby/object:Gem::Dependency
265
- name: reek
266
- prerelease: false
267
- requirement: &id016 !ruby/object:Gem::Requirement
234
+ requirement: &id014 !ruby/object:Gem::Requirement
268
235
  none: false
269
236
  requirements:
270
237
  - - "="
271
238
  - !ruby/object:Gem::Version
272
- hash: 7
239
+ hash: 29
273
240
  segments:
274
241
  - 1
275
242
  - 2
276
- - 12
277
- version: 1.2.12
243
+ - 1
244
+ version: 1.2.1
245
+ prerelease: false
246
+ name: flay
247
+ version_requirements: *id014
278
248
  type: :runtime
279
- version_requirements: *id016
280
249
  - !ruby/object:Gem::Dependency
281
- name: ripper
282
- prerelease: false
283
- requirement: &id017 !ruby/object:Gem::Requirement
250
+ requirement: &id015 !ruby/object:Gem::Requirement
284
251
  none: false
285
252
  requirements:
286
253
  - - "="
@@ -291,12 +258,12 @@ dependencies:
291
258
  - 0
292
259
  - 5
293
260
  version: 1.0.5
261
+ prerelease: false
262
+ name: ripper
263
+ version_requirements: *id015
294
264
  type: :runtime
295
- version_requirements: *id017
296
265
  - !ruby/object:Gem::Dependency
297
- name: rcov
298
- prerelease: false
299
- requirement: &id018 !ruby/object:Gem::Requirement
266
+ requirement: &id016 !ruby/object:Gem::Requirement
300
267
  none: false
301
268
  requirements:
302
269
  - - ~>
@@ -306,12 +273,12 @@ dependencies:
306
273
  - 0
307
274
  - 8
308
275
  version: "0.8"
276
+ prerelease: false
277
+ name: rcov
278
+ version_requirements: *id016
309
279
  type: :runtime
310
- version_requirements: *id018
311
280
  - !ruby/object:Gem::Dependency
312
- name: Saikuro
313
- prerelease: false
314
- requirement: &id019 !ruby/object:Gem::Requirement
281
+ requirement: &id017 !ruby/object:Gem::Requirement
315
282
  none: false
316
283
  requirements:
317
284
  - - "="
@@ -322,70 +289,10 @@ dependencies:
322
289
  - 1
323
290
  - 0
324
291
  version: 1.1.0
325
- type: :runtime
326
- version_requirements: *id019
327
- - !ruby/object:Gem::Dependency
328
- name: rake
329
- prerelease: false
330
- requirement: &id020 !ruby/object:Gem::Requirement
331
- none: false
332
- requirements:
333
- - - <=
334
- - !ruby/object:Gem::Version
335
- hash: 63
336
- segments:
337
- - 0
338
- - 9
339
- - 2
340
- version: 0.9.2
341
- type: :development
342
- version_requirements: *id020
343
- - !ruby/object:Gem::Dependency
344
- name: rspec
345
292
  prerelease: false
346
- requirement: &id021 !ruby/object:Gem::Requirement
347
- none: false
348
- requirements:
349
- - - "="
350
- - !ruby/object:Gem::Version
351
- hash: 27
352
- segments:
353
- - 1
354
- - 3
355
- - 0
356
- version: 1.3.0
357
- type: :development
358
- version_requirements: *id021
359
- - !ruby/object:Gem::Dependency
360
- name: test-construct
361
- prerelease: false
362
- requirement: &id022 !ruby/object:Gem::Requirement
363
- none: false
364
- requirements:
365
- - - ">="
366
- - !ruby/object:Gem::Version
367
- hash: 31
368
- segments:
369
- - 1
370
- - 2
371
- - 0
372
- version: 1.2.0
373
- type: :development
374
- version_requirements: *id022
375
- - !ruby/object:Gem::Dependency
376
- name: googlecharts
377
- prerelease: false
378
- requirement: &id023 !ruby/object:Gem::Requirement
379
- none: false
380
- requirements:
381
- - - ">="
382
- - !ruby/object:Gem::Version
383
- hash: 3
384
- segments:
385
- - 0
386
- version: "0"
387
- type: :development
388
- version_requirements: *id023
293
+ name: Saikuro
294
+ version_requirements: *id017
295
+ type: :runtime
389
296
  description: Code metrics from Flog, Flay, Simplecov-RCov, Saikuro, Churn, Reek, Roodi, Rails' stats task and Rails Best Practices
390
297
  email: github@benjaminfleischer.com
391
298
  executables:
@@ -403,7 +310,7 @@ files:
403
310
  - Manifest.txt
404
311
  - README.md
405
312
  - Rakefile
406
- - TODO
313
+ - TODO.md
407
314
  - bin/metric_fu
408
315
  - config/roodi_config.yml
409
316
  - home_page/back_all.jpg
@@ -425,18 +332,12 @@ files:
425
332
  - home_page/title_back.gif
426
333
  - lib/configuration.rb
427
334
  - lib/data_structures/careful_array.rb
428
- - lib/data_structures/code_issue.rb
429
- - lib/data_structures/grouping.rb
430
335
  - lib/data_structures/line_numbers.rb
431
336
  - lib/data_structures/location.rb
432
- - lib/data_structures/ranking.rb
433
- - lib/data_structures/record.rb
434
- - lib/data_structures/table.rb
435
337
  - lib/errors/analysis_error.rb
436
338
  - lib/initial_requires.rb
437
339
  - lib/load_files.rb
438
340
  - lib/logging/mf_debugger.rb
439
- - lib/md5_tracker.rb
440
341
  - lib/metric_fu.rb
441
342
  - lib/metrics/base_template.rb
442
343
  - lib/metrics/churn/churn.rb
@@ -455,7 +356,13 @@ files:
455
356
  - lib/metrics/flog/template_standard/flog.html.erb
456
357
  - lib/metrics/generator.rb
457
358
  - lib/metrics/graph.rb
458
- - lib/metrics/hotspot_analyzer.rb
359
+ - lib/metrics/hotspots/analysis/code_issue.rb
360
+ - lib/metrics/hotspots/analysis/grouping.rb
361
+ - lib/metrics/hotspots/analysis/ranking.rb
362
+ - lib/metrics/hotspots/analysis/record.rb
363
+ - lib/metrics/hotspots/analysis/scoring_strategies.rb
364
+ - lib/metrics/hotspots/analysis/table.rb
365
+ - lib/metrics/hotspots/hotspot_analyzer.rb
459
366
  - lib/metrics/hotspots/hotspots.rb
460
367
  - lib/metrics/hotspots/template_awesome/hotspots.html.erb
461
368
  - lib/metrics/hotspots/template_standard/hotspots.html.erb
@@ -505,7 +412,7 @@ files:
505
412
  - lib/reporting/templates/standard/default.css
506
413
  - lib/reporting/templates/standard/index.html.erb
507
414
  - lib/reporting/templates/standard/standard_template.rb
508
- - lib/scoring_strategies.rb
415
+ - lib/run.rb
509
416
  - lib/tasks/metric_fu.rake
510
417
  - lib/version.rb
511
418
  - metric_fu.gemspec
@@ -516,7 +423,6 @@ files:
516
423
  - spec/base/hotspot_analyzer_spec.rb
517
424
  - spec/base/line_numbers_spec.rb
518
425
  - spec/base/location_spec.rb
519
- - spec/base/md5_tracker_spec.rb
520
426
  - spec/base/ranking_spec.rb
521
427
  - spec/base/report_spec.rb
522
428
  - spec/base/table_spec.rb
@@ -583,7 +489,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
583
489
  version: 1.3.6
584
490
  requirements: []
585
491
 
586
- rubyforge_project:
492
+ rubyforge_project: metric_fu
587
493
  rubygems_version: 1.8.24
588
494
  signing_key:
589
495
  specification_version: 3
@@ -596,7 +502,6 @@ test_files:
596
502
  - spec/base/hotspot_analyzer_spec.rb
597
503
  - spec/base/line_numbers_spec.rb
598
504
  - spec/base/location_spec.rb
599
- - spec/base/md5_tracker_spec.rb
600
505
  - spec/base/ranking_spec.rb
601
506
  - spec/base/report_spec.rb
602
507
  - spec/base/table_spec.rb
data/TODO DELETED
@@ -1,9 +0,0 @@
1
- == TODO list
2
-
3
- * Determine how to test metric_fu against codebases that are not metric_fu, to ensure it works on most applications
4
- * Add configurable logger to all output streams
5
- * Color code flog results with scale from: http://jakescruggs.blogspot.com/2008/08/whats-good-flog-score.html
6
- * Make running metric_fu on metric_fu less embarrassing
7
- * Load all gems at config time so you fail fast if one is missing
8
- * Look into removing rcov and churn, and adding laser, brakeman, and/or cane
9
-
@@ -1,52 +0,0 @@
1
- require 'digest/md5'
2
- require 'fileutils'
3
-
4
- module MetricFu
5
- class MD5Tracker
6
-
7
- @@unchanged_md5s = []
8
-
9
- class << self
10
- def md5_dir(path_to_file, base_dir)
11
- File.join(base_dir,
12
- path_to_file.split('/')[0..-2].join('/'))
13
- end
14
-
15
- def md5_file(path_to_file, base_dir)
16
- File.join(md5_dir(path_to_file, base_dir),
17
- path_to_file.split('/').last.sub(/\.[a-z]+/, '.md5'))
18
- end
19
-
20
- def track(path_to_file, base_dir)
21
- md5 = Digest::MD5.hexdigest(File.read(path_to_file))
22
- FileUtils.mkdir_p(md5_dir(path_to_file, base_dir), :verbose => false)
23
- f = File.new(md5_file(path_to_file, base_dir), "w")
24
- f.puts(md5)
25
- f.close
26
- md5
27
- end
28
-
29
- def file_changed?(path_to_file, base_dir)
30
- orig_md5_file = md5_file(path_to_file, base_dir)
31
- return !!track(path_to_file, base_dir) unless File.exist?(orig_md5_file)
32
-
33
- current_md5 = ""
34
- file = File.open(orig_md5_file, 'r')
35
- file.each_line { |line| current_md5 << line }
36
- file.close
37
- current_md5.chomp!
38
-
39
- new_md5 = Digest::MD5.hexdigest(File.read(path_to_file))
40
- new_md5.chomp!
41
-
42
- @@unchanged_md5s << path_to_file if new_md5 == current_md5
43
-
44
- return new_md5 != current_md5
45
- end
46
-
47
- def file_already_counted?(path_to_file)
48
- return @@unchanged_md5s.include?(path_to_file)
49
- end
50
- end
51
- end
52
- end
@@ -1,57 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
-
3
- describe MetricFu::MD5Tracker do
4
- before do
5
- @tmp_dir = File.join(File.dirname(__FILE__), 'tmp')
6
- FileUtils.mkdir_p(@tmp_dir, :verbose => false) unless File.directory?(@tmp_dir)
7
- @file1 = File.new(File.join(@tmp_dir, 'file1.txt'), 'w')
8
- @file2 = File.new(File.join(@tmp_dir, 'file2.txt'), 'w')
9
- end
10
-
11
- after do
12
- FileUtils.rm_rf(@tmp_dir, :verbose => false)
13
- end
14
-
15
- it "identical files should match" do
16
- @file1.puts("Hello World")
17
- @file1.close
18
- file1_md5 = MD5Tracker.track(@file1.path, @tmp_dir)
19
-
20
- @file2.puts("Hello World")
21
- @file2.close
22
- file2_md5 = MD5Tracker.track(@file2.path, @tmp_dir)
23
-
24
- file2_md5.should == file1_md5
25
- end
26
-
27
- it "different files should not match" do
28
- @file1.puts("Hello World")
29
- @file1.close
30
- file1_md5 = MD5Tracker.track(@file1.path, @tmp_dir)
31
-
32
- @file2.puts("Goodbye World")
33
- @file2.close
34
- file2_md5 = MD5Tracker.track(@file2.path, @tmp_dir)
35
-
36
- file2_md5.should_not == file1_md5
37
- end
38
-
39
- it "file_changed? should detect a change" do
40
- @file2.close
41
-
42
- @file1.puts("Hello World")
43
- @file1.close
44
- file1_md5 = MD5Tracker.track(@file1.path, @tmp_dir)
45
-
46
- @file1 = File.new(File.join(@tmp_dir, 'file1.txt'), 'w')
47
- @file1.puts("Goodbye World")
48
- @file1.close
49
- MD5Tracker.file_changed?(@file1.path, @tmp_dir).should be_true
50
- end
51
-
52
- it "should detect a new file" do
53
- @file2.close
54
- MD5Tracker.file_changed?(@file1.path, @tmp_dir).should be_true
55
- File.exist?(MD5Tracker.md5_file(@file1.path, @tmp_dir)).should be_true
56
- end
57
- end