onceover 3.13.3 → 3.13.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onceover/controlrepo.rb +3 -3
- data/lib/onceover/rspec/formatters.rb +23 -9
- data/onceover.gemspec +1 -1
- data/templates/error_summary.yaml.erb +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6449e2a04348ed1fa97a08d0e452a7bd612eb45bf807aaddd4c32b2a22a6b1c6
|
4
|
+
data.tar.gz: 7d93dcf1e360f4a43aa36ace53db60009a7aa0062a734f9472ca14825c59db49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '038b4af7edbfd3cf592c425c3de222a3166be32d301999948cb93e2fc62555b3a349cfd412a918aa4a4457d819bc47b80eebb3e1eb007c14f0424352783ec95f'
|
7
|
+
data.tar.gz: 727fb90aec81e72997768799dabd11860423413b176de03e94fdf1d01e0d4451efd7e68aeb61b13d9c60ca8d1c7372ed013b1e34eeb5ffd70f907ceaaf5971f1
|
data/lib/onceover/controlrepo.rb
CHANGED
@@ -104,7 +104,7 @@ class Onceover
|
|
104
104
|
|
105
105
|
@onceover_yaml = ENV['ONCEOVER_YAML'] || opts[:onceover_yaml] || File.expand_path("#{@root}/spec/onceover.yaml")
|
106
106
|
|
107
|
-
if File.
|
107
|
+
if File.exist?(@onceover_yaml) && _data = YAML.load_file(@onceover_yaml)
|
108
108
|
opts.merge!(_data.fetch('opts',{})||{})
|
109
109
|
end
|
110
110
|
opts.fetch(:facts_dir,'').sub!(%r{^[^/.].+} ){|path| File.expand_path(path, @root)}
|
@@ -475,7 +475,7 @@ class Onceover
|
|
475
475
|
|
476
476
|
# Add .onceover to Gitignore
|
477
477
|
gitignore_path = File.expand_path('.gitignore', repo.root)
|
478
|
-
if File.
|
478
|
+
if File.exist? gitignore_path
|
479
479
|
gitignore_content = (File.open(gitignore_path, 'r') {|f| f.read }).split("\n")
|
480
480
|
message = "#{'changed'.green}"
|
481
481
|
else
|
@@ -567,7 +567,7 @@ class Onceover
|
|
567
567
|
|
568
568
|
def self.init_write_file(contents, out_file)
|
569
569
|
create_dirs_and_log(File.dirname(out_file))
|
570
|
-
if File.
|
570
|
+
if File.exist?(out_file)
|
571
571
|
puts "#{'skipped'.yellow} #{Pathname.new(out_file).relative_path_from(Pathname.new(Dir.pwd)).to_s} #{'(exists)'.yellow}"
|
572
572
|
else
|
573
573
|
File.open(out_file,'w') {|f| f.write(contents)}
|
@@ -59,7 +59,7 @@ class OnceoverFormatter
|
|
59
59
|
# Put some spacing before the results
|
60
60
|
@output << "\n\n\n"
|
61
61
|
|
62
|
-
failures.each do |
|
62
|
+
failures.each do |name, errors|
|
63
63
|
@output << Onceover::Controlrepo.evaluate_template('error_summary.yaml.erb', binding)
|
64
64
|
end
|
65
65
|
|
@@ -74,20 +74,34 @@ class OnceoverFormatter
|
|
74
74
|
|
75
75
|
# Further group by error
|
76
76
|
grouped.each do |role, failures|
|
77
|
-
grouped[role] = failures.
|
77
|
+
grouped[role] = failures.group_by { |f| f.metadata[:execution_result].exception.to_s }
|
78
78
|
end
|
79
79
|
|
80
80
|
# Extract the errors and remove all RSpec objects
|
81
81
|
grouped.each do |role, failures|
|
82
|
-
grouped[role] = {
|
83
|
-
name: role,
|
84
|
-
errors: failures.map { |f| parse_errors(f.metadata[:execution_result].exception.to_s)}.flatten,
|
85
|
-
}
|
82
|
+
grouped[role] = failures.map { |_description, fails| extract_failure_data(fails)}.flatten
|
86
83
|
end
|
87
84
|
|
88
85
|
grouped
|
89
86
|
end
|
90
87
|
|
88
|
+
# Extaracts data out of RSpec failres
|
89
|
+
def extract_failure_data(fails)
|
90
|
+
# The only difference between these failures should be the factsets that it
|
91
|
+
# failed on. Extract that list then just use the first failure for the rest
|
92
|
+
# of the data as it should be the same
|
93
|
+
metadata = fails[0].metadata
|
94
|
+
raw_error = metadata[:execution_result].exception.to_s
|
95
|
+
factsets = fails.map { |f| f.metadata[:example_group][:description].gsub('using fact set ','') }
|
96
|
+
results = parse_errors(raw_error)
|
97
|
+
# Add the details of the factsets tio each result
|
98
|
+
results.map do |r|
|
99
|
+
r[:factsets] = factsets
|
100
|
+
r
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Parses information out of a string error
|
91
105
|
def parse_errors(raw_error)
|
92
106
|
# Check if the error is a compilation error
|
93
107
|
match = COMPILATION_ERROR.match(raw_error)
|
@@ -247,9 +261,9 @@ class OnceoverFormatterParallel < OnceoverFormatter
|
|
247
261
|
files = Dir["#{directory}/*.yaml"]
|
248
262
|
|
249
263
|
# Merge data
|
250
|
-
|
264
|
+
roles = files.reduce({}) do |errs, file|
|
251
265
|
# Read all files and merge them
|
252
|
-
errs.merge(YAML.load(File.read(file))) # rubocop:disable Security/YAMLLoad
|
266
|
+
errs.merge(YAML.load(File.read(file))) {|key, oldval, newval| [oldval, newval].flatten }# rubocop:disable Security/YAMLLoad
|
253
267
|
end
|
254
268
|
|
255
269
|
# Delete files from the disk
|
@@ -258,7 +272,7 @@ class OnceoverFormatterParallel < OnceoverFormatter
|
|
258
272
|
@output << "\n\n\n"
|
259
273
|
|
260
274
|
# Output errors
|
261
|
-
|
275
|
+
roles.each do |name, errors|
|
262
276
|
@output << Onceover::Controlrepo.evaluate_template('error_summary.yaml.erb', binding)
|
263
277
|
end
|
264
278
|
@output << "\n"
|
data/onceover.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "onceover"
|
7
|
-
s.version = "3.13.
|
7
|
+
s.version = "3.13.4"
|
8
8
|
s.authors = ["Dylan Ratcliffe"]
|
9
9
|
s.email = ["dylan.ratcliffe@puppet.com"]
|
10
10
|
s.homepage = "https://github.com/dylanratcliffe/onceover"
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= bold(
|
1
|
+
<%= bold(name) %>: <%= red('failed') %>
|
2
2
|
errors:
|
3
|
-
<%
|
3
|
+
<% errors.each do |error| -%>
|
4
4
|
<%= red(error[:text]) %>
|
5
5
|
<% if error[:file] -%>
|
6
6
|
file: <%= bold(error[:file]) %>
|
@@ -11,4 +11,7 @@
|
|
11
11
|
<% if error[:column] -%>
|
12
12
|
column: <%= bold(error[:column]) %>
|
13
13
|
<% end -%>
|
14
|
+
<% if error[:factsets] -%>
|
15
|
+
factsets: <%= bold(error[:factsets].join(', ')) %>
|
16
|
+
<% end -%>
|
14
17
|
<% end -%>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onceover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.13.
|
4
|
+
version: 3.13.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Ratcliffe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|