Skip to content

Commit 2a9c7c2

Browse files
committed
provide possible fix for license/sortpom
1 parent 61619c4 commit 2a9c7c2

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

Dangerfile

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ require 'nokogiri'
2323

2424
pwd = Dir.pwd + '/'
2525

26-
def print_errors_summary(program, errors, link)
26+
def print_errors_summary(program, errors, link, suggested_fix = '')
2727
if errors == 1
28-
message("#{program} reports about #{errors} error. Please, fix it. See also: <a href=\"#{link}\">#{link}</a>")
28+
fix_msg = "Please, fix it#{suggested_fix}"
29+
message("#{program} reports about #{errors} error. #{fix_msg}. See also: <a href=\"#{link}\">#{link}</a>")
2930
elsif errors > 0
30-
message("#{program} reports about #{errors} errors. Please, fix them. See also: <a href=\"#{link}\">#{link}</a>")
31+
fix_msg = "Please, fix them#{suggested_fix}"
32+
message("#{program} reports about #{errors} errors. #{fix_msg}. See also: <a href=\"#{link}\">#{link}</a>")
3133
end
3234
end
3335

@@ -114,7 +116,12 @@ else
114116
fail("license error: #{line}")
115117
end
116118
end
117-
print_errors_summary 'license plugin', errors_count, 'https://github.com/php-coder/mystamps/wiki/check-license-header'
119+
print_errors_summary(
120+
program:'license plugin',
121+
errors:errors_count,
122+
link:'https://github.com/php-coder/mystamps/wiki/check-license-header',
123+
suggested_fix:' by executing `mvn license:format`'
124+
)
118125
end
119126

120127
# Handle `mvn sortpom:verify` output
@@ -143,7 +150,12 @@ else
143150
line.sub!('[ERROR] ', '')
144151
fail("pom.xml error: #{line}")
145152
end
146-
print_errors_summary 'sortpom plugin', errors_count, 'https://github.com/php-coder/mystamps/wiki/sortpom'
153+
print_errors_summary(
154+
program:'sortpom plugin',
155+
errors:errors_count,
156+
link:'https://github.com/php-coder/mystamps/wiki/sortpom',
157+
suggested_fix:' by executing `mvn sortpom:sort`'
158+
)
147159
end
148160

149161
# Handle `rflint` output

0 commit comments

Comments
 (0)