metric_fu 4.9.0 → 4.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- checksums.yaml.gz.sig +1 -2
- data.tar.gz.sig +0 -0
- data/CONTRIBUTORS +9 -7
- data/DEV.md +15 -0
- data/HISTORY.md +11 -1
- data/checksum/metric_fu-4.10.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.9.0.gem.sha512 +1 -0
- data/lib/metric_fu.rb +28 -0
- data/lib/metric_fu/formatter/html.rb +1 -1
- data/lib/metric_fu/gem_run.rb +3 -0
- data/lib/metric_fu/metrics/base_template.rb +9 -0
- data/lib/metric_fu/metrics/cane/template_awesome/cane.html.erb +3 -5
- data/lib/metric_fu/metrics/churn/template_awesome/churn.html.erb +1 -3
- data/lib/metric_fu/metrics/flay/template_awesome/flay.html.erb +3 -5
- data/lib/metric_fu/metrics/flog/template_awesome/flog.html.erb +3 -5
- data/lib/metric_fu/metrics/generator.rb +0 -8
- data/lib/metric_fu/metrics/hotspots/template_awesome/hotspots.html.erb +1 -1
- data/lib/metric_fu/metrics/rails_best_practices/template_awesome/rails_best_practices.html.erb +3 -5
- data/lib/metric_fu/metrics/rcov/template_awesome/rcov.html.erb +3 -5
- data/lib/metric_fu/metrics/reek/reek.rb +18 -1
- data/lib/metric_fu/metrics/reek/template_awesome/reek.html.erb +3 -5
- data/lib/metric_fu/metrics/roodi/template_awesome/roodi.html.erb +3 -5
- data/lib/metric_fu/metrics/saikuro/template_awesome/saikuro.html.erb +1 -1
- data/lib/metric_fu/metrics/stats/template_awesome/stats.html.erb +2 -5
- data/lib/metric_fu/reporting/templates/awesome/_graph.html.erb +2 -0
- data/lib/metric_fu/reporting/templates/awesome/_report_footer.html.erb +1 -0
- data/lib/metric_fu/reporting/templates/awesome/index.html.erb +2 -1
- data/lib/metric_fu/utility.rb +1 -1
- data/lib/metric_fu/version.rb +1 -1
- data/spec/metric_fu/formatter/html_spec.rb +1 -1
- data/spec/metric_fu/metrics/base_template_spec.rb +21 -0
- data/spec/metric_fu/metrics/reek/reek_spec.rb +32 -5
- data/spec/metric_fu/run_spec.rb +1 -1
- data/spec/metric_fu_spec.rb +16 -0
- metadata +6 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDU0ZjAyZDI4ZTQxN2JhZDVlNzc5M2VmNDBiYmNjODNjMTE4ZTczMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzI4ZDg2NjA1NzIwZmM5NDFjMzM5NGFhZjFjM2I4NGVjOGUwMGI1ZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2MyNjBjZGVhZDgxNzk2OTE3MWMwNDU1ZGI3NjMzNjRhYTI2NjI2OGE4MzQy
|
10
|
+
NDI1NzFkNDRkYjU3NzM5NDdjYzI4NDEzNTZmMjA4NWZlYjM2ZWUyZGMzMmJk
|
11
|
+
MWNlZWY4NDk2NDlhMzU3ZWYxYzZlY2E1MmYwZjA4NDRjM2IyZmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2JkYzVjNGY0OTI2OThlZDgwYTYzYjk5OGU0Yjg1NjQ3Y2JmYjE2NzRlYjc2
|
14
|
+
ZDMxODUxMGFjMmNmZDQ2OTdhOTVlMTVmMzc5YjEzNjA3MGNhZGM1M2JiODUy
|
15
|
+
NWUyM2RmZDQ2NmY3YjI2MzExZGU3ZmJmMjk2YTVhZDY5NzY4Nzg=
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
�*��9i��2����ez�Rd�5����e2I�SI���I�+�V���UW*P�rE5
|
1
|
+
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CONTRIBUTORS
CHANGED
@@ -33,8 +33,9 @@ Tarsoly András
|
|
33
33
|
Benjamin Fleischer / Paul Swagerty
|
34
34
|
unknown
|
35
35
|
Extrovert
|
36
|
-
|
36
|
+
Ben Turner
|
37
37
|
KAKUTANI Shintaro
|
38
|
+
Andrew Timberlake
|
38
39
|
Guilherme Souza
|
39
40
|
Przemysław Dąbek
|
40
41
|
carlost
|
@@ -44,28 +45,29 @@ Chris Mason
|
|
44
45
|
Andrew Selder
|
45
46
|
Mark Wilden
|
46
47
|
iain
|
48
|
+
Alessandro Dias
|
47
49
|
Lars E. Hoeg
|
48
50
|
Eric Wollesen
|
49
51
|
Adam Bair
|
50
52
|
Jinzhu
|
51
53
|
Matthew Van Horn
|
52
54
|
Diego Carrion
|
53
|
-
benlovell
|
54
55
|
saltracer
|
56
|
+
benlovell
|
55
57
|
ff-cviradiya
|
56
58
|
khall
|
57
59
|
Todd A. Jacobs
|
58
60
|
Stefan Huber
|
59
|
-
Bitdeli Chef
|
60
61
|
Hans Hasselberg
|
61
|
-
|
62
|
+
Bitdeli Chef
|
62
63
|
jayzes
|
64
|
+
Scyllinice
|
63
65
|
Matthew Gordon
|
64
66
|
factorylabs
|
65
67
|
Paul Elliott
|
66
|
-
Guilherme Simões
|
67
|
-
René Föhring
|
68
|
-
Chris Ian Fiel
|
69
68
|
Joel Nimety
|
69
|
+
Chris Ian Fiel
|
70
|
+
René Föhring
|
70
71
|
Mike Ball
|
71
72
|
Greg Allen
|
73
|
+
Guilherme Simões
|
data/DEV.md
CHANGED
@@ -37,6 +37,21 @@ MetricFu.configuration.configure_metric(:flog) do |metric|
|
|
37
37
|
end
|
38
38
|
```
|
39
39
|
|
40
|
+
## Templates
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
# Given
|
44
|
+
template = AwesomeTemplate.new
|
45
|
+
|
46
|
+
# Render _report_footer.html.erb partial:
|
47
|
+
|
48
|
+
template.render_partial('report_footer')
|
49
|
+
|
50
|
+
# Render _graph.html.erb partial and set a graph_name instance variable:
|
51
|
+
|
52
|
+
template.render_partial 'graph', {:graph_name => 'reek'}
|
53
|
+
```
|
54
|
+
|
40
55
|
## Testing
|
41
56
|
|
42
57
|
`bundle exec rspec`
|
data/HISTORY.md
CHANGED
@@ -4,13 +4,23 @@ Each change should fall into categories that would affect whether the release is
|
|
4
4
|
|
5
5
|
As such, a _Feature_ would map to either major or minor. A _bug fix_ to a patch. And _misc_ is either minor or patch, the difference being kind of fuzzy for the purposes of history. Adding tests would be patch level.
|
6
6
|
|
7
|
-
### Master [changes](https://github.com/metricfu/metric_fu/compare/v4.
|
7
|
+
### Master [changes](https://github.com/metricfu/metric_fu/compare/v4.10.0...master)
|
8
8
|
|
9
9
|
* Breaking Changes
|
10
10
|
* Features
|
11
11
|
* Fixes
|
12
12
|
* Misc
|
13
13
|
|
14
|
+
### [4.10.0 / 2014-04-01](https://github.com/metricfu/metric_fu/compare/v4.9.0...v4.10.0)
|
15
|
+
|
16
|
+
* Features
|
17
|
+
* Implement partials for cleaning up double template code (Martin Gotink, #211)
|
18
|
+
* Fixes
|
19
|
+
* Ensure reek output does not include ANSI color escape codes (Ben Turner #213)
|
20
|
+
* Misc
|
21
|
+
* Remove duplicate methods from generator. (Alessandro Dias Batista, #210)
|
22
|
+
* Encapsulate methods on MetricFu: report_time, report_id, :report_fingerprint, :current_time. (Benjamin Fleischer, #209)
|
23
|
+
|
14
24
|
### [4.9.0 / 2014-03-23](https://github.com/metricfu/metric_fu/compare/v4.8.0...v4.9.0)
|
15
25
|
|
16
26
|
* Features
|
@@ -0,0 +1 @@
|
|
1
|
+
8f0981ae30f8af7a51f73cafe23e764e26ac0a51b6fa99892d306079b52194f754b5045821684a22f34feae5772ab7818761f25fe166781c2497eca5b57770f5
|
@@ -0,0 +1 @@
|
|
1
|
+
6a59eb643743ccb2d34c7de915a0c448c6409a8b31a76b5bc8315fced802e5e186f8d97a7973c95ba306ac17d7de59d015cd93c50bda56180a952c91ac56c216
|
data/lib/metric_fu.rb
CHANGED
@@ -28,6 +28,34 @@ module MetricFu
|
|
28
28
|
@report_name = report_name
|
29
29
|
end
|
30
30
|
|
31
|
+
# The time at analyzed code state
|
32
|
+
def report_time
|
33
|
+
Time.now
|
34
|
+
end
|
35
|
+
|
36
|
+
def report_date_string
|
37
|
+
report_time.strftime("%Y%m%d")
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [String]
|
41
|
+
# @example '20140323'
|
42
|
+
# Used to uniquely identify reports
|
43
|
+
# as a sortable reference to when the report
|
44
|
+
# was generated
|
45
|
+
def report_id
|
46
|
+
report_date_string
|
47
|
+
end
|
48
|
+
|
49
|
+
# Non-date-specific; Used to uniquely identify a report run
|
50
|
+
def report_fingerprint
|
51
|
+
report_time.to_i.to_s
|
52
|
+
end
|
53
|
+
|
54
|
+
# The time the metrics are generated
|
55
|
+
def current_time
|
56
|
+
Time.now.localtime
|
57
|
+
end
|
58
|
+
|
31
59
|
def root_dir
|
32
60
|
APP_ROOT
|
33
61
|
end
|
@@ -17,7 +17,7 @@ module MetricFu
|
|
17
17
|
mf_debug "** SAVING REPORT DATA OUTPUT TO #{MetricFu::Io::FileSystem.directory('data_directory')}"
|
18
18
|
# TODO: Allow customizing output filenames
|
19
19
|
MetricFu::Formatter::YAML.new(
|
20
|
-
output: MetricFu.run_path.join("#{MetricFu::Io::FileSystem.directory('data_directory')}/#{
|
20
|
+
output: MetricFu.run_path.join("#{MetricFu::Io::FileSystem.directory('data_directory')}/#{MetricFu.report_id}.yml")
|
21
21
|
).finish
|
22
22
|
|
23
23
|
mf_debug "** SAVING TEMPLATIZED REPORT"
|
data/lib/metric_fu/gem_run.rb
CHANGED
@@ -29,9 +29,12 @@ module MetricFu
|
|
29
29
|
def execute
|
30
30
|
mf_debug "Running #{summary}"
|
31
31
|
captured_output = ''
|
32
|
+
captured_errors = ''
|
32
33
|
Open3.popen3("#{library_name}", *arguments) do |stdin, stdout, stderr, wait_thr|
|
33
34
|
captured_output << stdout.read.chomp
|
35
|
+
captured_errors << stderr.read.chomp
|
34
36
|
end
|
37
|
+
STDERR.puts MetricFu::AnalysisError.new(captured_errors) unless captured_errors.empty?
|
35
38
|
rescue StandardError => run_error
|
36
39
|
handle_run_error(run_error)
|
37
40
|
rescue SystemExit => system_exit
|
@@ -16,6 +16,11 @@ module MetricFu
|
|
16
16
|
@output_directory || MetricFu::Io::FileSystem.directory('output_directory')
|
17
17
|
end
|
18
18
|
|
19
|
+
# Renders a partial and add optional instance variables to the template
|
20
|
+
def render_partial(name, instance_variables = {})
|
21
|
+
create_instance_vars(instance_variables)
|
22
|
+
erbify("_#{name}")
|
23
|
+
end
|
19
24
|
|
20
25
|
private
|
21
26
|
# Creates a new erb evaluated result from the passed in section.
|
@@ -58,6 +63,10 @@ module MetricFu
|
|
58
63
|
instance_variable_set("@#{section}", contents)
|
59
64
|
end
|
60
65
|
|
66
|
+
def create_instance_vars(variables)
|
67
|
+
variables.each { |variable| create_instance_var(*variable) }
|
68
|
+
end
|
69
|
+
|
61
70
|
# Generates the filename of the template file to load and
|
62
71
|
# evaluate. In this case, the path to the template directory +
|
63
72
|
# the section name + .html.erb
|
@@ -2,10 +2,7 @@
|
|
2
2
|
|
3
3
|
<p><a href='https://github.com/square/cane'>Cane</a> reports code quality threshold violations.</p>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
<% graph_name = 'cane' %>
|
8
|
-
<script language="javascript" src="<%= graph_name %>.js?<%= Time.now.to_i %>" type="text/javascript"></script>
|
5
|
+
<%= render_partial 'graph', {:graph_name => 'cane'} %>
|
9
6
|
|
10
7
|
<% if @cane[:violations][:abc_complexity] && @cane[:violations][:abc_complexity].size > 0 %>
|
11
8
|
<h3>Methods exceeding allowed Abc complexity (<%= @cane[:violations][:abc_complexity].size %>)</h3>
|
@@ -86,4 +83,5 @@
|
|
86
83
|
<% end %>
|
87
84
|
</table>
|
88
85
|
<% end %>
|
89
|
-
|
86
|
+
|
87
|
+
<%= render_partial 'report_footer' %>
|
@@ -2,10 +2,7 @@
|
|
2
2
|
|
3
3
|
<p><a href='http://ruby.sadi.st/Flay.html'>Flay</a> analyzes ruby code for structural similarities.</p>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
<% graph_name = 'flay' %>
|
8
|
-
<script language="javascript" src="<%= graph_name %>.js?<%= Time.now.to_i %>" type="text/javascript"></script>
|
5
|
+
<%= render_partial 'graph', {:graph_name => 'flay'} %>
|
9
6
|
|
10
7
|
<h4>Total Score (lower is better): <%= @flay[:total_score] %></h4>
|
11
8
|
<h5>Scores less than <%= MetricFu::Metric.get_metric('flay').run_options[:minimum_score] %> are not shown or part of the total</h5>
|
@@ -28,4 +25,5 @@
|
|
28
25
|
<% count += 1 %>
|
29
26
|
<% end %>
|
30
27
|
</table>
|
31
|
-
|
28
|
+
|
29
|
+
<%= render_partial 'report_footer' %>
|
@@ -1,10 +1,7 @@
|
|
1
1
|
<h3>Flog Results</h3>
|
2
2
|
<p><a href='http://ruby.sadi.st/Flog.html'>Flog</a> measures code complexity.</p>
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
<% graph_name = 'flog' %>
|
7
|
-
<script language="javascript" src="<%= graph_name %>.js?<%= Time.now.to_i %>" type="text/javascript"></script>
|
4
|
+
<%= render_partial 'graph', {:graph_name => 'flog'} %>
|
8
5
|
|
9
6
|
<h2>Total Flog score for all methods: <%= round_to_tenths @flog[:total]%></h2>
|
10
7
|
<h2>Average Flog score for all methods: <%= round_to_tenths @flog[:average]%></h2>
|
@@ -49,4 +46,5 @@
|
|
49
46
|
</table>
|
50
47
|
<% end %>
|
51
48
|
<% end %>
|
52
|
-
|
49
|
+
|
50
|
+
<%= render_partial 'report_footer' %>
|
@@ -52,10 +52,6 @@ module MetricFu
|
|
52
52
|
@generators
|
53
53
|
end
|
54
54
|
|
55
|
-
def self.metric
|
56
|
-
not_implemented
|
57
|
-
end
|
58
|
-
|
59
55
|
def self.get_generator(metric)
|
60
56
|
generators.find{|generator|generator.metric.to_s == metric.to_s.downcase}
|
61
57
|
end
|
@@ -88,10 +84,6 @@ module MetricFu
|
|
88
84
|
paths - files_to_remove
|
89
85
|
end
|
90
86
|
|
91
|
-
def metric
|
92
|
-
self.class.metric
|
93
|
-
end
|
94
|
-
|
95
87
|
def metric_config
|
96
88
|
MetricFu::Metric.get_metric(metric)
|
97
89
|
end
|
data/lib/metric_fu/metrics/rails_best_practices/template_awesome/rails_best_practices.html.erb
CHANGED
@@ -2,10 +2,7 @@
|
|
2
2
|
|
3
3
|
<p><a href="http://github.com/railsbp/rails_best_practices">rails_best_practices</a> is a code metric tool for rails projects.</p>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
<% graph_name = 'rails_best_practices' %>
|
8
|
-
<script language="javascript" src="<%= graph_name %>.js?<%= Time.now.to_i %>" type="text/javascript"></script>
|
5
|
+
<%= render_partial 'graph', {:graph_name => 'rails_best_practices'} %>
|
9
6
|
|
10
7
|
<table>
|
11
8
|
<tr>
|
@@ -21,4 +18,5 @@
|
|
21
18
|
<% count += 1 %>
|
22
19
|
<% end %>
|
23
20
|
</table>
|
24
|
-
|
21
|
+
|
22
|
+
<%= render_partial 'report_footer' %>
|
@@ -5,10 +5,7 @@
|
|
5
5
|
|
6
6
|
<p>C0 code coverage information.</p>
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
<% graph_name = 'rcov' %>
|
11
|
-
<script language="javascript" src="<%= graph_name %>.js?<%= Time.now.to_i %>" type="text/javascript"></script>
|
8
|
+
<%= render_partial 'graph', {:graph_name => 'rcov'} %>
|
12
9
|
|
13
10
|
<p>Total Coverage: <%= @rcov.delete(:global_percent_run) %>% </p>
|
14
11
|
<table>
|
@@ -39,4 +36,5 @@
|
|
39
36
|
</table>
|
40
37
|
</div>
|
41
38
|
<% end %>
|
42
|
-
|
39
|
+
|
40
|
+
<%= render_partial 'report_footer' %>
|
@@ -97,6 +97,7 @@ module MetricFu
|
|
97
97
|
def cli_options(files)
|
98
98
|
[
|
99
99
|
disable_line_number_option,
|
100
|
+
turn_off_color,
|
100
101
|
config_option,
|
101
102
|
files.join(' ')
|
102
103
|
].join(' ')
|
@@ -112,8 +113,24 @@ module MetricFu
|
|
112
113
|
end
|
113
114
|
end
|
114
115
|
|
116
|
+
# Work around "Error: invalid option: --no-color" in reek < 1.3.7
|
117
|
+
def turn_off_color
|
118
|
+
if reek_version >= '1.3.7'
|
119
|
+
'--no-color'
|
120
|
+
else
|
121
|
+
''
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def reek_version
|
126
|
+
@reek_version ||= `reek --version`.chomp.sub(/\s*reek\s*/,'')
|
127
|
+
# use the above, as the below may activate a version not available in
|
128
|
+
# a Bundler context
|
129
|
+
# MetricFu::GemVersion.activated_version('reek').to_s
|
130
|
+
end
|
131
|
+
|
115
132
|
def disable_line_number_option
|
116
|
-
'-
|
133
|
+
'--no-line-numbers'
|
117
134
|
end
|
118
135
|
|
119
136
|
def zero_warnings?(match)
|
@@ -2,10 +2,7 @@
|
|
2
2
|
|
3
3
|
<p><a href="http://github.com/troessner/reek">Reek</a> detects common code smells in ruby code.</p>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
<% graph_name = 'reek' %>
|
8
|
-
<script language="javascript" src="<%= graph_name %>.js?<%= Time.now.to_i %>" type="text/javascript"></script>
|
5
|
+
<%= render_partial 'graph', {:graph_name => 'reek'} %>
|
9
6
|
|
10
7
|
<table>
|
11
8
|
<tr>
|
@@ -34,4 +31,5 @@
|
|
34
31
|
<% end %>
|
35
32
|
|
36
33
|
</table>
|
37
|
-
|
34
|
+
|
35
|
+
<%= render_partial 'report_footer' %>
|
@@ -2,10 +2,7 @@
|
|
2
2
|
|
3
3
|
<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>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
<% graph_name = 'roodi' %>
|
8
|
-
<script language="javascript" src="<%= graph_name %>.js?<%= Time.now.to_i %>" type="text/javascript"></script>
|
5
|
+
<%= render_partial 'graph', {:graph_name => 'roodi'} %>
|
9
6
|
|
10
7
|
<table>
|
11
8
|
<tr>
|
@@ -21,4 +18,5 @@
|
|
21
18
|
<% count += 1 %>
|
22
19
|
<% end %>
|
23
20
|
</table>
|
24
|
-
|
21
|
+
|
22
|
+
<%= render_partial 'report_footer' %>
|
@@ -1,9 +1,6 @@
|
|
1
1
|
<h3>Lines of Code/Tests Metric Results</h3>
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
<% graph_name = 'stats' %>
|
6
|
-
<script language="javascript" src="<%= graph_name %>.js?<%= Time.now.to_i %>" type="text/javascript"></script>
|
3
|
+
<%= render_partial 'graph', {:graph_name => 'stats'} %>
|
7
4
|
|
8
5
|
<p>Lines of Code/Tests Metrics Results</p>
|
9
6
|
<table>
|
@@ -44,4 +41,4 @@
|
|
44
41
|
<% end %>
|
45
42
|
</table>
|
46
43
|
|
47
|
-
|
44
|
+
<%= render_partial 'report_footer' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>Generated on <%= MetricFu.current_time %></p>
|
data/lib/metric_fu/utility.rb
CHANGED
data/lib/metric_fu/version.rb
CHANGED
@@ -46,7 +46,7 @@ describe MetricFu::Formatter::HTML do
|
|
46
46
|
# For use with graphs.
|
47
47
|
expect {
|
48
48
|
MetricFu::Formatter::HTML.new.finish
|
49
|
-
}.to create_file("#{directory('data_directory')}/#{
|
49
|
+
}.to create_file("#{directory('data_directory')}/#{MetricFu.report_id}.yml")
|
50
50
|
end
|
51
51
|
|
52
52
|
it "creates a report index html file" do
|
@@ -195,4 +195,25 @@ describe MetricFu::Template do
|
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
|
+
describe "#render_partial" do
|
199
|
+
it 'should erbify a partial with the name prefixed with an underscore' do
|
200
|
+
expect(@template).to receive(:erbify).with('_some_partial')
|
201
|
+
@template.send(:render_partial, 'some_partial')
|
202
|
+
end
|
203
|
+
|
204
|
+
it 'should set the given instance variables' do
|
205
|
+
variables = {:answer => 42}
|
206
|
+
allow(@template).to receive(:erbify)
|
207
|
+
expect(@template).to receive(:create_instance_vars).with(variables)
|
208
|
+
@template.send(:render_partial, 'some_partial', variables)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe "#create_instance_vars" do
|
213
|
+
it "should set the given instance variables" do
|
214
|
+
@template.send(:create_instance_vars, {:answer => 42})
|
215
|
+
expect(@template.instance_variable_get(:@answer)).to eq(42)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
198
219
|
end
|
@@ -3,12 +3,39 @@ MetricFu.metrics_require { 'reek/reek' }
|
|
3
3
|
|
4
4
|
describe MetricFu::ReekGenerator do
|
5
5
|
describe "emit" do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
let(:options) { {:dirs_to_reek => []} }
|
7
|
+
let(:files_to_analyze) { ['lib/foo.rb','lib/bar.rb'] }
|
8
|
+
let(:reek) { MetricFu::ReekGenerator.new(options) }
|
9
|
+
|
10
|
+
before :each do
|
10
11
|
allow(reek).to receive(:files_to_analyze).and_return(files_to_analyze)
|
11
|
-
|
12
|
+
end
|
13
|
+
|
14
|
+
it "includes config file pattern into reek parameters when specified" do
|
15
|
+
options.merge!({:config_file_pattern => 'lib/config/*.reek' })
|
16
|
+
expect(reek).to receive(:run!).with(/--config lib\/config\/\*\.reek /).and_return("")
|
17
|
+
reek.emit
|
18
|
+
end
|
19
|
+
|
20
|
+
it "turns off color output from reek output, for reek 1.3.7 or greater" do
|
21
|
+
allow(reek).to receive(:reek_version).and_return('1.3.7')
|
22
|
+
expect(reek).to receive(:run!).with(/(?=--no-color)/).and_return("")
|
23
|
+
reek.emit
|
24
|
+
end
|
25
|
+
|
26
|
+
it "does not set an (invalid) --no-color option for reek < 1.3.7" do
|
27
|
+
allow(reek).to receive(:reek_version).and_return('1.3.6')
|
28
|
+
expect(reek).to receive(:run!).with(/(?!--no-color)/).and_return("")
|
29
|
+
reek.emit
|
30
|
+
end
|
31
|
+
|
32
|
+
it "disables lines numbers from reek output" do
|
33
|
+
expect(reek).to receive(:run!).with(/--no-line-numbers /).and_return("")
|
34
|
+
reek.emit
|
35
|
+
end
|
36
|
+
|
37
|
+
it "includes files to analyze into reek parameters" do
|
38
|
+
expect(reek).to receive(:run!).with(/lib\/foo.rb lib\/bar.rb$/).and_return("")
|
12
39
|
reek.emit
|
13
40
|
end
|
14
41
|
end
|
data/spec/metric_fu/run_spec.rb
CHANGED
@@ -53,7 +53,7 @@ describe MetricFu do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "creates a data yaml file" do
|
56
|
-
expect { metric_fu }.to create_file("#{data_directory}/#{
|
56
|
+
expect { metric_fu }.to create_file("#{data_directory}/#{MetricFu.report_id}.yml")
|
57
57
|
end
|
58
58
|
|
59
59
|
it "creates a report html file" do
|
data/spec/metric_fu_spec.rb
CHANGED
@@ -16,4 +16,20 @@ describe MetricFu do
|
|
16
16
|
MetricFu.report_name = original_report_name
|
17
17
|
end
|
18
18
|
|
19
|
+
it "has a global report time (corresponding to the time of the VCS code state)" do
|
20
|
+
expect(MetricFu.report_time - Time.now).to be_within(0.1).of(0)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "has a global current time (corresponding to report generation time)" do
|
24
|
+
expect(MetricFu.current_time - Time.now).to be_within(0.1).of(0)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "has a global report id" do
|
28
|
+
expect(MetricFu.report_id).to eq(Time.now.strftime('%Y%m%d'))
|
29
|
+
end
|
30
|
+
|
31
|
+
it "has a global report fingerprint (corresponding to VCS code state)" do
|
32
|
+
expect(MetricFu.report_fingerprint.to_i - Time.now.to_i).to be_within(0.1).of(0)
|
33
|
+
end
|
34
|
+
|
19
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metric_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Scruggs
|
@@ -49,7 +49,7 @@ cert_chain:
|
|
49
49
|
dWphdUtxcjhoS0RMdTRLK3F1Q0dqWC82TEw2CldPTno5dlQ2aDA1M2tIWllN
|
50
50
|
cmQ0R3MvTmRhQTR0SlN4cmhabFhkYWpBbS8wdkFPekxJcVVISFFrM1IwdGY3
|
51
51
|
YVkKZC93PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
52
|
-
date: 2014-
|
52
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
53
53
|
dependencies:
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: flay
|
@@ -341,6 +341,7 @@ files:
|
|
341
341
|
- bin/mf-saikuro
|
342
342
|
- certs/bf4.pem
|
343
343
|
- checksum/.gitkeep
|
344
|
+
- checksum/metric_fu-4.10.0.gem.sha512
|
344
345
|
- checksum/metric_fu-4.2.0.gem.sha512
|
345
346
|
- checksum/metric_fu-4.2.1.gem.sha512
|
346
347
|
- checksum/metric_fu-4.3.0.gem.sha512
|
@@ -360,6 +361,7 @@ files:
|
|
360
361
|
- checksum/metric_fu-4.7.3.gem.sha512
|
361
362
|
- checksum/metric_fu-4.7.4.gem.sha512
|
362
363
|
- checksum/metric_fu-4.8.0.gem.sha512
|
364
|
+
- checksum/metric_fu-4.9.0.gem.sha512
|
363
365
|
- config/roodi_config.yml
|
364
366
|
- gem_tasks/build.rake
|
365
367
|
- gem_tasks/usage_test.rake
|
@@ -460,6 +462,8 @@ files:
|
|
460
462
|
- lib/metric_fu/reporter.rb
|
461
463
|
- lib/metric_fu/reporting/graphs/grapher.rb
|
462
464
|
- lib/metric_fu/reporting/result.rb
|
465
|
+
- lib/metric_fu/reporting/templates/awesome/_graph.html.erb
|
466
|
+
- lib/metric_fu/reporting/templates/awesome/_report_footer.html.erb
|
463
467
|
- lib/metric_fu/reporting/templates/awesome/awesome_template.rb
|
464
468
|
- lib/metric_fu/reporting/templates/awesome/index.html.erb
|
465
469
|
- lib/metric_fu/reporting/templates/awesome/layout.html.erb
|
metadata.gz.sig
CHANGED
Binary file
|