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 898767b..f38aaee 100755 --- a/yaml_shellcheck.py +++ b/yaml_shellcheck.py @@ -418,7 +418,7 @@ def cleanup_files(args): logger.debug("removed working dir %s", args.outdir) -if __name__ == "__main__": +def main(): args = setup() filenames = [] @@ -434,3 +434,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()