danger-checkstyle_reports 0.0.1.pre.rc01 → 0.0.1.pre.rc02

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 751e1db74791e5488e74ba43fbbd4a4125e0a033
4
- data.tar.gz: 8f8b9f24f81c02b16a65cf04d0d52674f7ac1970
3
+ metadata.gz: 67892b7eb60977e6c050da2266fc331253ae55fe
4
+ data.tar.gz: a9d4747c60bb21cc952a1fdb072bbfe241ef766c
5
5
  SHA512:
6
- metadata.gz: 0dce91816516e76099b719e71f0523ef22184771f39da119812675ccdd74e6526969cf25d5456701f08f138bc018de06d8c2704cd4f9ac106948bf8d9f478a19
7
- data.tar.gz: e6e89db45a1dc04bf055aff2b05e3b3b683ed1d926a84a28a319dd3d8053f610bd774f5e86a0db627bcb28742d1aaef07af678148a1b14309528abcd533e286a
6
+ metadata.gz: c2004681d7131c1f168f3b989d6a7b21ba2be4bf6e2bb5ba23a819f7fd2b458a636c305940644669e4650265846a202578a5a0e7ade993d9eaf18a0e8b34a33c
7
+ data.tar.gz: bdaa5991b0674489946a9ebb379e1be42b257a235cd5529f5fe879f47814960880eec9ed12189c2bca5d9394d975b4a47189c99ef696ec8a6c5d5157090cd4a3
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CheckstyleReports
4
- VERSION = "0.0.1-rc01"
4
+ VERSION = "0.0.1-rc02"
5
5
  end
@@ -64,7 +64,7 @@ module Danger
64
64
  # Report errors based on the given xml file if needed
65
65
  #
66
66
  # @param [String] xml_file which contains checkstyle results to be reported
67
- # @param [Boolean] modified_files_only which is a flag to filter out non-modified files
67
+ # @param [Boolean] modified_files_only which is a flag to filter out non-added/non-modified files
68
68
  # @return [void] void
69
69
  def report(xml_file, modified_files_only: true)
70
70
  raise "File path must not be empty" if xml_file.empty?
@@ -80,7 +80,7 @@ module Danger
80
80
 
81
81
  @reported_files = files.map(&:relative_path)
82
82
 
83
- do_comment(files, modified_files_only) unless files.empty?
83
+ do_comment(files) unless files.empty?
84
84
  end
85
85
 
86
86
  private
@@ -88,7 +88,7 @@ module Danger
88
88
  # Parse the given xml file and apply filters if needed
89
89
  #
90
90
  # @param [String] file_path which is a check-style xml file
91
- # @param [Boolean] modified_files_only a flag to determine to apply modified files-only filter
91
+ # @param [Boolean] modified_files_only a flag to determine to apply added/modified files-only filter
92
92
  # @return [Array<FoundFile>] filtered files
93
93
  def parse_xml(file_path, modified_files_only)
94
94
  prefix = root_path || `git rev-parse --show-toplevel`.chomp
@@ -100,7 +100,9 @@ module Danger
100
100
  end
101
101
 
102
102
  if modified_files_only
103
- files.select! { |f| git.modified_files.include?(f.relative_path) }
103
+ target_files = git.modified_files + git.added_files
104
+
105
+ files.select! { |f| target_files.include?(f.relative_path) }
104
106
  end
105
107
 
106
108
  files.reject! { |f| f.errors.empty? }
@@ -110,9 +112,8 @@ module Danger
110
112
  # Comment errors based on the given xml file to VCS
111
113
  #
112
114
  # @param [Array<FoundFile>] files which contains checkstyle results to be reported
113
- # @param [Boolean] modified_files_only inherit the doc
114
115
  # @return [void] void
115
- def do_comment(files, modified_files_only)
116
+ def do_comment(files)
116
117
  base_severity = CheckstyleReports::Severity.new(min_severity)
117
118
 
118
119
  files.each do |f|
@@ -120,7 +121,7 @@ module Danger
120
121
  # check severity
121
122
  next unless base_severity <= e.severity
122
123
 
123
- if inline_comment && (modified_files_only || git.modified_files.include?(f.relative_path))
124
+ if inline_comment
124
125
  self.public_send(report_method, e.html_unescaped_message, file: f.relative_path, line: e.line_number)
125
126
  else
126
127
  self.public_send(report_method, "#{f.relative_path} : #{e.html_unescaped_message} at #{e.line_number}")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-checkstyle_reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.pre.rc01
4
+ version: 0.0.1.pre.rc02
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jumpei Matsuda