lib/pronto/flay.rb in pronto-flay-0.1.1 vs lib/pronto/flay.rb in pronto-flay-0.2.0
- old
+ new
@@ -5,11 +5,11 @@
class Flay < Runner
def initialize
@flay = ::Flay.new
end
- def run(patches)
+ def run(patches, _)
return [] unless patches
ruby_patches = patches.select { |patch| patch.additions > 0 }
.select { |patch| ruby_file?(patch.new_file_full_path) }
@@ -26,21 +26,21 @@
def messages_for(ruby_patches)
nodes.map do |node|
patch = patch_for_node(ruby_patches, node)
- line = patch.added_lines.select do |added_line|
+ line = patch.added_lines.find do |added_line|
added_line.new_lineno == node.line
- end.first
+ end
new_message(line, node) if line
end.flatten.compact
end
def patch_for_node(ruby_patches, node)
- ruby_patches.select do |patch|
+ ruby_patches.find do |patch|
patch.new_file_full_path.to_s == node.file.path
- end.first
+ end
end
def new_message(line, node)
hash = node.structural_hash
Message.new(line.patch.delta.new_file[:path], line, level(hash), message(hash))