def lint(filenames):
"""
Lint (syntax-check) a valohai.yaml file.
The return code of this command will be the total number of errors found in all the files.
"""
if not filenames:
project = get_project()
directory = (project.directory if project else get_project_directory())
config_file = os.path.join(directory, 'valohai.yaml')
if not os.path.exists(config_file):
raise CLIException('There is no %s file. Pass in the names of configuration files to lint?' % config_file)
filenames = [config_file]
total_errors = 0
for filename in filenames:
total_errors += validate_file(filename)
if total_errors:
warn('There were %d total errors.' % total_errors)
click.get_current_context().exit(total_errors)
评论列表
文章目录