lib/rubocop/git/diff_parser.rb in rubocop-git2-0.1.4 vs lib/rubocop/git/diff_parser.rb in rubocop-git2-0.1.5
- old
+ new
@@ -1,31 +1,25 @@
-module RuboCop
- module Git
- class DiffParser
- class << self
- def parse(diff)
- new.parse(diff)
- end
- end
+class RuboCop::Git::DiffParser
+ def self.parse(diff)
+ new.parse(diff)
+ end
- def parse(diff)
- files = []
- in_patch = false
+ def parse(diff) # rubocop:disable Metrics/MethodLength
+ files = []
+ in_patch = false
- diff.each_line do |line|
- case line
- when /^diff --git/
- in_patch = false
- when %r{^\+{3} b/(?<path>[^\t\n\r]+)}
- files << PseudoResource.new(Regexp.last_match[:path])
- when /^@@/
- in_patch = true
- end
-
- files.last.patch << line if in_patch
- end
-
- files
+ diff.each_line do |line|
+ case line
+ when /^diff --git/
+ in_patch = false
+ when %r{^\+{3} b/(?<path>[^\t\n\r]+)}
+ files << RuboCop::Git::PseudoResource.new(Regexp.last_match[:path])
+ when /^@@/
+ in_patch = true
end
+
+ files.last.patch << line if in_patch
end
+
+ files
end
end