forked from jscruggs/metric_fu
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
415 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,28 @@ | |||
class AwesomeTemplate < MetricFu::Template | |||
|
|||
def write | |||
@name = File.basename(Dir.pwd) | |||
report.each_pair do |section, contents| | |||
if template_exists?(section) | |||
create_instance_var(section, contents) | |||
@html = erbify(section) | |||
html = erbify('layout') | |||
fn = output_filename(section) | |||
MetricFu.report.save_output(html, MetricFu.output_directory, fn) | |||
end | |||
end | |||
|
|||
# Instance variables we need should already be created from above | |||
if template_exists?('index') | |||
@html = erbify('index') | |||
html = erbify('layout') | |||
fn = output_filename('index') | |||
MetricFu.report.save_output(html, MetricFu.output_directory, fn) | |||
end | |||
end | |||
|
|||
def this_directory | |||
File.dirname(__FILE__) | |||
end | |||
end | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
<h3>Source Control Churn Results</h3> | |||
<p>Files that change a lot in your project may be bad a sign. | |||
This task uses your source control log to identify those files. | |||
</p> | |||
<table> | |||
<tr> | |||
<th>File Path</th> | |||
<th>Times Changed</th> | |||
</tr> | |||
<% count = 0 %> | |||
<% @churn[:changes].each do |change| %> | |||
<tr> | |||
<td><%= change[:file_path] %></td> | |||
<td><%= change[:times_changed] %></td> | |||
</tr> | |||
<% count += 1 %> | |||
<% end %> | |||
</table> | |||
<p>Generated on <%= Time.now.localtime %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
table { | |||
margin-top: 10px; | |||
border-collapse: collapse; | |||
border: 1px solid #666; | |||
background: #fff; | |||
margin-bottom: 20px; | |||
} | |||
|
|||
table tr.light { | |||
background: #fff; | |||
} | |||
|
|||
table tr.dark { | |||
background: #f9f9f9; | |||
} | |||
|
|||
table td, table th { | |||
padding: 4px 10px; | |||
font-size: 13px; | |||
} | |||
table th { | |||
text-align: center; | |||
color: #fc0; | |||
background: #336; | |||
font-weight: bold; | |||
border: #d0d0d0 1px solid; | |||
} | |||
|
|||
table td { | |||
border: #d0d0d0 1px solid; | |||
} | |||
|
|||
table td.score { | |||
text-align: right; | |||
} | |||
|
|||
.warning { | |||
background: yellow; | |||
} | |||
.rcov_code td { | |||
border-bottom: 1px solid #ddd ; | |||
padding: 0; | |||
margin: 0; | |||
} | |||
.rcov_code tr { | |||
border: 0px; | |||
padding:0px; | |||
margin: 0px; | |||
} | |||
.rcov_code pre { | |||
border: 0px; | |||
padding: 0px; | |||
margin: 0px; | |||
} | |||
.rcov_run {} | |||
.rcov_not_run { | |||
background-color: #d88; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
<h3>Flay Results</h3> | |||
<h4>Total Score (lower is better): <%= @flay[:total_score] %></h4> | |||
<p><a href='http://ruby.sadi.st/Flay.html'>Flay</a> analyzes ruby code for structural similarities.</p> | |||
<table> | |||
<tr> | |||
<th>Files</th> | |||
<th>Matches</th> | |||
</tr> | |||
<% count = 0 %> | |||
<% @flay[:matches].each do |match| %> | |||
<tr class='<%= cycle("light", "dark", count) %>'> | |||
<td> | |||
<% match[:matches].each do |file| %> | |||
<%= file[:name] %>:<%= file[:line] %><br /> | |||
<% end %> | |||
</td> | |||
<td><%= match[:reason] %></td> | |||
</tr> | |||
<% count += 1 %> | |||
<% end %> | |||
</table> | |||
<p>Generated on <%= Time.now.localtime %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,42 @@ | |||
<h3>Flog Results</h3> | |||
<p><a href='http://ruby.sadi.st/Flog.html'>Flog</a> measures code complexity.</p> | |||
<h2>Total Flog score for all methods: <%= @flog[:total]%></h2> | |||
<h2>Average Flog score for all methods: <%= @flog[:average]%></h2> | |||
<table> | |||
<tr> | |||
<th>File</th> | |||
<th>Total score</th> | |||
<th>Methods</th> | |||
<th>Average score</th> | |||
<th>Highest score</th> | |||
</tr> | |||
<% @flog[:pages].each do |page| %> | |||
<tr> | |||
<td><%= page[:path] %></td> | |||
<td><%= page[:score].round %></td> | |||
<td><%= page[:scanned_methods].length %></td> | |||
<td><%= page[:average_score].round %></td> | |||
<td><%= page[:highest_score].round %></td> | |||
</tr> | |||
<% end %> | |||
</table> | |||
|
|||
<% @flog[:pages].each do |page| %> | |||
<h2><%= page[:path] %></h2> | |||
<% page[:scanned_methods].each do |sm| %> | |||
<p><%= sm[:name] %></p> | |||
<table> | |||
<tr> | |||
<th>Score</th> | |||
<th>Operator</th> | |||
</tr> | |||
<% sm[:operators].each do |operator| %> | |||
<tr> | |||
<td><%= operator[:score] %></td> | |||
<td><%= operator[:operator] %></td> | |||
</tr> | |||
<% end %> | |||
</table> | |||
<% end %> | |||
<% end %> | |||
<p>Generated on <%= Time.now.localtime %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,28 @@ | |||
<h3>Metric Fu Results</h3> | |||
<ul id='projects'> | |||
<% if @churn %> | |||
<li class='even failure'><a href="churn.html">Churn</a></li> | |||
<% end %> | |||
<% if @flay %> | |||
<li class='even failure'><a href="flay.html">Flay</a></li> | |||
<% end %> | |||
<% if @flog %> | |||
<li class='even failure'><a href="flog.html">Flog</a></li> | |||
<% end %> | |||
<% if @rcov %> | |||
<li class='even failure'><a href="rcov.html">Rcov</a></li> | |||
<% end %> | |||
<% if @reek %> | |||
<li class='even failure'><a href="reek.html">Reek</a></li> | |||
<% end %> | |||
<% if @roodi %> | |||
<li class='even failure'><a href="roodi.html">Roodi</a></li> | |||
<% end %> | |||
<% if @saikuro %> | |||
<li class='even failure'><a href="saikuro.html">Saikuro</a></li> | |||
<% end %> | |||
<% if @stats %> | |||
<li class='even failure'><a href="stats.html">Stats</a></li> | |||
<% end %> | |||
</ul> | |||
<p>Generated on <%= Time.now.localtime %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'> | |||
<head> | |||
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' /> | |||
<meta content='en' http-equiv='Content-Language' /> | |||
<title>metrics | thoughtbot</title> | |||
<link href='http://metrics.thoughtbot.com/reset.css' rel='stylesheet' type='text/css' /> | |||
<link href='http://metrics.thoughtbot.com/buttons.css' rel='stylesheet' type='text/css' /> | |||
<link href='http://metrics.thoughtbot.com/integrity.css' rel='stylesheet' type='text/css' /> | |||
<style> | |||
<%= inline_css("default.css") %> | |||
</style> | |||
<link REL="SHORTCUT ICON" HREF="/favicon.ico"> | |||
</head> | |||
<body> | |||
<div id='header'> | |||
<h1><a href="/">metrics</a> | <%= @name %></h1> | |||
<address class='watermark'> | |||
built with | |||
<a href='http://metric-fu.rubyforge.org/'>metric-fu</a> | |||
</address> | |||
</div> | |||
<div id='content'> | |||
<%= @html %> | |||
</div> | |||
</body> | |||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,30 @@ | |||
<h3>Rcov Code Coverage Results</h3> | |||
<p>C0 code coverage information.</p> | |||
<p>Total Coverage: <%= @rcov.delete(:global_percent_run) %>% </p> | |||
<table> | |||
<tr> | |||
<th>File Path</th> | |||
<th>Percent run</th> | |||
</tr> | |||
<% count = 0 %> | |||
<% @rcov.each_pair do |fname, file| %> | |||
<tr> | |||
<td><%= fname %></td> | |||
<td><%= file[:percent_run] %></td> | |||
</tr> | |||
<% count += 1 %> | |||
<% end %> | |||
</table> | |||
|
|||
<% @rcov.each_pair do |fname, file| %> | |||
<h2> <%= fname %></h2> | |||
<table class="rcov_code"> | |||
<% file[:lines].each do |line| %> | |||
<tr> | |||
<% css_class = line[:was_run] ? "rcov_run" : "rcov_not_run" %> | |||
<td class="<%= css_class %>"><pre><%= line[:content] %></pre></td> | |||
</tr> | |||
<% end %> | |||
</table> | |||
<% end %> | |||
<p>Generated on <%= Time.now.localtime %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,30 @@ | |||
<h3>Reek Results</h3> | |||
<p><a href="http://reek.rubyforge.org/">Reek</a> detects common code smells in ruby code.</p> | |||
<table> | |||
<tr> | |||
<th>File Path</th> | |||
<th>Method</th> | |||
<th>Description</th> | |||
<th>Type</th> | |||
</tr> | |||
<% count = 0 %> | |||
<% @reek[:matches].each do |match| %> | |||
<% match[:code_smells].each do |smell| %> | |||
<tr class='<%= cycle("light", "dark", count) %>'> | |||
<td><%= match[:file_path] %></td> | |||
<td> | |||
<%= smell[:method] %> | |||
</td> | |||
<td> | |||
<%= smell[:message] %> | |||
</td> | |||
<td> | |||
<%= smell[:type] %> | |||
</td> | |||
</tr> | |||
<% count += 1 %> | |||
<% end %> | |||
<% end %> | |||
|
|||
</table> | |||
<p>Generated on <%= Time.now.localtime %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
<h3>Roodi Results</h3> | |||
<p><a href="http://roodi.rubyforge.org/">Roodi</a> parses your Ruby code and warns you about design issues you have based on the checks that is has configured.</p> | |||
<table> | |||
<tr> | |||
<th>File Path</th> | |||
<th>Warning</th> | |||
</tr> | |||
<% count = 0 %> | |||
<% @roodi[:problems].each do |problem| %> | |||
<tr class='<%= cycle("light", "dark", count) %>'> | |||
<td><%= problem[:file] %>:<%= problem[:line] %></td> | |||
<td><%= problem[:problem] %></td> | |||
</tr> | |||
<% count += 1 %> | |||
<% end %> | |||
</table> | |||
<p>Generated on <%= Time.now.localtime %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,71 @@ | |||
<h3>Saikuro Results</h3> | |||
<p><a href='http://saikuro.rubyforge.org/'>Saikuro</a> analyzes ruby code for cyclomatic complexity.</p> | |||
|
|||
<h2>Analyzed Methods</h2> | |||
<table> | |||
<tr> | |||
<th>Method Name</th> | |||
<th>Complexity</th> | |||
<th># Lines</th> | |||
</tr> | |||
<% @saikuro[:methods].each do |method| %> | |||
<tr> | |||
<td><%= method[:name] %></td> | |||
<td><%= method[:complexity] %></td> | |||
<td><%= method[:lines] %></td> | |||
</tr> | |||
<% end %> | |||
</table> | |||
|
|||
|
|||
|
|||
<h2>Analyzed Classes</h2> | |||
<table> | |||
<tr> | |||
<th>Class Name</th> | |||
<th>Complexity</th> | |||
<th># Lines</th> | |||
</tr> | |||
<% @saikuro[:classes].each do |klass| %> | |||
<tr> | |||
<td><%= klass[:name] %></td> | |||
<td><%= klass[:complexity] %></td> | |||
<td><%= klass[:lines] %></td> | |||
</tr> | |||
<% end %> | |||
</table> | |||
|
|||
|
|||
<h2>Analyzed Files</h2> | |||
<% @saikuro[:files].each do |file| %> | |||
<% file[:classes].each do |klass| %> | |||
<% if !klass[:methods].empty? %> | |||
<h3><%= file[:filename] %></h3> | |||
<h4>Class : <%= klass[:class_name] %></h4> | |||
<h5>Total complexity : <%= klass[:complexity] %></h5> | |||
<h5>Total lines : <%= klass[:lines] %></h5> | |||
<table> | |||
<tr> | |||
<th>Method</th> | |||
<th>Complexity</th> | |||
<th># Lines</th> | |||
</tr> | |||
<% klass[:methods].each do |method| %> | |||
<tr> | |||
<td> | |||
<%= method[:name] %> | |||
</td> | |||
<td> | |||
<%= method[:complexity] %> | |||
</td> | |||
<td> | |||
<%= method[:lines] %> | |||
</td> | |||
</tr> | |||
<% end %> | |||
</table> | |||
<% end %> | |||
<% end %> | |||
<% end %> | |||
|
|||
<p>Generated on <%= Time.now.localtime %></p> |
Oops, something went wrong.