Method: PDD::Rule::MaxDuplicates#errors
- Defined in:
- lib/pdd/rule/duplicates.rb
#errors ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/pdd/rule/duplicates.rb', line 32 def errors @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" end.compact end |