Ignore shebang when evaluating license headers 43/5743/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 4 Aug 2017 17:29:18 +0000 (13:29 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 4 Aug 2017 17:30:02 +0000 (13:30 -0400)
The shebang lines in some scripts should be ignored when evaluating
license headers.

Change-Id: I7d895cf6b00a6edf8303c229278a262129ec2661
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
lftools/license.py

index a4ec135..32bb955 100644 (file)
@@ -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