-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDangerfile
More file actions
36 lines (29 loc) · 1.27 KB
/
Dangerfile
File metadata and controls
36 lines (29 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
if github.pr_title.include? "[WIP]"
warn("PR is classed as Work in Progress")
end
# Warn when there is a big PR
if git.lines_of_code > 500
warn("Big PR")
end
# If these are all empty something has gone wrong, better to raise it in a comment
if git.modified_files.empty? && git.added_files.empty? && git.deleted_files.empty?
warn "This PR has no changes at all, this is likely an issue during development."
end
# Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title
if github.pr_body.length < 120
warn "Please provide a summary in the Pull Request description"
end
# Ensure that the PR body contains the commit message using the convention
if !(github.pr_body =~ /\b(?=\w)(docs|fix|feat|chore|style|refactor|perf|test)(?:\((.*)\))?(!?)\: (.*)/)
warn "The Pull Request summary does not contain the commit message convention"
end
# Ensure that the PR title follows the convention
if !(github.pr_title =~ /\[([0-9])+\](.*)/)
warn "The Pull Request title does not follow the convention [00000] PR Title text"
end
github.dismiss_out_of_range_messages
# Lint checks
ktlint.skip_lint = true
ktlint.report_files_pattern = '**/build/reports/ktlint/**.json'
ktlint.lint