metric_fu 4.11.3 → 4.11.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.rubocop.yml +15 -0
  5. data/.rubocop_todo.yml +69 -0
  6. data/.travis.yml +0 -1
  7. data/CONTRIBUTORS +1 -1
  8. data/Gemfile +23 -20
  9. data/Guardfile +9 -9
  10. data/HISTORY.md +10 -1
  11. data/checksum/metric_fu-4.11.3.gem.sha512 +1 -0
  12. data/config/rubocop.yml +269 -0
  13. data/gem_tasks/rubocop.rake +10 -0
  14. data/lib/metric_fu.rb +11 -9
  15. data/lib/metric_fu/calculate.rb +0 -1
  16. data/lib/metric_fu/cli/client.rb +6 -6
  17. data/lib/metric_fu/cli/helper.rb +22 -13
  18. data/lib/metric_fu/cli/parser.rb +14 -18
  19. data/lib/metric_fu/configuration.rb +7 -11
  20. data/lib/metric_fu/constantize.rb +4 -4
  21. data/lib/metric_fu/data_structures/line_numbers.rb +10 -11
  22. data/lib/metric_fu/data_structures/location.rb +12 -14
  23. data/lib/metric_fu/data_structures/sexp_node.rb +31 -13
  24. data/lib/metric_fu/environment.rb +29 -31
  25. data/lib/metric_fu/formatter.rb +4 -6
  26. data/lib/metric_fu/formatter/html.rb +13 -13
  27. data/lib/metric_fu/formatter/syntax.rb +5 -7
  28. data/lib/metric_fu/formatter/yaml.rb +1 -1
  29. data/lib/metric_fu/gem_run.rb +13 -15
  30. data/lib/metric_fu/gem_version.rb +9 -11
  31. data/lib/metric_fu/generator.rb +5 -8
  32. data/lib/metric_fu/io.rb +13 -15
  33. data/lib/metric_fu/loader.rb +17 -18
  34. data/lib/metric_fu/logger.rb +15 -18
  35. data/lib/metric_fu/logging/mf_debugger.rb +4 -4
  36. data/lib/metric_fu/metric.rb +11 -12
  37. data/lib/metric_fu/metrics/cane/generator.rb +10 -9
  38. data/lib/metric_fu/metrics/cane/grapher.rb +5 -7
  39. data/lib/metric_fu/metrics/cane/metric.rb +6 -8
  40. data/lib/metric_fu/metrics/cane/report.html.erb +3 -3
  41. data/lib/metric_fu/metrics/cane/violations.rb +6 -6
  42. data/lib/metric_fu/metrics/churn/generator.rb +2 -6
  43. data/lib/metric_fu/metrics/churn/hotspot.rb +1 -3
  44. data/lib/metric_fu/metrics/churn/metric.rb +5 -7
  45. data/lib/metric_fu/metrics/flay/generator.rb +7 -11
  46. data/lib/metric_fu/metrics/flay/grapher.rb +5 -6
  47. data/lib/metric_fu/metrics/flay/hotspot.rb +5 -7
  48. data/lib/metric_fu/metrics/flay/metric.rb +5 -7
  49. data/lib/metric_fu/metrics/flog/generator.rb +22 -23
  50. data/lib/metric_fu/metrics/flog/grapher.rb +11 -11
  51. data/lib/metric_fu/metrics/flog/hotspot.rb +3 -5
  52. data/lib/metric_fu/metrics/flog/metric.rb +3 -5
  53. data/lib/metric_fu/metrics/hotspots/analysis/analyzed_problems.rb +0 -1
  54. data/lib/metric_fu/metrics/hotspots/analysis/analyzer_tables.rb +19 -18
  55. data/lib/metric_fu/metrics/hotspots/analysis/grouping.rb +0 -2
  56. data/lib/metric_fu/metrics/hotspots/analysis/groupings.rb +1 -3
  57. data/lib/metric_fu/metrics/hotspots/analysis/problems.rb +4 -6
  58. data/lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb +14 -9
  59. data/lib/metric_fu/metrics/hotspots/analysis/ranking.rb +4 -5
  60. data/lib/metric_fu/metrics/hotspots/analysis/rankings.rb +1 -3
  61. data/lib/metric_fu/metrics/hotspots/analysis/record.rb +3 -5
  62. data/lib/metric_fu/metrics/hotspots/analysis/scoring_strategies.rb +0 -2
  63. data/lib/metric_fu/metrics/hotspots/analysis/table.rb +3 -4
  64. data/lib/metric_fu/metrics/hotspots/generator.rb +3 -6
  65. data/lib/metric_fu/metrics/hotspots/hotspot.rb +13 -13
  66. data/lib/metric_fu/metrics/hotspots/hotspot_analyzer.rb +5 -8
  67. data/lib/metric_fu/metrics/hotspots/metric.rb +1 -3
  68. data/lib/metric_fu/metrics/hotspots/report.html.erb +1 -1
  69. data/lib/metric_fu/metrics/rails_best_practices/generator.rb +10 -12
  70. data/lib/metric_fu/metrics/rails_best_practices/grapher.rb +5 -6
  71. data/lib/metric_fu/metrics/rails_best_practices/metric.rb +1 -3
  72. data/lib/metric_fu/metrics/rcov/external_client.rb +1 -3
  73. data/lib/metric_fu/metrics/rcov/generator.rb +13 -15
  74. data/lib/metric_fu/metrics/rcov/grapher.rb +6 -7
  75. data/lib/metric_fu/metrics/rcov/hotspot.rb +5 -7
  76. data/lib/metric_fu/metrics/rcov/metric.rb +5 -7
  77. data/lib/metric_fu/metrics/rcov/rcov_format_coverage.rb +16 -55
  78. data/lib/metric_fu/metrics/rcov/rcov_line.rb +48 -0
  79. data/lib/metric_fu/metrics/rcov/report.html.erb +2 -2
  80. data/lib/metric_fu/metrics/rcov/simplecov_formatter.rb +10 -11
  81. data/lib/metric_fu/metrics/reek/generator.rb +22 -23
  82. data/lib/metric_fu/metrics/reek/grapher.rb +5 -6
  83. data/lib/metric_fu/metrics/reek/hotspot.rb +5 -7
  84. data/lib/metric_fu/metrics/reek/metric.rb +2 -4
  85. data/lib/metric_fu/metrics/roodi/generator.rb +9 -10
  86. data/lib/metric_fu/metrics/roodi/grapher.rb +5 -6
  87. data/lib/metric_fu/metrics/roodi/hotspot.rb +1 -3
  88. data/lib/metric_fu/metrics/roodi/metric.rb +2 -4
  89. data/lib/metric_fu/metrics/saikuro/generator.rb +23 -27
  90. data/lib/metric_fu/metrics/saikuro/hotspot.rb +1 -3
  91. data/lib/metric_fu/metrics/saikuro/metric.rb +7 -8
  92. data/lib/metric_fu/metrics/saikuro/parsing_element.rb +6 -8
  93. data/lib/metric_fu/metrics/saikuro/report.html.erb +1 -1
  94. data/lib/metric_fu/metrics/saikuro/scratch_file.rb +24 -29
  95. data/lib/metric_fu/metrics/stats/generator.rb +9 -12
  96. data/lib/metric_fu/metrics/stats/grapher.rb +8 -9
  97. data/lib/metric_fu/metrics/stats/hotspot.rb +1 -3
  98. data/lib/metric_fu/metrics/stats/metric.rb +3 -5
  99. data/lib/metric_fu/reporter.rb +1 -1
  100. data/lib/metric_fu/reporting/graphs/graph.rb +8 -12
  101. data/lib/metric_fu/reporting/graphs/grapher.rb +7 -9
  102. data/lib/metric_fu/reporting/result.rb +0 -3
  103. data/lib/metric_fu/run.rb +12 -3
  104. data/lib/metric_fu/tasks/metric_fu.rake +8 -8
  105. data/lib/metric_fu/templates/configuration.rb +2 -5
  106. data/lib/metric_fu/templates/metrics_template.rb +19 -19
  107. data/lib/metric_fu/templates/report.rb +5 -8
  108. data/lib/metric_fu/templates/template.rb +20 -24
  109. data/lib/metric_fu/utility.rb +7 -8
  110. data/lib/metric_fu/version.rb +1 -1
  111. data/metric_fu.gemspec +31 -32
  112. data/spec/cli/helper_spec.rb +7 -14
  113. data/spec/dummy/lib/bad_encoding.rb +1 -1
  114. data/spec/fixtures/coverage-153.rb +2 -2
  115. data/spec/fixtures/coverage.rb +2 -2
  116. data/spec/metric_fu/calculate_spec.rb +3 -3
  117. data/spec/metric_fu/configuration_spec.rb +70 -82
  118. data/spec/metric_fu/data_structures/line_numbers_spec.rb +3 -5
  119. data/spec/metric_fu/data_structures/location_spec.rb +13 -31
  120. data/spec/metric_fu/formatter/configuration_spec.rb +11 -13
  121. data/spec/metric_fu/formatter/html_spec.rb +21 -28
  122. data/spec/metric_fu/formatter/yaml_spec.rb +9 -17
  123. data/spec/metric_fu/formatter_spec.rb +6 -6
  124. data/spec/metric_fu/gem_version_spec.rb +3 -5
  125. data/spec/metric_fu/generator_spec.rb +28 -38
  126. data/spec/metric_fu/loader_spec.rb +1 -3
  127. data/spec/metric_fu/metric_spec.rb +17 -21
  128. data/spec/metric_fu/metrics/cane/configuration_spec.rb +8 -8
  129. data/spec/metric_fu/metrics/cane/generator_spec.rb +26 -29
  130. data/spec/metric_fu/metrics/churn/configuration_spec.rb +6 -8
  131. data/spec/metric_fu/metrics/churn/generator_spec.rb +6 -11
  132. data/spec/metric_fu/metrics/flay/configuration_spec.rb +6 -8
  133. data/spec/metric_fu/metrics/flay/generator_spec.rb +36 -37
  134. data/spec/metric_fu/metrics/flay/grapher_spec.rb +2 -2
  135. data/spec/metric_fu/metrics/flog/configuration_spec.rb +11 -13
  136. data/spec/metric_fu/metrics/flog/generator_spec.rb +29 -31
  137. data/spec/metric_fu/metrics/flog/grapher_spec.rb +8 -10
  138. data/spec/metric_fu/metrics/hotspots/analysis/analyzed_problems_spec.rb +18 -24
  139. data/spec/metric_fu/metrics/hotspots/analysis/analyzer_tables_spec.rb +12 -17
  140. data/spec/metric_fu/metrics/hotspots/analysis/ranking_spec.rb +2 -6
  141. data/spec/metric_fu/metrics/hotspots/analysis/rankings_spec.rb +5 -14
  142. data/spec/metric_fu/metrics/hotspots/analysis/table_spec.rb +1 -3
  143. data/spec/metric_fu/metrics/hotspots/generator_spec.rb +6 -8
  144. data/spec/metric_fu/metrics/hotspots/hotspot_analyzer_spec.rb +1 -3
  145. data/spec/metric_fu/metrics/hotspots/hotspot_spec.rb +4 -5
  146. data/spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb +6 -10
  147. data/spec/metric_fu/metrics/rails_best_practices/generator_spec.rb +2 -3
  148. data/spec/metric_fu/metrics/rails_best_practices/grapher_spec.rb +3 -3
  149. data/spec/metric_fu/metrics/rcov/configuration_spec.rb +20 -22
  150. data/spec/metric_fu/metrics/rcov/generator_spec.rb +6 -10
  151. data/spec/metric_fu/metrics/rcov/grapher_spec.rb +2 -2
  152. data/spec/metric_fu/metrics/rcov/hotspot_spec.rb +8 -8
  153. data/spec/metric_fu/metrics/rcov/rcov_line_spec.rb +89 -0
  154. data/spec/metric_fu/metrics/rcov/simplecov_formatter_spec.rb +31 -33
  155. data/spec/metric_fu/metrics/reek/configuration_spec.rb +6 -6
  156. data/spec/metric_fu/metrics/reek/generator_spec.rb +19 -20
  157. data/spec/metric_fu/metrics/reek/grapher_spec.rb +4 -4
  158. data/spec/metric_fu/metrics/roodi/configuration_spec.rb +7 -9
  159. data/spec/metric_fu/metrics/roodi/generator_spec.rb +3 -3
  160. data/spec/metric_fu/metrics/roodi/grapher_spec.rb +2 -2
  161. data/spec/metric_fu/metrics/saikuro/configuration_spec.rb +18 -19
  162. data/spec/metric_fu/metrics/saikuro/generator_spec.rb +7 -7
  163. data/spec/metric_fu/metrics/stats/generator_spec.rb +9 -9
  164. data/spec/metric_fu/metrics/stats/grapher_spec.rb +2 -2
  165. data/spec/metric_fu/reporter_spec.rb +3 -4
  166. data/spec/metric_fu/reporting/graphs/graph_spec.rb +1 -4
  167. data/spec/metric_fu/reporting/graphs/grapher_spec.rb +5 -5
  168. data/spec/metric_fu/reporting/result_spec.rb +9 -11
  169. data/spec/metric_fu/run_spec.rb +18 -32
  170. data/spec/metric_fu/templates/configuration_spec.rb +28 -34
  171. data/spec/metric_fu/templates/metrics_template_spec.rb +11 -0
  172. data/spec/metric_fu/templates/report_spec.rb +4 -4
  173. data/spec/metric_fu/templates/template_spec.rb +62 -48
  174. data/spec/metric_fu/utility_spec.rb +2 -2
  175. data/spec/metric_fu_spec.rb +5 -7
  176. data/spec/shared/configured.rb +9 -11
  177. data/spec/shared/test_coverage.rb +5 -9
  178. data/spec/spec_helper.rb +9 -9
  179. data/spec/support/deferred_garbaged_collection.rb +1 -2
  180. data/spec/support/matcher_create_file.rb +2 -4
  181. data/spec/support/matcher_create_files.rb +2 -4
  182. data/spec/support/suite.rb +3 -3
  183. data/spec/support/test_fixtures.rb +5 -7
  184. data/spec/support/timeout.rb +1 -1
  185. data/spec/support/usage_test.rb +23 -24
  186. data/spec/usage_test_spec.rb +18 -20
  187. metadata +12 -2
  188. metadata.gz.sig +0 -0
@@ -1,8 +1,7 @@
1
- require 'spec_helper'
2
- MetricFu.metrics_require { 'hotspots/analysis/analyzer_tables' }
1
+ require "spec_helper"
2
+ MetricFu.metrics_require { "hotspots/analysis/analyzer_tables" }
3
3
 
4
4
  describe MetricFu::AnalyzerTables do
5
-
6
5
  before do
7
6
  enable_hotspots
8
7
  end
@@ -13,7 +12,7 @@ describe MetricFu::AnalyzerTables do
13
12
  common_columns = %w{metric}
14
13
  granularities = %w{file_path class_name method_name}
15
14
  tool_analyzers = MetricFu::Hotspot.analyzers
16
- analyzer_columns = common_columns + granularities + tool_analyzers.map{|analyzer| analyzer.columns}.flatten
15
+ analyzer_columns = common_columns + granularities + tool_analyzers.map(&:columns).flatten
17
16
 
18
17
  analyzer_tables = MetricFu::AnalyzerTables.new(analyzer_columns)
19
18
  tool_analyzers.each do |analyzer|
@@ -28,31 +27,28 @@ describe MetricFu::AnalyzerTables do
28
27
  end
29
28
 
30
29
  context "with Stats data" do
31
-
32
30
  before do
33
31
  @result_hash = HOTSPOT_DATA["stats.yml"]
34
32
  @table = analyzer_table(@result_hash).table
35
33
  end
36
34
 
37
35
  it "should have codeLOC" do
38
- row = @table.find{|row| row['stat_name'] == :codeLOC}
39
- expect(row['stat_value']).to eq(4222)
36
+ row = @table.find { |row| row["stat_name"] == :codeLOC }
37
+ expect(row["stat_value"]).to eq(4222)
40
38
  end
41
39
 
42
40
  it "should have testLOC" do
43
- row = @table.find{|row| row['stat_name'] == :testLOC}
44
- expect(row['stat_value']).to eq(2111)
41
+ row = @table.find { |row| row["stat_name"] == :testLOC }
42
+ expect(row["stat_value"]).to eq(2111)
45
43
  end
46
44
 
47
45
  it "should have code_to_test_ratio" do
48
- row = @table.find{|row| row['stat_name'] == :code_to_test_ratio}
49
- expect(row['stat_value']).to eq(2)
46
+ row = @table.find { |row| row["stat_name"] == :code_to_test_ratio }
47
+ expect(row["stat_value"]).to eq(2)
50
48
  end
51
-
52
49
  end
53
50
 
54
51
  context "with three different path representations of file (from Saikuro, Flog, and Reek)" do
55
-
56
52
  before do
57
53
  @result_hash = HOTSPOT_DATA["three_metrics_on_same_file.yml"]
58
54
  @table = analyzer_table(@result_hash).table
@@ -60,17 +56,16 @@ describe MetricFu::AnalyzerTables do
60
56
 
61
57
  specify "all records should have full file_path" do
62
58
  @table.each do |row|
63
- expect(row['file_path']).to eq('lib/client/client.rb')
59
+ expect(row["file_path"]).to eq("lib/client/client.rb")
64
60
  end
65
61
  end
66
62
 
67
63
  specify "all records should have class name" do
68
- expect(@table.select{|rows| rows.fetch(:class_name, :no_key) == nil }.size).to eq(0)
64
+ expect(@table.select { |rows| rows.fetch(:class_name, :no_key) == nil }.size).to eq(0)
69
65
  end
70
66
 
71
67
  specify "one record should not have method name" do
72
- expect(@table.select{|rows| rows.fetch(:method_name, :no_key) == nil }.size).to eq(0)
68
+ expect(@table.select { |rows| rows.fetch(:method_name, :no_key) == nil }.size).to eq(0)
73
69
  end
74
-
75
70
  end
76
71
  end
@@ -1,16 +1,14 @@
1
1
  require "spec_helper"
2
- MetricFu.metrics_require { 'hotspots/analysis/ranking' }
2
+ MetricFu.metrics_require { "hotspots/analysis/ranking" }
3
3
 
4
4
  describe MetricFu::Ranking do
5
-
6
5
  context "with many items" do
7
-
8
6
  specify "#top" do
9
7
  ranking = Ranking.new
10
8
  ranking[:a] = 10
11
9
  ranking[:b] = 50
12
10
  ranking[:c] = 1
13
- expect(ranking.top).to eq([:b,:a, :c])
11
+ expect(ranking.top).to eq([:b, :a, :c])
14
12
  end
15
13
 
16
14
  specify "lowest item is at 0 percentile" do
@@ -28,7 +26,5 @@ describe MetricFu::Ranking do
28
26
  ranking[:d] = 5
29
27
  expect(ranking.percentile(:b)).to eq(0.75)
30
28
  end
31
-
32
29
  end
33
-
34
30
  end
@@ -1,8 +1,7 @@
1
- require 'spec_helper'
2
- MetricFu.metrics_require { 'hotspots/analysis/rankings' }
1
+ require "spec_helper"
2
+ MetricFu.metrics_require { "hotspots/analysis/rankings" }
3
3
 
4
4
  describe MetricFu::HotspotRankings do
5
-
6
5
  before do
7
6
  enable_hotspots
8
7
  end
@@ -14,7 +13,7 @@ describe MetricFu::HotspotRankings do
14
13
  common_columns = %w{metric}
15
14
  granularities = %w{file_path class_name method_name}
16
15
  tool_analyzers = MetricFu::Hotspot.analyzers
17
- analyzer_columns = common_columns + granularities + tool_analyzers.map{|analyzer| analyzer.columns}.flatten
16
+ analyzer_columns = common_columns + granularities + tool_analyzers.map(&:columns).flatten
18
17
 
19
18
  analyzer_tables = MetricFu::AnalyzerTables.new(analyzer_columns)
20
19
  tool_analyzers.each do |analyzer|
@@ -30,8 +29,8 @@ describe MetricFu::HotspotRankings do
30
29
  context "with several types of data" do
31
30
  it "gives all files, in order, from worst to best" do
32
31
  expected = [
33
- "lib/client/client.rb",
34
- "lib/client/foo.rb"]
32
+ "lib/client/client.rb",
33
+ "lib/client/foo.rb"]
35
34
  expect(rankings(result_hash).worst_files).to eq(expected)
36
35
  end
37
36
  def result_hash
@@ -39,7 +38,6 @@ describe MetricFu::HotspotRankings do
39
38
  end
40
39
  end
41
40
  context "with Reek data" do
42
-
43
41
  before do
44
42
  @result_hash = HOTSPOT_DATA["reek.yml"]
45
43
  end
@@ -55,10 +53,8 @@ describe MetricFu::HotspotRankings do
55
53
  it "gives worst file" do
56
54
  expect(rankings(@result_hash).worst_files[0]).to eq("lib/client/client.rb")
57
55
  end
58
-
59
56
  end
60
57
  context "with Saikuro data" do
61
-
62
58
  before do
63
59
  @result_hash = HOTSPOT_DATA["saikuro.yml"]
64
60
  end
@@ -70,10 +66,8 @@ describe MetricFu::HotspotRankings do
70
66
  it "gives worst class" do
71
67
  expect(rankings(@result_hash).worst_classes[0]).to eq("Bitly")
72
68
  end
73
-
74
69
  end
75
70
  context "with Flog data" do
76
-
77
71
  before do
78
72
  @result_hash = HOTSPOT_DATA["flog.yml"]
79
73
  end
@@ -89,11 +83,9 @@ describe MetricFu::HotspotRankings do
89
83
  it "gives worst file" do
90
84
  expect(rankings(@result_hash).worst_files[0]).to eq("lib/generators/rcov.rb:57")
91
85
  end
92
-
93
86
  end
94
87
 
95
88
  context "with Roodi data" do
96
-
97
89
  before do
98
90
  @result_hash = HOTSPOT_DATA["roodi.yml"]
99
91
  end
@@ -101,6 +93,5 @@ describe MetricFu::HotspotRankings do
101
93
  it "gives worst file" do
102
94
  expect(rankings(@result_hash).worst_files[0]).to eq("lib/client/client.rb")
103
95
  end
104
-
105
96
  end
106
97
  end
@@ -1,8 +1,6 @@
1
1
  require "spec_helper"
2
- MetricFu.metrics_require { 'hotspots/analysis/table' }
2
+ MetricFu.metrics_require { "hotspots/analysis/table" }
3
3
 
4
4
  describe MetricFu::Table do
5
-
6
5
  it "needs tests"
7
-
8
6
  end
@@ -1,14 +1,13 @@
1
1
  require "spec_helper"
2
- MetricFu.metrics_require { 'hotspots/generator' }
2
+ MetricFu.metrics_require { "hotspots/generator" }
3
3
 
4
4
  describe MetricFu::HotspotsGenerator do
5
5
  describe "analyze method" do
6
-
7
6
  it "should be empty on error" do
8
7
  hotspots = MetricFu::HotspotsGenerator.new
9
8
  hotspots.instance_variable_set(:@analyzer, nil)
10
9
  result = hotspots.analyze
11
- expect(result).to eq({:files => [], :classes => [], :methods => []})
10
+ expect(result).to eq(files: [], classes: [], methods: [])
12
11
  end
13
12
 
14
13
  it "should put the changes into a hash" do
@@ -20,13 +19,13 @@ describe MetricFu::HotspotsGenerator do
20
19
  expect(result.keys).to eq(expected.keys)
21
20
 
22
21
  # for each granularity's location details
23
- result.each do |granularity,location_details|
22
+ result.each do |granularity, location_details|
24
23
  # map 2d array for this granularity of [details, location]
25
- expected_result = expected.fetch(granularity).map {|ld| [ld.fetch('details'), ld.fetch('location')] }
24
+ expected_result = expected.fetch(granularity).map { |ld| [ld.fetch("details"), ld.fetch("location")] }
26
25
  # verify all the location details for this granularity match elements of expected_result
27
26
  location_details.each do |location_detail|
28
- location = location_detail.fetch('location')
29
- details = location_detail.fetch('details')
27
+ location = location_detail.fetch("location")
28
+ details = location_detail.fetch("details")
30
29
  # get the location_detail array where the where the locations (second element) match
31
30
  expected_location_details = expected_result.rassoc(location)
32
31
  # get the details (first element) from the expected location_details array
@@ -44,5 +43,4 @@ describe MetricFu::HotspotsGenerator do
44
43
  expect(hotspots.analyze.keys).to eq([:files, :classes, :methods])
45
44
  end
46
45
  end
47
-
48
46
  end
@@ -1,12 +1,10 @@
1
1
  require "spec_helper"
2
- MetricFu.metrics_require { 'hotspots/hotspot_analyzer' }
2
+ MetricFu.metrics_require { "hotspots/hotspot_analyzer" }
3
3
 
4
4
  describe MetricFu::HotspotAnalyzer do
5
-
6
5
  it "should have its own tests regarding how it orchestrates the analysis of results, rankings, tables, and analyzed_problems"
7
6
 
8
7
  it "#hotspots aka worst_items"
9
8
 
10
9
  it "#analyzed_problems"
11
-
12
10
  end
@@ -1,16 +1,15 @@
1
- require 'spec_helper'
2
- MetricFu.metrics_require { 'hotspots/hotspot' }
1
+ require "spec_helper"
2
+ MetricFu.metrics_require { "hotspots/hotspot" }
3
3
 
4
4
  describe MetricFu::Hotspot do
5
-
6
5
  before do
7
6
  enable_hotspots
8
7
  end
9
8
 
10
9
  it "returns an array of of the analyzers that subclass it" do
11
10
  expected_analyzers = [ReekHotspot, RoodiHotspot,
12
- FlogHotspot, ChurnHotspot, SaikuroHotspot,
13
- FlayHotspot, StatsHotspot, RcovHotspot]
11
+ FlogHotspot, ChurnHotspot, SaikuroHotspot,
12
+ FlayHotspot, StatsHotspot, RcovHotspot]
14
13
 
15
14
  expect(MetricFu::Hotspot.analyzers.size).to eq(expected_analyzers.size)
16
15
  end
@@ -1,11 +1,9 @@
1
- require 'spec_helper'
2
- require 'shared/configured'
3
-
4
- describe MetricFu::Configuration, 'for rails_best_practices' do
5
- it_behaves_like 'configured' do
1
+ require "spec_helper"
2
+ require "shared/configured"
6
3
 
4
+ describe MetricFu::Configuration, "for rails_best_practices" do
5
+ it_behaves_like "configured" do
7
6
  describe "if #rails? is true " do
8
-
9
7
  before(:each) do
10
8
  @config = MetricFu.configuration
11
9
  allow(@config).to receive(:rails?).and_return(true)
@@ -23,12 +21,11 @@ describe MetricFu::Configuration, 'for rails_best_practices' do
23
21
  end
24
22
 
25
23
  it "should set @rails_best_practices to {}" do
26
- load_metric 'rails_best_practices'
24
+ load_metric "rails_best_practices"
27
25
  expect(MetricFu::Metric.get_metric(:rails_best_practices).run_options).to eql({})
28
26
  end
29
27
  end
30
28
 
31
-
32
29
  describe "if #rails? is false " do
33
30
  before(:each) do
34
31
  get_new_config
@@ -39,9 +36,8 @@ describe MetricFu::Configuration, 'for rails_best_practices' do
39
36
  end
40
37
 
41
38
  it "should set the registered code_dirs to ['lib']" do
42
- expect(directory('code_dirs')).to eq(['lib'])
39
+ expect(directory("code_dirs")).to eq(["lib"])
43
40
  end
44
41
  end
45
-
46
42
  end
47
43
  end
@@ -1,12 +1,11 @@
1
1
  require "spec_helper"
2
- MetricFu.metrics_require { 'rails_best_practices/generator' }
2
+ MetricFu.metrics_require { "rails_best_practices/generator" }
3
3
 
4
4
  describe RailsBestPracticesGenerator do
5
-
6
5
  break if metric_not_activated?(:rails_best_practices)
7
6
 
8
7
  describe "emit method" do
9
- let(:analyzer) { ::RailsBestPractices::Analyzer.new('.', { 'silent' => true }) }
8
+ let(:analyzer) { ::RailsBestPractices::Analyzer.new(".", "silent" => true) }
10
9
  context "RailsBestPractices provides the expected API" do
11
10
  it { expect(analyzer).to respond_to :analyze }
12
11
  it { expect(analyzer).to respond_to :errors }
@@ -1,5 +1,5 @@
1
1
  require "spec_helper"
2
- MetricFu.metrics_require { 'rails_best_practices/grapher' }
2
+ MetricFu.metrics_require { "rails_best_practices/grapher" }
3
3
 
4
4
  describe RailsBestPracticesGrapher do
5
5
  before :each do
@@ -50,11 +50,11 @@ describe RailsBestPracticesGrapher do
50
50
 
51
51
  it "should push 0 to rails_best_practices_count when no problems were found" do
52
52
  expect(@stats_grapher.rails_best_practices_count).to receive(:push).with(0)
53
- @stats_grapher.get_metrics({ :rails_best_practices => {} }, @date)
53
+ @stats_grapher.get_metrics({ rails_best_practices: {} }, @date)
54
54
  end
55
55
 
56
56
  it "should update labels with the date" do
57
- expect(@stats_grapher.labels).to receive(:update).with({ 0 => "01022003" })
57
+ expect(@stats_grapher.labels).to receive(:update).with(0 => "01022003")
58
58
  @stats_grapher.get_metrics(@metrics, @date)
59
59
  end
60
60
  end
@@ -1,30 +1,28 @@
1
- require 'spec_helper'
2
- require 'shared/configured'
3
-
4
- describe MetricFu::Configuration, 'for rcov' do
5
- it_behaves_like 'configured' do
1
+ require "spec_helper"
2
+ require "shared/configured"
6
3
 
4
+ describe MetricFu::Configuration, "for rcov" do
5
+ it_behaves_like "configured" do
7
6
  it "should set rcov run_options" do
8
- load_metric 'rcov'
7
+ load_metric "rcov"
9
8
  expect(
10
9
  MetricFu::Metric.get_metric(:rcov).run_options
11
10
  ).to eq(
12
- {
13
- :environment => 'test',
14
- :external => nil,
15
- :test_files => Dir['{spec,test}/**/*_{spec,test}.rb'],
16
- :rcov_opts => [
17
- "--sort coverage",
18
- "--no-html",
19
- "--text-coverage",
20
- "--no-color",
21
- "--profile",
22
- "--exclude-only '.*'",
23
- '--include-file "\Aapp,\Alib"',
24
- "-Ispec"
25
- ],
26
- })
27
- end
28
11
 
12
+ environment: "test",
13
+ external: nil,
14
+ test_files: Dir["{spec,test}/**/*_{spec,test}.rb"],
15
+ rcov_opts: [
16
+ "--sort coverage",
17
+ "--no-html",
18
+ "--text-coverage",
19
+ "--no-color",
20
+ "--profile",
21
+ "--exclude-only '.*'",
22
+ '--include-file "\Aapp,\Alib"',
23
+ "-Ispec"
24
+ ],
25
+ )
26
+ end
29
27
  end
30
28
  end
@@ -1,26 +1,22 @@
1
1
  require "spec_helper"
2
- MetricFu.metrics_require { 'rcov/generator' }
3
- require 'shared/test_coverage'
2
+ MetricFu.metrics_require { "rcov/generator" }
3
+ require "shared/test_coverage"
4
4
 
5
5
  describe MetricFu::RcovGenerator, "configured as rcov" do
6
-
7
6
  it_behaves_like "rcov test coverage generator", :rcov do
8
-
9
7
  describe "emit" do
10
8
  before :each do
11
- options = {:external => nil}
9
+ options = { external: nil }
12
10
  @test_coverage = MetricFu::RcovGenerator.new(@default_options.merge(options))
13
11
  end
14
12
 
15
13
  it "should set the RAILS_ENV" do
16
- expect(MetricFu::Utility).to receive(:rm_rf).with(MetricFu::RcovGenerator.metric_directory, :verbose => false)
14
+ expect(MetricFu::Utility).to receive(:rm_rf).with(MetricFu::RcovGenerator.metric_directory, verbose: false)
17
15
  expect(MetricFu::Utility).to receive(:mkdir_p).with(MetricFu::RcovGenerator.metric_directory)
18
- options = {:environment => 'metrics', :external => nil}
16
+ options = { environment: "metrics", external: nil }
19
17
  @test_coverage = MetricFu::RcovGenerator.new(@default_options.merge(options))
20
- expect(@test_coverage.command).to include('RAILS_ENV=metrics')
18
+ expect(@test_coverage.command).to include("RAILS_ENV=metrics")
21
19
  end
22
20
  end
23
-
24
21
  end
25
-
26
22
  end
@@ -1,5 +1,5 @@
1
1
  require "spec_helper"
2
- MetricFu.metrics_require { 'rcov/grapher' }
2
+ MetricFu.metrics_require { "rcov/grapher" }
3
3
 
4
4
  describe RcovGrapher do
5
5
  before :each do
@@ -49,7 +49,7 @@ describe RcovGrapher do
49
49
  end
50
50
 
51
51
  it "should update labels with the date" do
52
- expect(@rcov_grapher.labels).to receive(:update).with({ 0 => "1/2" })
52
+ expect(@rcov_grapher.labels).to receive(:update).with(0 => "1/2")
53
53
  @rcov_grapher.get_metrics(@metrics, @date)
54
54
  end
55
55
  end