From ef437e255e60378abbfc15e74375c0c5d77d6074 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 23 Dec 2016 18:06:44 +0100 Subject: [PATCH] [fix] don't take comments into account --- package_linter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package_linter.py b/package_linter.py index 1b5902b..962383c 100755 --- a/package_linter.py +++ b/package_linter.py @@ -2,6 +2,7 @@ import sys import os +import re import json @@ -53,7 +54,8 @@ def check_file_exist(file_path): def read_file(file_path): with open(file_path) as f: - file = f.read().splitlines() + # remove every comments from the file content to avoid false positives + file = re.sub("#.*[^\n]", "", f.read()).splitlines() return file