forked from ParisiLabs/wire-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dangerfile
13 lines (10 loc) · 1.04 KB
/
Dangerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
# Warn if touched files are missing the copyright header
copyright_header = "////Wire//Copyright(C)2016WireSwissGmbH////Thisprogramisfreesoftware:youcanredistributeitand/ormodify//itunderthetermsoftheGNUGeneralPublicLicenseaspublishedby//theFreeSoftwareFoundation,eitherversion3oftheLicense,or//(atyouroption)anylaterversion.////Thisprogramisdistributedinthehopethatitwillbeuseful,//butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof//MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.Seethe//GNUGeneralPublicLicenseformoredetails.////YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense//alongwiththisprogram.Ifnot,seehttp://www.gnu.org/licenses/.//"
touched = git.added_files | git.modified_files
paths = touched.select { |f| f.end_with? ".h", ".m", ".swift", ".mm" }
paths.each do |p|
content = File.read(p).delete("\s").delete("\n")
warn "Missing copyright headers in #{p.split('/').last}" unless content.include? copyright_header
end
# Warn if there are no labels attached to the PR
warn "Please add labels to this PR" if github.pr_labels.count == 0