-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dangerfile
54 lines (44 loc) · 2.07 KB
/
Dangerfile
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Code review automation
# https://github.com/danger/danger
#
# Policy:
# 1. Use `warn` for all things that are important, but not related to code.
# So it will be possible to fix these issues without creating new commits
# 2. Use `failure` for all things that are important and are related to code.
# So people will have to create new commits to address these issues.
# 3. Place `failure`s after all `warn` rules
# to collect maximum amount of issues in a code review comment
#
# Runtime:
# Note, that this script is executed inside a docker container,
# and we tend to use the full path. The same as in Dockerfile.
# In case you just want to copy this file, then deal with paths.
# Welcome message:
message(
"Before getting a real human to review your code I am here to help you.
Make sure that you are familiar with our [merge request workflow](https://wemake.services/meta/rsdp/creating-merge-requests).
Long story short, you will need to fix critical issues, otherwise your CI build will not pass. Warnings are also required to be fixed, but there are some exceptions when it is fine to leave them as-is.
Reviewer must ask you about unfixed warnings if something is not clear.
If you have any questions:
1. Read docs: https://github.com/wemake-services/kira-review
2. Ping your architect, ask right away
3. Create a bug, that something is not working / is not clear
Have fun!"
)
# Can only warn:
danger.import_dangerfile(path: "/danger/danger-stages/optional/")
# Local checks (can both `warn` and `fail` pipeline):
localfile = ENV.fetch("DANGER_LOCALFILE", "").strip()
unless localfile.empty?
absolute_path = File.join(ENV.fetch("CI_PROJECT_DIR"), localfile)
puts "Found local Dangerfile: #{ localfile }"
danger.import_dangerfile(path: absolute_path)
end
# Platform specific files (can both `warn` and `fail` pipeline):
ENV.fetch("DANGER_PLATFORMS", "").split(",").each { |platform|
danger.import_dangerfile(
path: "/danger/danger-platforms/#{platform.strip()}/"
)
}
# Critical checks, fail only:
danger.import_dangerfile(path: "/danger/danger-stages/critical/")