Skip to content

Commit

Permalink
Adding trivial collect_blame method. Will next decide on whether ther…
Browse files Browse the repository at this point in the history
…e's a way to use the parsetree to get method/line# mappings, or whether we have to ghetto-parse the blame results into classes/modules/methods.
  • Loading branch information
rick committed Aug 4, 2008
1 parent 3307e27 commit 442eb18
Show file tree
Hide file tree
Showing 8 changed files with 2,874 additions and 2,844 deletions.
16 changes: 8 additions & 8 deletions coverage/index.html
Expand Up @@ -148,7 +148,7 @@
</script>
</head>
<body><h3>C0 code coverage information</h3>
<p>Generated on Mon Aug 04 22:47:34 -0500 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
<p>Generated on Mon Aug 04 22:47:49 -0500 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
</p>
<hr/>
<table class='report'><thead><tr><td class='heading'>Name</td>
Expand All @@ -159,9 +159,9 @@
</tr>
</thead>
<tbody><tr class='light'><td>TOTAL</td>
<td class='lines_total'><tt>2947</tt>
<td class='lines_total'><tt>2962</tt>
</td>
<td class='lines_code'><tt>2564</tt>
<td class='lines_code'><tt>2575</tt>
</td>
<td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>98.9%</tt>
&nbsp;</td>
Expand All @@ -186,11 +186,11 @@
</tr>
<tr class='dark'><td><a href='lib-flog_rb.html'>lib/flog.rb</a>
</td>
<td class='lines_total'><tt>516</tt>
<td class='lines_total'><tt>519</tt>
</td>
<td class='lines_code'><tt>425</tt>
<td class='lines_code'><tt>427</tt>
</td>
<td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>95.7%</tt>
<td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>95.8%</tt>
&nbsp;</td>
<td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='96'/>
<td class='uncovered' width='4'/>
Expand Down Expand Up @@ -267,9 +267,9 @@
</tr>
<tr class='light'><td><a href='spec-flog_spec_rb.html'>spec/flog_spec.rb</a>
</td>
<td class='lines_total'><tt>1103</tt>
<td class='lines_total'><tt>1115</tt>
</td>
<td class='lines_code'><tt>906</tt>
<td class='lines_code'><tt>915</tt>
</td>
<td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt>
&nbsp;</td>
Expand Down
801 changes: 402 additions & 399 deletions coverage/lib-flog_rb.html

Large diffs are not rendered by default.

706 changes: 353 additions & 353 deletions coverage/spec-flog_command_spec_rb.html

Large diffs are not rendered by default.

1,882 changes: 941 additions & 941 deletions coverage/spec-flog_integration_spec_rb.html

Large diffs are not rendered by default.

2,224 changes: 1,118 additions & 1,106 deletions coverage/spec-flog_spec_rb.html

Large diffs are not rendered by default.

74 changes: 37 additions & 37 deletions coverage/spec-spec_helper_rb.html
Expand Up @@ -553,7 +553,7 @@
</style>
</head>
<body><h3>C0 code coverage information</h3>
<p>Generated on Mon Aug 04 22:47:36 -0500 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
<p>Generated on Mon Aug 04 22:47:51 -0500 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
</p>
<hr/>
<pre><span class='marked0'>Code reported as executed by Ruby looks like this...
Expand Down Expand Up @@ -598,42 +598,42 @@
</tr>
</tbody>
</table>
<pre><span class="inferred0"><a name="line1"></a> 1 # this is my favorite way to require ever
</span><span class="marked1"><a name="line2"></a> 2 begin
</span><span class="marked0"><a name="line3"></a> 3 require 'spec'
</span><span class="uncovered1"><a name="line4"></a> 4 rescue LoadError
</span><span class="uncovered0"><a name="line5"></a> 5 require 'rubygems'
</span><span class="uncovered1"><a name="line6"></a> 6 gem 'rspec'
</span><span class="uncovered0"><a name="line7"></a> 7 require 'spec'
</span><span class="uncovered1"><a name="line8"></a> 8 end
</span><span class="inferred0"><a name="line9"></a> 9
</span><span class="marked1"><a name="line10"></a>10 begin
</span><span class="marked0"><a name="line11"></a>11 require 'mocha'
</span><span class="uncovered1"><a name="line12"></a>12 rescue LoadError
</span><span class="uncovered0"><a name="line13"></a>13 require 'rubygems'
</span><span class="uncovered1"><a name="line14"></a>14 gem 'mocha'
</span><span class="uncovered0"><a name="line15"></a>15 require 'mocha'
</span><span class="uncovered1"><a name="line16"></a>16 end
</span><span class="inferred0"><a name="line17"></a>17
</span><span class="inferred1"><a name="line18"></a>18
</span><span class="marked0"><a name="line19"></a>19 module Spec::Example::ExampleGroupMethods
</span><span class="marked1"><a name="line20"></a>20 def currently(name, &amp;block)
</span><span class="marked0"><a name="line21"></a>21 it(&quot;*** CURRENTLY *** #{name}&quot;, &amp;block)
</span><span class="inferred1"><a name="line22"></a>22 end
</span><span class="inferred0"><a name="line23"></a>23 end
</span><span class="inferred1"><a name="line24"></a>24
</span><span class="marked0"><a name="line25"></a>25 Spec::Runner.configure do |config|
</span><span class="marked1"><a name="line26"></a>26 config.mock_with :mocha
</span><span class="inferred0"><a name="line27"></a>27 end
</span><span class="inferred1"><a name="line28"></a>28
</span><span class="marked0"><a name="line29"></a>29 def fixture_files(paths)
</span><span class="marked1"><a name="line30"></a>30 paths.collect do |path|
</span><span class="marked0"><a name="line31"></a>31 File.expand_path(File.dirname(__FILE__) + '/../spec_fixtures/' + path)
</span><span class="inferred1"><a name="line32"></a>32 end
</span><span class="marked0"><a name="line33"></a>33 end
</span><span class="inferred1"><a name="line34"></a>34
</span><span class="inferred0"><a name="line35"></a>35
</span><span class="marked1"><a name="line36"></a>36 $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
<pre><span class="inferred1"><a name="line1"></a> 1 # this is my favorite way to require ever
</span><span class="marked0"><a name="line2"></a> 2 begin
</span><span class="marked1"><a name="line3"></a> 3 require 'spec'
</span><span class="uncovered0"><a name="line4"></a> 4 rescue LoadError
</span><span class="uncovered1"><a name="line5"></a> 5 require 'rubygems'
</span><span class="uncovered0"><a name="line6"></a> 6 gem 'rspec'
</span><span class="uncovered1"><a name="line7"></a> 7 require 'spec'
</span><span class="uncovered0"><a name="line8"></a> 8 end
</span><span class="inferred1"><a name="line9"></a> 9
</span><span class="marked0"><a name="line10"></a>10 begin
</span><span class="marked1"><a name="line11"></a>11 require 'mocha'
</span><span class="uncovered0"><a name="line12"></a>12 rescue LoadError
</span><span class="uncovered1"><a name="line13"></a>13 require 'rubygems'
</span><span class="uncovered0"><a name="line14"></a>14 gem 'mocha'
</span><span class="uncovered1"><a name="line15"></a>15 require 'mocha'
</span><span class="uncovered0"><a name="line16"></a>16 end
</span><span class="inferred1"><a name="line17"></a>17
</span><span class="inferred0"><a name="line18"></a>18
</span><span class="marked1"><a name="line19"></a>19 module Spec::Example::ExampleGroupMethods
</span><span class="marked0"><a name="line20"></a>20 def currently(name, &amp;block)
</span><span class="marked1"><a name="line21"></a>21 it(&quot;*** CURRENTLY *** #{name}&quot;, &amp;block)
</span><span class="inferred0"><a name="line22"></a>22 end
</span><span class="inferred1"><a name="line23"></a>23 end
</span><span class="inferred0"><a name="line24"></a>24
</span><span class="marked1"><a name="line25"></a>25 Spec::Runner.configure do |config|
</span><span class="marked0"><a name="line26"></a>26 config.mock_with :mocha
</span><span class="inferred1"><a name="line27"></a>27 end
</span><span class="inferred0"><a name="line28"></a>28
</span><span class="marked1"><a name="line29"></a>29 def fixture_files(paths)
</span><span class="marked0"><a name="line30"></a>30 paths.collect do |path|
</span><span class="marked1"><a name="line31"></a>31 File.expand_path(File.dirname(__FILE__) + '/../spec_fixtures/' + path)
</span><span class="inferred0"><a name="line32"></a>32 end
</span><span class="marked1"><a name="line33"></a>33 end
</span><span class="inferred0"><a name="line34"></a>34
</span><span class="inferred1"><a name="line35"></a>35
</span><span class="marked0"><a name="line36"></a>36 $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
</span></pre><hr/>
<p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a>
version 0.8.1.2.</p>
Expand Down
3 changes: 3 additions & 0 deletions lib/flog.rb
Expand Up @@ -111,6 +111,9 @@ def process_parse_tree(ruby, file)
process Sexp.from_array(sexp).first
end

def collect_blame(filename)
end

def add_to_score(name)
@calls["#{class_name}##{method_name}"][name] += SCORES[name] * @multiplier
end
Expand Down
12 changes: 12 additions & 0 deletions spec/flog_spec.rb
Expand Up @@ -443,6 +443,18 @@
end
end

describe 'when collecting blame information from a file' do
it 'should require a filename' do
lambda { @flog.collect_blame }.should raise_error(ArgumentError)
end

it 'should not fail when given a filename' do
@flog.collect_blame('filename')
end

it 'should have more specs'
end

describe 'multiplier' do
it 'should be possible to determine the current value of the multiplier' do
@flog.should respond_to(:multiplier)
Expand Down

0 comments on commit 442eb18

Please sign in to comment.