add ability to ignore rules in bash8
Change-Id: Ia6472f4bb251bf3e9846e08e30b2f9ea30ea1c03
This commit is contained in:
parent
daa0ce2f05
commit
0656e12d68
@ -30,8 +30,18 @@ import fileinput
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
ERRORS = 0
|
||||
IGNORE = None
|
||||
|
||||
|
||||
def register_ignores(ignores):
|
||||
global IGNORE
|
||||
if ignores:
|
||||
IGNORE='^(' + '|'.join(ignores.split(',')) + ')'
|
||||
|
||||
|
||||
def should_ignore(error):
|
||||
return IGNORE and re.search(IGNORE, error)
|
||||
|
||||
|
||||
def print_error(error, line):
|
||||
@ -97,11 +107,13 @@ def get_options():
|
||||
description='A bash script style checker')
|
||||
parser.add_argument('files', metavar='file', nargs='+',
|
||||
help='files to scan for errors')
|
||||
parser.add_argument('-i', '--ignore', help='Rules to ignore')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main():
|
||||
opts = get_options()
|
||||
register_ignores(opts.ignore)
|
||||
check_files(opts.files)
|
||||
|
||||
if ERRORS > 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user