aboutsummaryrefslogtreecommitdiff
path: root/tools/check_license.rb
blob: 66cb0f198110618d895476d900f4293c157560d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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

if exit_code == 0 then
  puts "All licenses okay"
end

exit exit_code