-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDangerFile
40 lines (34 loc) · 1.21 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
# frozen_string_literal: true
# FILE HELPERS
gitfiles = (git.modified_files + git.added_files).uniq
has_code_changes = !gitfiles.grep(/^Sources/).empty?
has_tests_changes = !gitfiles.grep(/^Tests/).empty?
# bq_helpers.scan_files
# BASIC CHECKS:
warn 'Big PR, try to keep changes smaller if you can 😜' if git.lines_of_code > 500
# BUILD PARSE:
# bq_helpers.build_reports.each do |path|
# path = Pathname(path)
# xcode_summary.report path.to_s
# end
#
# #JUNIT PARSE:
# bq_helpers.test_reports.each do |path|
# path = Pathname(path)
# junit.parse path.to_s
# junit.report
#
# all_test = junit.tests.map(&:attributes)
# slowest_test = all_test.sort_by { |attributes| attributes[:time].to_f }.last
# message "⌛️ **[#{bq_helpers.read_platform_from_file(path: path)}]** Slowest test: #{slowest_test[:name]} took #{'%.3f' % slowest_test[:time]} seconds"
# end
# SWIFTLINT
swiftlint.config_file = '.swiftlint.yml'
swiftlint.lint_files fail_on_error: true
swiftlint.max_num_violations = 20
swiftlint.lint_files
swiftlint.directory = 'Sources'
# TEST EVOLUTION CHECK:
if has_code_changes
warn('You have changes in code but there is no changes in any test... do you sleep well at night? 🤨') unless has_tests_changes
end