Skip to content

Commit 9af5c96

Browse files
committed
follow-up fixes
1 parent a6c4787 commit 9af5c96

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

Dangerfile

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ else
101101
File.readlines(license_output)
102102
.select { |line| line.start_with? '[WARNING]' }
103103
.each do |line|
104-
errors_count += 1
105104
line.sub!('[WARNING] ', '')
106105
line.sub!(pwd, '')
107106
if line =~ /Missing header in: .*/
@@ -116,14 +115,18 @@ else
116115

117116
unless errors.empty?
118117
link = 'https://github.com/php-coder/mystamps/wiki/check-license-header'
118+
errors_cnt = errors.size()
119+
error_msgs = errors.join("\n")
119120
if errors_cnt == 1
120-
message("license plugin reports about #{errors_cnt} error. "\
121-
"Please, fix it by executing `mvn license:format`. "\
122-
"See also: <a href=\"#{link}\">#{link}</a>")
121+
fail("license plugin reports about #{errors_cnt} error:\n"\
122+
"#{error_msgs}\n"\
123+
"Please, fix it by executing `mvn license:format`.\n"\
124+
"See also: <a href=\"#{link}\">#{link}</a>")
123125
elsif errors_cnt > 1
124-
message("license plugin reports about #{errors_cnt} errors. "\
125-
"Please, fix them by executing `mvn license:format`. "\
126-
"See also: <a href=\"#{link}\">#{link}</a>")
126+
fail("license plugin reports about #{errors_cnt} errors:\n"\
127+
"#{error_msgs}\n"\
128+
"Please, fix them by executing `mvn license:format`.\n"\
129+
"See also: <a href=\"#{link}\">#{link}</a>")
127130
end
128131
end
129132
end
@@ -145,24 +148,24 @@ else
145148
next
146149
end
147150

148-
line.!sub('[ERROR] ', '')
149-
errors << line
151+
line.sub!('[ERROR] ', '')
152+
errors << line.rstrip
150153
end
151154

152155
unless errors.empty?
153-
link = 'https://github.com/php-coder/mystamps/wiki/sortpom',
156+
link = 'https://github.com/php-coder/mystamps/wiki/sortpom'
154157
errors_cnt = errors.size()
155158
error_msgs = errors.join("\n")
156159
if errors_cnt == 1
157-
message("sortpom plugin reports about #{errors_cnt} error:\n"\
158-
"#{error_msgs}\n"\
159-
"Please, fix it by executing `mvn sortpom:sort`. "\
160-
"See also: <a href=\"#{link}\">#{link}</a>")
160+
fail("sortpom plugin reports about #{errors_cnt} error:\n"\
161+
"#{error_msgs}\n"\
162+
"Please, fix it by executing `mvn sortpom:sort`.\n"\
163+
"See also: <a href=\"#{link}\">#{link}</a>")
161164
elsif errors_cnt > 1
162-
message("sortpom plugin reports about #{errors_cnt} errors:\n"\
163-
"#{error_msgs}\n"\
164-
"Please, fix them by executing `mvn sortpom:sort`. "\
165-
"See also: <a href=\"#{link}\">#{link}</a>")
165+
fail("sortpom plugin reports about #{errors_cnt} errors:\n"\
166+
"#{error_msgs}\n"\
167+
"Please, fix them by executing `mvn sortpom:sort`.\n"\
168+
"See also: <a href=\"#{link}\">#{link}</a>")
166169
end
167170
end
168171
end

0 commit comments

Comments
 (0)