Skip to content

Commit

Permalink
Delete trailing whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
delwyn committed Nov 12, 2010
1 parent b515d8f commit bdd3a40
Show file tree
Hide file tree
Showing 87 changed files with 840 additions and 841 deletions.
10 changes: 5 additions & 5 deletions HISTORY
Expand Up @@ -3,16 +3,16 @@
* Hotspots - Dan Mayer, Ben Brinckerhoff, Jake Scruggs
* Rcov integration with Hotspots - Jake Scruggs, Tony Castiglione, Rob Meyer

=== MetricFu 1.5.1 / 2010-7-28
=== MetricFu 1.5.1 / 2010-7-28

* Patch that allows graphers to skip dates that didn't generate metrics for that graph (GitHub Issue #20). - Chris Griego
* Fixed bug where if you try and use the gchart grapher with the rails_best_practices metric, it blows up (GitHub Issue #23). - Chris Griego
* Fixed 'If coverage is 0% metric_fu will explode' bug (GitHub Issue #6). - Stew Welbourne

=== MetricFu 1.5.0 / 2010-7-27

* Fixed bug where Flay results were not being reported. Had to remove the ability to remove selected files from flay processing (undocumented feature that may go away soon if it keeps causing problems).
* Rewrote Flog parsing/processing to use Flog programmatically. Note: the yaml output for Flog has changed significantly - Pages have now become MethodContainers. This probably doesn't matter to you if you are not consuming the metric_fu yaml output.
* Fixed bug where Flay results were not being reported. Had to remove the ability to remove selected files from flay processing (undocumented feature that may go away soon if it keeps causing problems).
* Rewrote Flog parsing/processing to use Flog programmatically. Note: the yaml output for Flog has changed significantly - Pages have now become MethodContainers. This probably doesn't matter to you if you are not consuming the metric_fu yaml output.
* Added support for using config files in Reek and Roodi (roodi support was already there but undocumented).
* Removed verify_dependencies! as it caused too much confusion to justify the limited set of problems it solved. In the post Bundler world it just didn't seem necessary to limit metric_fu dependencies.
* Deal with Rails 3 activesupport vs active_support problems. - jinzhu
Expand Down Expand Up @@ -159,7 +159,7 @@

=== MetricFu 0.7.0 / 2008-09-11

* Merged in Sean Soper's changes to metric_fu.
* Merged in Sean Soper's changes to metric_fu.
* Metric_fu is now a gem.
* Flogging now uses a MD5 hash to figure out if it should re-flog a file (if it's changed)
* Flogging also has a cool new output screen(s)
Expand Down Expand Up @@ -194,7 +194,7 @@
=== Metricks 0.1.0 / 2008-06-10

* Initial integration of metric_fu and my enhancements to flog
* Metrics are generated but are all over the place
* Metrics are generated but are all over the place

=== MetricFu 0.6.0 / 2008-05-11

Expand Down
4 changes: 2 additions & 2 deletions README
Expand Up @@ -11,9 +11,9 @@ How to contribute:
7. Make sure two important rake tests still run ('rake' and 'rake metrics:all')
8. Commit and send me a pull request with details as to what has been changed.

Extra Credit:
Extra Credit:
1. Make sure your changes work in 1.8.7, Ruby Enterprise Edition, and 1.9.1 (Hint use 'rvm' to help install multiple rubies)
2. Post to the Google group explaining what you did and why you did it (I don't merge things in immediately so others might want to use what you've done).
2. Post to the Google group explaining what you did and why you did it (I don't merge things in immediately so others might want to use what you've done).
3. Update the documentation (web page inside the 'home_page' folder)
4. Update the History and give yourself credit.

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -3,7 +3,7 @@ require 'rake'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'lib/metric_fu'

desc "Run all specs in spec directory"
Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
Expand Down
2 changes: 1 addition & 1 deletion TODO
@@ -1,4 +1,4 @@
== TODO list

* Color code flog results with scale from: http://jakescruggs.blogspot.com/2008/08/whats-good-flog-score.html
* Make running metric_fu on metric_fu less embarrassing
* Make running metric_fu on metric_fu less embarrassing
Binary file modified home_page/reek.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified home_page/roodi.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified home_page/stats.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 16 additions & 16 deletions lib/base/base_template.rb
Expand Up @@ -9,12 +9,12 @@ module MetricFu
# example.
class Template
attr_accessor :report

private
# Creates a new erb evaluated result from the passed in section.
#
# @param section String
# The section name of
# The section name of
#
# @return String
# The erb evaluated string
Expand All @@ -35,10 +35,10 @@ def erbify(section)
def template_exists?(section)
File.exist?(template(section))
end

# Copies an instance variable mimicing the name of the section
# we are trying to render, with a value equal to the passed in
# constant. Allows the concrete template classes to refer to
# we are trying to render, with a value equal to the passed in
# constant. Allows the concrete template classes to refer to
# that instance variable from their ERB rendering
#
# @param section String
Expand All @@ -48,10 +48,10 @@ def template_exists?(section)
# The value to set as the value of the created instance
# variable
def create_instance_var(section, contents)
instance_variable_set("@#{section}", contents)
instance_variable_set("@#{section}", contents)
end

# Generates the filename of the template file to load and
# Generates the filename of the template file to load and
# evaluate. In this case, the path to the template directory +
# the section name + .html.erb
#
Expand All @@ -76,7 +76,7 @@ def output_filename(section)
section.to_s + ".html"
end

# Returns the contents of a given css file in order to
# Returns the contents of a given css file in order to
# render it inline into a template.
#
# @param css String
Expand All @@ -85,14 +85,14 @@ def output_filename(section)
# @return String
# The contents of the css file
def inline_css(css)
open(File.join(this_directory, css)) { |f| f.read }
open(File.join(this_directory, css)) { |f| f.read }
end

# Provides a link to open a file through the textmate protocol
# on Darwin, or otherwise, a simple file link.
#
# @param name String
#
#
# @param line Integer
# The line number to link to, if textmate is available. Defaults
# to nil
Expand All @@ -102,12 +102,12 @@ def inline_css(css)
def link_to_filename(name, line = nil, link_content = nil)
"<a href='#{file_url(name, line)}'>#{link_content(name, line, link_content)}</a>"
end

def round_to_tenths(decimal)
decimal = 0.0 if decimal.to_s.eql?('NaN')
(decimal * 10).round / 10.0
(decimal * 10).round / 10.0
end

def link_content(name, line=nil, link_content=nil) # :nodoc:
if link_content
link_content
Expand All @@ -133,13 +133,13 @@ def display_location(location, stat)
end
str
end

def file_url(name, line) # :nodoc:
return '' unless name
filename = File.expand_path(name.gsub(/^\//, ''))
if MetricFu.configuration.platform.include?('darwin')
"txmt://open/?url=file://#{filename}" << (line ? "&line=#{line}" : "")
else
else
"file://#{filename}"
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/base/churn_analyzer.rb
Expand Up @@ -6,7 +6,7 @@ class ChurnAnalyzer
def columns
COLUMNS
end

def name
:churn
end
Expand All @@ -23,7 +23,7 @@ def score(metric_ranking, item)
flat_churn_score = 0.50
metric_ranking.scored?(item) ? flat_churn_score : 0
end

def generate_records(data, table)
return if data==nil
Array(data[:changes]).each do |change|
Expand All @@ -35,7 +35,7 @@ def generate_records(data, table)
end
end

private
private

def self.update_changes(total, changed)
changed.each do |change|
Expand Down
16 changes: 8 additions & 8 deletions lib/base/code_issue.rb
Expand Up @@ -19,17 +19,17 @@ def carefully_remove(elements)
class CodeIssue < DelegateClass(Record) #DelegateClass(Ruport::Data::Record)
include Comparable

# TODO: Yuck! 'stat_value' is a column for StatAnalyzer
# TODO: Yuck! 'stat_value' is a column for StatAnalyzer
EXCLUDED_COLUMNS = FlogAnalyzer::COLUMNS + SaikuroAnalyzer::COLUMNS + ['stat_value'] + ChurnAnalyzer::COLUMNS + ReekAnalyzer.new.columns.extend(CarefulArray).carefully_remove(['reek__type_name', 'reek__comparable_message']) + FlayAnalyzer.new.columns.extend(CarefulArray).carefully_remove(['flay_matching_reason'])

def <=>(other)
spaceship_for_columns(self.attributes, other)
end

def ===(other)
self.hash_for(included_columns_hash, included_columns) == other.hash_for(included_columns_hash, included_columns)
end

def spaceship_for_columns(columns, other)
columns.each do |column|
equality = self[column].to_s <=> other[column].to_s
Expand All @@ -41,7 +41,7 @@ def spaceship_for_columns(columns, other)
def hash_for(column_hash, columns)
@hashes ||= {}
# fetch would be cleaner, but slower
if @hashes.has_key?(column_hash)
if @hashes.has_key?(column_hash)
@hashes[column_hash]
else
values = columns.map {|column| self[column]}
Expand All @@ -54,7 +54,7 @@ def hash_for(column_hash, columns)
def included_columns_hash
@included_columns_hash ||= included_columns.hash
end

def included_columns
@included_columns ||= self.attributes.extend(CarefulArray).carefully_remove(EXCLUDED_COLUMNS)
end
Expand All @@ -78,10 +78,10 @@ def modifies?(other)
self.reek__value != other.reek__value
when :flog
self.score != other.score
when :saikuro
when :saikuro
self.complexity != other.complexity
when :stats
self.stat_value != other.stat_value
self.stat_value != other.stat_value
when :churn
self.times_changed != other.times_changed
when :flay
Expand All @@ -93,5 +93,5 @@ def modifies?(other)
raise ArgumentError, "Invalid metric type #{self.metric}"
end
end

end
40 changes: 20 additions & 20 deletions lib/base/configuration.rb
Expand Up @@ -5,7 +5,7 @@ module MetricFu
# These are metrics which have been developed for the system. Of
# course, in order to use these metrics, their respective gems must
# be installed on the system.
AVAILABLE_METRICS = [:churn, :flog, :flay, :reek,
AVAILABLE_METRICS = [:churn, :flog, :flay, :reek,
:roodi, :saikuro, :rcov,
:hotspots]

Expand Down Expand Up @@ -36,7 +36,7 @@ def self.configuration
#
# == Customization for CruiseControl.rb
#
# The Configuration class checks for the presence of a
# The Configuration class checks for the presence of a
# 'CC_BUILD_ARTIFACTS' environment variable. If it's found
# it will change the default output directory from the default
# "tmp/metric_fu to the directory represented by 'CC_BUILD_ARTIFACTS'
Expand All @@ -45,7 +45,7 @@ def self.configuration
#
# The Configuration class checks for several deprecated constants
# that were previously used to configure MetricFu. These include
# CHURN_OPTIONS, DIRECTORIES_TO_FLOG, SAIKURO_OPTIONS,
# CHURN_OPTIONS, DIRECTORIES_TO_FLOG, SAIKURO_OPTIONS,
# and MetricFu::SAIKURO_OPTIONS.
#
# These have been replaced by config.churn, config.flog and
Expand All @@ -57,7 +57,7 @@ def initialize #:nodoc:#
add_attr_accessors_to_self
add_class_methods_to_metric_fu
end

# Searches through the instance variables of the class and
# creates a class method on the MetricFu module to read the value
# of the instance variable from the Configuration class.
Expand All @@ -72,9 +72,9 @@ def self.#{method_name}
MetricFu.module_eval(method)
end
end

# Searches through the instance variables of the class and creates
# an attribute accessor on this instance of the Configuration
# an attribute accessor on this instance of the Configuration
# class for each instance variable.
def add_attr_accessors_to_self
instance_variables.each do |name|
Expand All @@ -93,7 +93,7 @@ def add_attr_accessors_to_self
def self.run
yield MetricFu.configuration
end

# This does the real work of the Configuration class, by setting
# up a bunch of instance variables to represent the configuration
# of the MetricFu app.
Expand All @@ -102,23 +102,23 @@ def reset
@scratch_directory = File.join(@base_directory, 'scratch')
@output_directory = File.join(@base_directory, 'output')
@data_directory = File.join('tmp/metric_fu', '_data')
@metric_fu_root_directory = File.join(File.dirname(__FILE__),
@metric_fu_root_directory = File.join(File.dirname(__FILE__),
'..', '..')
@template_directory = File.join(@metric_fu_root_directory,
'lib', 'templates')
@template_directory = File.join(@metric_fu_root_directory,
'lib', 'templates')
@template_class = AwesomeTemplate
set_metrics
set_graphs
set_code_dirs
@flay = { :dirs_to_flay => @code_dirs,
:minimum_score => 100,
:filetypes => ['rb'] }
:filetypes => ['rb'] }
@flog = { :dirs_to_flog => @code_dirs }
@reek = { :dirs_to_reek => @code_dirs,
:config_file_pattern => nil}
@roodi = { :dirs_to_roodi => @code_dirs,
:roodi_config => nil}
@saikuro = { :output_directory => @scratch_directory + '/saikuro',
@saikuro = { :output_directory => @scratch_directory + '/saikuro',
:input_directory => @code_dirs,
:cyclo => "",
:filter_cyclo => "0",
Expand All @@ -128,10 +128,10 @@ def reset
@churn = {}
@stats = {}
@rcov = { :environment => 'test',
:test_files => ['test/**/*_test.rb',
:test_files => ['test/**/*_test.rb',
'spec/**/*_spec.rb'],
:rcov_opts => ["--sort coverage",
"--no-html",
:rcov_opts => ["--sort coverage",
"--no-html",
"--text-coverage",
"--no-color",
"--profile",
Expand All @@ -142,7 +142,7 @@ def reset
@rails_best_practices = {}
@hotspots = {}
@file_globs_to_ignore = []

@graph_engine = :bluff # can be :bluff or :gchart
end

Expand All @@ -163,12 +163,12 @@ def set_metrics
@metrics = MetricFu::AVAILABLE_METRICS
end
end

def set_graphs
if rails?
@graphs = MetricFu::AVAILABLE_GRAPHS + [:stats]
else
@graphs = MetricFu::AVAILABLE_GRAPHS
@graphs = MetricFu::AVAILABLE_GRAPHS
end
end

Expand All @@ -180,11 +180,11 @@ def set_code_dirs
@code_dirs = ['lib']
end
end

def platform #:nodoc:
return RUBY_PLATFORM
end

def is_cruise_control_rb?
!!ENV['CC_BUILD_ARTIFACTS']
end
Expand Down

0 comments on commit bdd3a40

Please sign in to comment.