aboutsummaryrefslogtreecommitdiff
path: root/tools/check_license.rb
blob: c51951332cbaccd67024cfb9809f9341dbbd2782 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby

exit_code = 0
file_names = Dir.glob("**/*.h") + Dir.glob("**/*.cpp")

puts "Running in #{`pwd`}"

# for each item in file_names
file_names.each do |file_name|
  File.open(file_name) { |file|
    if file.grep(/SPDX-License-Identifier/).empty? then
      puts "Missing or incorrect license header: #{file_name}"
      exit_code = 1
    end
  }
end

exit exit_code