danger-checkstyle_reports 0.0.1.pre.rc01 → 0.0.1.pre.rc02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/checkstyle_reports/gem_version.rb +1 -1
- data/lib/checkstyle_reports/plugin.rb +8 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67892b7eb60977e6c050da2266fc331253ae55fe
|
4
|
+
data.tar.gz: a9d4747c60bb21cc952a1fdb072bbfe241ef766c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2004681d7131c1f168f3b989d6a7b21ba2be4bf6e2bb5ba23a819f7fd2b458a636c305940644669e4650265846a202578a5a0e7ade993d9eaf18a0e8b34a33c
|
7
|
+
data.tar.gz: bdaa5991b0674489946a9ebb379e1be42b257a235cd5529f5fe879f47814960880eec9ed12189c2bca5d9394d975b4a47189c99ef696ec8a6c5d5157090cd4a3
|
@@ -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
|
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
|
-
|
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
|
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
|
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}")
|