Skip to content

Commit 3d3b35d

Browse files
committed
rework fix
1 parent 2a9c7c2 commit 3d3b35d

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

Dangerfile

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

2424
pwd = Dir.pwd + '/'
2525

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

@@ -116,12 +114,13 @@ else
116114
fail("license error: #{line}")
117115
end
118116
end
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-
)
117+
118+
link = 'https://github.com/php-coder/mystamps/wiki/check-license-header'
119+
if errors_count == 1
120+
message("license plugin reports about #{errors_count} error. Please, fix it by executing `mvn license:format`. See also: <a href=\"#{link}\">#{link}</a>")
121+
elsif errors_count > 0
122+
message("license plugin reports about #{errors_count} errors. Please, fix them by executing `mvn license:format`. See also: <a href=\"#{link}\">#{link}</a>")
123+
end
125124
end
126125

127126
# Handle `mvn sortpom:verify` output
@@ -150,12 +149,13 @@ else
150149
line.sub!('[ERROR] ', '')
151150
fail("pom.xml error: #{line}")
152151
end
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-
)
152+
153+
link = 'https://github.com/php-coder/mystamps/wiki/sortpom',
154+
if errors_count == 1
155+
message("sortpom plugin reports about #{errors_count} error. Please, fix it by executing `mvn sortpom:sort`. See also: <a href=\"#{link}\">#{link}</a>")
156+
elsif errors_count > 0
157+
message("sortpom plugin reports about #{errors_count} errors. Please, fix them by executing `mvn sortpom:sort`. See also: <a href=\"#{link}\">#{link}</a>")
158+
end
159159
end
160160

161161
# Handle `rflint` output

0 commit comments

Comments
 (0)