From f980c295c3e4186867cd2b14b76ec327ae88a53f Mon Sep 17 00:00:00 2001 From: Brandon Doyle Date: Mon, 12 Sep 2022 14:07:44 -0400 Subject: [PATCH] Add support for warnings --- setup.py | 2 +- src/gitlabci_lint/validate.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 0293985..0f18031 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ setup( name='pre-commit-gitlabci-lint', - version='1.1.3', + version='1.1.4', description='Validate your GitLab CI with GitLab\'s API endpoint.', cmdclass=cmd_classes, long_description=long_description, diff --git a/src/gitlabci_lint/validate.py b/src/gitlabci_lint/validate.py index 2e88206..5edcd96 100644 --- a/src/gitlabci_lint/validate.py +++ b/src/gitlabci_lint/validate.py @@ -15,7 +15,7 @@ from functools import partial -__version__ = '1.1.3' +__version__ = '1.1.4' if not (token := os.getenv('GITLAB_TOKEN')): @@ -79,8 +79,12 @@ def validateCiConfig(baseUrl: str, configFile: str, silent: bool) -> int: errprint(error) returnValue = 1 errprint('=======') + elif lint_output['status'] == 'valid' and lint_output['warnings']: + print(f'Config file at \'{configFile}\' is valid, with warnings:', end=' ') + for warning in lint_output['warnings']: + errprint(warning) else: - print(f'Config file at {configFile} is valid.') + print(f'Config file at \'{configFile}\' is valid.') else: with urlopen(request) as response: lint_output = json.loads(response.read())