Permalink
Browse files

+ Added -# to turn off item numbering. Helps with diffs to compare ru…

…ns over time.

Got rid of that annoying extra blank line after the total.
[git-p4: depot-paths = "//src/flay/dev/": change = 8333]
  • Loading branch information...
1 parent afda195 commit 236c01d6c4c125543f17424494ed840914e72579 @zenspider zenspider committed Mar 29, 2013
Showing with 15 additions and 5 deletions.
  1. +15 −4 lib/flay.rb
  2. +0 −1 test/test_flay.rb
View
19 lib/flay.rb
@@ -23,6 +23,7 @@ def self.default_options
:mass => 16,
:summary => false,
:verbose => false,
+ :number => true,
:timeout => 10,
:liberal => false,
:fuzzy => false,
@@ -59,6 +60,10 @@ def self.parse_options args = ARGV
options[:mass] = m.to_i
end
+ opts.on('-#', "Don't number output (helps with diffs)") do |m|
+ options[:number] = false
+ end
+
opts.on('-v', '--verbose', "Verbose. Show progress processing files.") do
options[:verbose] = true
end
@@ -348,9 +353,9 @@ def report prune = nil
analyze
puts "Total score (lower is better) = #{self.total}"
- puts
if option[:summary] then
+ puts
self.summary.sort_by { |_,v| -v }.each do |file, score|
puts "%8.2f: %s" % [score, file]
@@ -380,9 +385,15 @@ def report prune = nil
["Similar", ""]
end
- count += 1
- puts "%d) %s code found in %p (mass%s = %d)" %
- [count, match, node.first, bonus, mass]
+ if option[:number] then
+ count += 1
+
+ puts "%d) %s code found in %p (mass%s = %d)" %
+ [count, match, node.first, bonus, mass]
+ else
+ puts "%s code found in %p (mass%s = %d)" %
+ [match, node.first, bonus, mass]
+ end
nodes.sort_by { |x| [x.file, x.line] }.each_with_index do |x, i|
if option[:diff] then
View
1 test/test_flay.rb
@@ -221,7 +221,6 @@ def test_report
exp = <<-END.gsub(/\d+/, "N").gsub(/^ {6}/, "")
Total score (lower is better) = 16
-
1) Similar code found in :class (mass = 16)
A: (string):1
B: (string):6

0 comments on commit 236c01d

Please sign in to comment.