lib/rubocop/git/runner.rb in rubocop-git-kjanoudi-0.1.3 vs lib/rubocop/git/runner.rb in rubocop-git-kjanoudi-0.1.4
- old
+ new
@@ -7,12 +7,19 @@
def run(options)
options = Options.new(options) unless options.is_a?(Options)
@options = options
@files = DiffParser.parse(git_diff(options))
+ rubo_comment = RuboComment.new(@files)
+ #adds comments to files and reparses diff after changes are made
+ rubo_comment.add_comments
+ @files = DiffParser.parse(git_diff(options))
+
display_violations($stdout)
+ #removes comments after rubocop processing
+ rubo_comment.remove_comments
exit(1) if violations.any?
end
private
@@ -43,10 +50,10 @@
end
def display_violations(io)
formatter = RuboCop::Formatter::ClangStyleFormatter.new(io)
formatter.started(nil)
-
+
violations.map do |violation|
formatter.file_finished(
violation.filename,
violation.offenses.compact.sort.freeze
)