lib/pdd/rule/duplicates.rb in pdd-0.15.4 vs lib/pdd/rule/duplicates.rb in pdd-0.16
- old
+ new
@@ -31,18 +31,19 @@
@xml = xml
@max = max.to_i
end
def errors
- @xml.xpath('//puzzle')
+ @xml
+ .xpath('//puzzle')
.group_by { |p| p.xpath('body/text()').to_s }
.map do |_, puzzles|
next nil if puzzles.count <= @max
"there are #{puzzles.count} duplicate(s) of the same puzzle: " +
- puzzles.map do |p|
- "#{p.xpath('file/text()')}:#{p.xpath('lines/text()')}"
- end.join(', ') +
- ", while maximum #{@max} duplicate is allowed"
+ puzzles.map do |p|
+ "#{p.xpath('file/text()')}:#{p.xpath('lines/text()')}"
+ end.join(', ') +
+ ", while maximum #{@max} duplicate is allowed"
end.compact
end
end
end
end