From 28052025610f00fa77d9a6037d31b25a0ab97746 Mon Sep 17 00:00:00 2001 From: temp20230620 <137216868+temp20230620@users.noreply.github.com> Date: Tue, 20 Jun 2023 14:34:54 -0400 Subject: [PATCH] Create .pre-commit-hooks.yaml --- .pre-commit-hooks.yaml | 6 ++++++ pyproject.toml | 18 ++++++++++++++++++ yaml_shellcheck.py | 6 +++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-hooks.yaml create mode 100644 pyproject.toml diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..0873f03 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,6 @@ +- id: yaml-shellcheck + name: yaml-shellcheck v1.1.0 + description: Wrapper script to run shellcheck on YAML CI-config files + language: python + entry: yaml_shellcheck + types: [text] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ebe346b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[tool.poetry] +name = "yaml-shellcheck" +version = "1.1.0" +description = "Wrapper script to run shellcheck on YAML CI-config files" +authors = ["Martin Schütte "] +readme = "README.md" + +[tool.poetry.dependencies] +python = ">=3.8,<4" +"ruamel.yaml" = "0.16.0" + +[tool.poetry.scripts] +yaml_shellcheck = "yaml_shellcheck:main" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/yaml_shellcheck.py b/yaml_shellcheck.py index b8c1bad..3b64bdf 100755 --- a/yaml_shellcheck.py +++ b/yaml_shellcheck.py @@ -415,7 +415,7 @@ def cleanup_files(args): logger.debug("removed working dir %s", args.outdir) -if __name__ == "__main__": +def main(): args = setup() filenames = [] @@ -431,3 +431,7 @@ def cleanup_files(args): cleanup_files(args) # exit with shellcheck exit code sys.exit(check_proc_result.returncode if check_proc_result else 0) + + +if __name__ == "__main__": + main()