101
101
File . readlines ( license_output )
102
102
. select { |line | line . start_with? '[WARNING]' }
103
103
. each do |line |
104
- errors_count += 1
105
104
line . sub! ( '[WARNING] ' , '' )
106
105
line . sub! ( pwd , '' )
107
106
if line =~ /Missing header in: .*/
@@ -116,14 +115,18 @@ else
116
115
117
116
unless errors . empty?
118
117
link = 'https://github.com/php-coder/mystamps/wiki/check-license-header'
118
+ errors_cnt = errors . size ( )
119
+ error_msgs = errors . join ( "\n " )
119
120
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>" )
123
125
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>" )
127
130
end
128
131
end
129
132
end
@@ -145,24 +148,24 @@ else
145
148
next
146
149
end
147
150
148
- line . ! sub ( '[ERROR] ' , '' )
149
- errors << line
151
+ line . sub! ( '[ERROR] ' , '' )
152
+ errors << line . rstrip
150
153
end
151
154
152
155
unless errors . empty?
153
- link = 'https://github.com/php-coder/mystamps/wiki/sortpom' ,
156
+ link = 'https://github.com/php-coder/mystamps/wiki/sortpom'
154
157
errors_cnt = errors . size ( )
155
158
error_msgs = errors . join ( "\n " )
156
159
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>" )
161
164
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>" )
166
169
end
167
170
end
168
171
end
0 commit comments