generated from futuredapp/android-project-template-compose
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dangerfile
56 lines (46 loc) · 1.39 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
55
56
danger.import_dangerfile(github: "futuredapp/danger")
# Utils
def report_checkstyle_for_directory(directory_name)
if Dir.exists?(directory_name)
Dir.entries(directory_name).select {|f| f.end_with? '.xml'}.each {|f|
report_checkstyle(directory_name + f)
}
end
end
def report_checkstyle(file_name)
if File.file?(file_name)
checkstyle_format.report file_name
end
end
def report_android_lint(file_name)
if File.file?(file_name)
android_lint.report_file = file_name
android_lint.filtering = true
android_lint.skip_gradle_task = true
android_lint.lint(inline_mode: true)
end
end
def report_unit_tests_for_directory(directory_name)
if Dir.exists?(directory_name)
Dir.entries(directory_name).select {|f| f.end_with? '.xml'}.each {|f|
report_unit_tests(directory_name + f)
}
end
end
def report_unit_tests(file_name)
if File.file?(file_name)
junit.parse file_name
junit.report
end
end
# Setup checkstyle
checkstyle_format.base_path = Dir.pwd
# Detekt checkstyle
report_checkstyle 'build/reports/detekt/detekt.xml'
# Ktlint checkstyle
report_checkstyle_for_directory 'app/build/reports/ktlint/'
report_checkstyle 'build/reports/ktlint/ktlintKotlinScriptCheck.xml'
# Android lint
report_android_lint 'app/build/reports/lint-results-devEnterprise.xml'
# Unit tests report
report_unit_tests_for_directory 'app/build/test-results/testMockEnterpriseUnitTest/'