From a165c16553c0f2940c97fd81cdf2fd0fd1eb07a8 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 28 Jan 2020 16:12:40 +0000 Subject: [PATCH] Add pre commit config --- .github/PULL_REQUEST_TEMPLATE.md | 1 - .github/stale.yml | 1 - .github/workflows/main.yml | 2 -- .github/workflows/templates/generate.py | 8 ++++--- .pre-commit-config.yaml | 28 +++++++++++++++++++++++++ CONTRIBUTING.md | 10 ++++----- 6 files changed, 38 insertions(+), 12 deletions(-) mode change 100644 => 100755 .github/workflows/templates/generate.py create mode 100644 .pre-commit-config.yaml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1cfce68..0bd7970 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -7,4 +7,3 @@ Remove this section if not relevant ### New Behavior Remove this section if not relevant - diff --git a/.github/stale.yml b/.github/stale.yml index 6cbfe56..e3b493c 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -30,4 +30,3 @@ closeComment: false # Limit to only `issues` or `pulls` only: issues - diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 39e0e51..ffabfd5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2807,5 +2807,3 @@ jobs: if: always() run: | bundle exec kitchen destroy py3-git-2019-2-ubuntu-1804 - - diff --git a/.github/workflows/templates/generate.py b/.github/workflows/templates/generate.py old mode 100644 new mode 100755 index 36f3f38..67c90a4 --- a/.github/workflows/templates/generate.py +++ b/.github/workflows/templates/generate.py @@ -131,9 +131,11 @@ def generate_test_jobs(): with open('../main.yml', 'w') as wfh: with open('main.yml') as rfh: wfh.write( - rfh.read().format( - lint_job=lint_job, - test_jobs=test_jobs, + '{}\n'.format( + rfh.read().format( + lint_job=lint_job, + test_jobs=test_jobs, + ).strip() ) ) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..16045bc --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +--- +minimum_pre_commit_version: 1.15.2 +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.1.0 + hooks: + - id: check-merge-conflict # Check for files that contain merge conflict strings. + - id: trailing-whitespace # Trims trailing whitespace. + args: [--markdown-linebreak-ext=md] + - id: mixed-line-ending # Replaces or checks mixed line ending. + args: [--fix=lf] + - id: end-of-file-fixer # Makes sure files end in a newline and only a newline. + - id: check-merge-conflict # Check for files that contain merge conflict strings. + + - repo: local + hooks: + - id: generate-actions-workflow + name: Generate Github Actions Workflow + entry: .github/workflows/templates/generate.py + pass_filenames: false + files: '.github/workflows/templates/.*' + language: script + + - id: shellcheck + name: Run ShellCheck against bootstrap-salt.sh + entry: koalaman/shellcheck-alpine:v0.6.0 shellcheck -s sh -f tty + files: 'bootstrap-salt\.sh' + language: docker_image diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7a3a8f..9729795 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ The Salt Bootstrap issue tracker is used for feature requests and bug reports. A bug is a *demonstrable problem* that is caused by the code in the repository. -Please read the following guidelines before you +Please read the following guidelines before you [file an issue](https://github.com/saltstack/salt-bootstrap/issues/new). 1. **Use the GitHub issue search** -- check if the issue has @@ -25,7 +25,7 @@ Please read the following guidelines before you please try to bootstrap using the bootstrap scirpt from the develop branch. The issue you are having might have already been fixed and it's just not yet included in the stable release. - + ``` curl -o bootstrap-salt.sh -L https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.sh sudo sh bootstrap-salt.sh git develop @@ -73,7 +73,7 @@ easily solved another way, which is a great reason to ask first. Fixes for issues are very welcome! -Once you've fixed the issue you have in hand, create a +Once you've fixed the issue you have in hand, create a [pull request](https://help.github.com/articles/creating-a-pull-request/). Salt Bootstrap maintainers will review your fix. If everything is OK and all @@ -102,7 +102,7 @@ repo from the PR, etc. #### Lint Check -The pull request test that matters the most, and the contributor is directly +The pull request test that matters the most, and the contributor is directly responsible for fixing, is the Lint check. This check *must* be passing before the contribution can be merged into the codebase. @@ -149,7 +149,7 @@ Typically, SaltStack's release team determines when it would be good to release a new stable version. Timing the release usually involves an analysis of the following: - + - Updates for major feature releases in [Salt](https://github.com/saltstack/salt) - Support for new versions of major operating systems - Types of fixes submitted to `develop` since the last release