From 9a2d86842ec41c98fe7be4e2473ffb20cd2ca3a1 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Fri, 4 Aug 2017 13:29:18 -0400 Subject: [PATCH] Ignore shebang when evaluating license headers The shebang lines in some scripts should be ignored when evaluating license headers. Change-Id: I7d895cf6b00a6edf8303c229278a262129ec2661 Signed-off-by: Thanh Ha --- lftools/license.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lftools/license.py b/lftools/license.py index a4ec135b..32bb9554 100644 --- a/lftools/license.py +++ b/lftools/license.py @@ -34,7 +34,8 @@ def get_header_text(_file): if not result: break string = re.sub(r'^\s*#+', '', line).strip() - if bool(re.match('Copyright', string, re.I)): # Ignore the Copyright line + if (bool(re.match('Copyright', string, re.I)) # Ignore the Copyright line + or bool(re.match('^#!', line, re.I))): # Ignore #! shebang lines continue text += ' {}'.format(string) # Strip unnecessary spacing -- 2.16.6