|
|
@ -99,9 +99,8 @@ class Format:
|
|
|
|
return line
|
|
|
|
return line
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def show_problems(problems, file, args_format, no_warn):
|
|
|
|
def show_problems(results, args_format, no_warn):
|
|
|
|
max_level = 0
|
|
|
|
max_level = 0
|
|
|
|
first = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if args_format == 'auto':
|
|
|
|
if args_format == 'auto':
|
|
|
|
if ('GITHUB_ACTIONS' in os.environ and
|
|
|
|
if ('GITHUB_ACTIONS' in os.environ and
|
|
|
@ -110,6 +109,10 @@ def show_problems(problems, file, args_format, no_warn):
|
|
|
|
elif supports_color():
|
|
|
|
elif supports_color():
|
|
|
|
args_format = 'colored'
|
|
|
|
args_format = 'colored'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for file in results:
|
|
|
|
|
|
|
|
first = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
problems = results[file]
|
|
|
|
for problem in problems:
|
|
|
|
for problem in problems:
|
|
|
|
max_level = max(max_level, PROBLEM_LEVELS[problem.level])
|
|
|
|
max_level = max(max_level, PROBLEM_LEVELS[problem.level])
|
|
|
|
if no_warn and (problem.level != 'error'):
|
|
|
|
if no_warn and (problem.level != 'error'):
|
|
|
@ -225,8 +228,7 @@ def run(argv=None):
|
|
|
|
print(file)
|
|
|
|
print(file)
|
|
|
|
sys.exit(0)
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
|
|
max_level = 0
|
|
|
|
results = {}
|
|
|
|
|
|
|
|
|
|
|
|
for file in find_files_recursively(args.files, conf):
|
|
|
|
for file in find_files_recursively(args.files, conf):
|
|
|
|
filepath = file[2:] if file.startswith('./') else file
|
|
|
|
filepath = file[2:] if file.startswith('./') else file
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -235,9 +237,7 @@ def run(argv=None):
|
|
|
|
except OSError as e:
|
|
|
|
except OSError as e:
|
|
|
|
print(e, file=sys.stderr)
|
|
|
|
print(e, file=sys.stderr)
|
|
|
|
sys.exit(-1)
|
|
|
|
sys.exit(-1)
|
|
|
|
prob_level = show_problems(problems, file, args_format=args.format,
|
|
|
|
results[filepath] = problems
|
|
|
|
no_warn=args.no_warnings)
|
|
|
|
|
|
|
|
max_level = max(max_level, prob_level)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# read yaml from stdin
|
|
|
|
# read yaml from stdin
|
|
|
|
if args.stdin:
|
|
|
|
if args.stdin:
|
|
|
@ -246,9 +246,9 @@ def run(argv=None):
|
|
|
|
except OSError as e:
|
|
|
|
except OSError as e:
|
|
|
|
print(e, file=sys.stderr)
|
|
|
|
print(e, file=sys.stderr)
|
|
|
|
sys.exit(-1)
|
|
|
|
sys.exit(-1)
|
|
|
|
prob_level = show_problems(problems, 'stdin', args_format=args.format,
|
|
|
|
results['stdin'] = problems
|
|
|
|
no_warn=args.no_warnings)
|
|
|
|
|
|
|
|
max_level = max(max_level, prob_level)
|
|
|
|
max_level = show_problems(results, args_format=args.format, no_warn=args.no_warnings)
|
|
|
|
|
|
|
|
|
|
|
|
if max_level == PROBLEM_LEVELS['error']:
|
|
|
|
if max_level == PROBLEM_LEVELS['error']:
|
|
|
|
return_code = 1
|
|
|
|
return_code = 1
|
|
|
|