aboutsummaryrefslogtreecommitdiff
path: root/tools/check-license.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tools/check-license.rb')
-rwxr-xr-xtools/check-license.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/check-license.rb b/tools/check-license.rb
new file mode 100755
index 0000000..8eeb6bb
--- /dev/null
+++ b/tools/check-license.rb
@@ -0,0 +1,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