-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDangerfile
33 lines (25 loc) · 1.36 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
#!/bin/ruby
if !git.modified_files.include?("CHANGELOG.md") && github.branch_for_base == "master"
fail("Please include a CHANGELOG entry.")
end
if !git.modified_files.include?("CHANGELOG.md") && github.branch_for_base == "dev"
warn("You might want to include a CHANGELOG entry.")
end
if git.commits.any? { |c| c.message =~ /^Merge branch 'master'/ }
warn 'Please rebase to get rid of the merge commits in this PR'
end
if git.commits.any? { |c| c.message.include?('fixup!') || c.message.include?('squash!') }
fail('This PR contains commits marked as squash or fixup. Please perform an interactive rebase to apply the changes.')
end
podfile_updated = git.modified_files.include?("Podfile")
no_license_updated = git.modified_files.grep(/Settings.bundle/).empty?
if podfile_updated && no_license_updated
warn("The `Podfile` was updated, but there were no changes in `Settings.bundle`. Did you forget to generate OSS license plists?")
end
cs_localization_updated = !(git.modified_files.grep(/cs\.lproj/).empty?)
en_localization_updated = !(git.modified_files.grep(/en\.lproj/).empty?)
if (cs_localization_updated && !en_localization_updated) || (!cs_localization_updated && en_localization_updated)
warn("It looks like you updated either CS or EN localization file. You forget to update the other one, didn't you?")
end
swiftlint.config_file = '.swiftlint.yml'
swiftlint.lint_files