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

result = 0
files = Dir.glob("src/**/*.h") + Dir.glob("src/**/*.cpp") \
      + Dir.glob("lib/**/*.h") + Dir.glob("lib/**/*.cpp") \
      + Dir.glob("plugins/**/*.h") + Dir.glob("plugins/**/*.cpp")

puts 'Checking licenses...'
files.each { |name|
    File.open(name) { |file|
        if file.grep(/SPDX-License-Identifier/).empty? then
            puts "Missing or incorrect license header: #{name}"
            result += 1
        end
    }
}

exit result