Revision control

1
2
3
# Add a link to the Bugzilla bug
4
5
# for debugging uncomment out these 2 lines
6
# require 'pry'
7
# binding.pry
8
9
# Run swiftlint
10
swiftlint.lint_files
11
12
# Localized Strings check
13
changedFiles = (git.added_files + git.modified_files).select{|file| file.end_with?(".swift")}
14
changedFiles.select{|file| file != "Client/Frontend/Strings.swift" }.each do |changed_file|
15
addedLines = git.diff_for_file(changed_file).patch.lines.select{ |line| line.start_with?("+") }
16
if addedLines.select{ |line| line.include?("NSLocalizedString") }.count != 0
17
warn("NSLocalizedString should only be added to Strings.swift")
18
break # We only need to show the warning once
19
end
20
end
21
22
# Add a friendly reminder for Sentry
23
changedFiles.each do |changed_file|
24
addedLines = git.diff_for_file(changed_file).patch.lines.select{ |line| line.start_with?("+") }
25
if addedLines.select{ |line| line.include?("Sentry.shared.send") }.count != 0
26
markdown("### Sentry check list")
27
markdown("- [ ] I understand that only .fatal events will be reported on release")
28
markdown("- [ ] The message param contains a string that will not create multiple events")
29
break
30
end
31
end
32
33
# Add a friendly reminder for LeanPlum
34
changedFiles.each do |changed_file|
35
addedLines = git.diff_for_file(changed_file).patch.lines.select{ |line| line.start_with?("+") }
36
if addedLines.select{ |line| line.include?("LeanplumIntegration.sharedInstance.track") }.count != 0
37
markdown("### LeanPlum checklist")
38
markdown("- [ ] I have updated the MMA.md doc")
39
markdown("- [ ] I have gone through the data privacy review")
40
break
41
end
42
end
43
44
# Fail if diff contains !try or as!
45
changedFiles.each do |changed_file|
46
# filter out only the lines that were added
47
addedLines = git.diff_for_file(changed_file).patch.lines.select{ |line| line.start_with?("+") }
48
fail("No new force try! or as!") if addedLines.select{ |line| (line.include?("as!") || line.include?("try!")) }.count != 0
49
end
50
51
52
#limit the number of new lines added to BVC to less than 10