summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-02-10 23:27:57 +0100
committerGitHub <noreply@github.com>2018-02-10 23:27:57 +0100
commitd5e0c23499b0b38556c7c8ea4d0066d21231668a (patch)
tree201dc8551cdd61ef77b4fc08fe0315365e27c47f
parent17b59599c4082fadd720dd86686087ca5eaee61c (diff)
parent8b101bfaa8e636a8d03522b2ea0640edfd1e6884 (diff)
downloadimag-d5e0c23499b0b38556c7c8ea4d0066d21231668a.zip
imag-d5e0c23499b0b38556c7c8ea4d0066d21231668a.tar.gz
Merge pull request #1270 from matthiasbeyer/license-header-checker
License header checker
-rw-r--r--.travis.yml1
-rwxr-xr-xscripts/license-headers-updated39
2 files changed, 40 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
index 38efdf1..04a9f5a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,6 +30,7 @@ addons:
script:
- |
+ bash ./scripts/license-headers-updated || exit 1
cargo build --all --all-features -j 1 || exit 1
cargo test --all --all-features -j 1 || exit 1
diff --git a/scripts/license-headers-updated b/scripts/license-headers-updated
new file mode 100755
index 0000000..cbd8cfe
--- /dev/null
+++ b/scripts/license-headers-updated
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+
+curr_year=$(date +%Y || exit 1)
+
+line() {
+ head -n "$1" | tail -n 1
+}
+
+check() {
+ local file="$1"
+ local line="$2"
+ local mtch="$3"
+ local desc="$4"
+
+ cat "$file" | line "$line" | grep "$mtch" 2>/dev/null >/dev/null || {
+ echo "[LICENSE ERROR]: '$desc' is missing or wrong in '$file'"
+ return 1
+ }
+}
+
+find -name "*.rs" -type f | while read filename; do
+ check "$filename" 2 \
+ "imag - the personal information management suite for the commandline" \
+ "Description line" \
+ || exit 1
+
+ check "$filename" 3 \
+ "Copyright (C) 2015-${curr_year}" \
+ "Copyright name" \
+ || exit 1
+
+ check "$filename" 5 \
+ "This library is free software" \
+ "License" \
+ || exit 1
+
+ echo "[LICENSE OK]: $filename"
+done
+