From 6e08356386e137a28a757294f13d656eeac327db Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 15:38:58 +0300 Subject: [PATCH 01/11] Added github configs --- .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE.md | 29 +++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 18 +++++++++ .github/SECURITY.md | 14 +++++++ .github/config.yml | 1 + .github/dependabot.yml | 13 +++++++ .github/workflows/build.yml | 30 +++++++++++++++ .github/workflows/check-requirements.yml | 36 ++++++++++++++++++ .github/workflows/check.yml | 47 ++++++++++++++++++++++++ .github/workflows/coveralls.yml | 42 +++++++++++++++++++++ .github/workflows/test.yml | 45 +++++++++++++++++++++++ setup.cfg | 2 +- 12 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/SECURITY.md create mode 100644 .github/config.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/check-requirements.yml create mode 100644 .github/workflows/check.yml create mode 100644 .github/workflows/coveralls.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..2a4beef --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @vint21h @Artesius diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..91b0d02 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,29 @@ + + +## Expected Behavior + + +## Current Behavior + + +## Possible Solution + + +## Steps to Reproduce + + +1. +2. +3. + +## Context (Environment) + + + + + +## Detailed Description + + +## Possible Implementation + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..874f2c8 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,18 @@ + + +## Description + + +## Related Issue + + + + +## Motivation and Context + + + +## How Has This Been Tested? + + + diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..b58ea1c --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,14 @@ +# Security Policy + +## Supported Versions + +So, because this is not a thing that can produce security problems in the project using it, +security policy is very simple: supported only the last major or minor branch. + +| Version | Supported | +|-----------| ------------------ | +| 0.1.x | :white_check_mark: | + +## Reporting a Vulnerability + +If you found something that in your opinion may produce any security problem, please create a [new issue](https://github.com/Anadea/pre-commit-config-shellcheck/issues/new/). diff --git a/.github/config.yml b/.github/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..694dd4b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" + allow: + - dependency-name: "all" + dependency-type: "direct" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..129803f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +name: "build" +on: + push: + branches: + - "*" + tags: + - "*" + pull_request: + branches: + - "*" + workflow_dispatch: + workflow_call: +env: + NAME: "pre-commit-config-shellcheck" + DEFAULT_PYTHON_VERSION: "3.10" +jobs: + check-requirements: + uses: "./.github/workflows/check-requirements.yml" + check: + name: "${{ matrix.toxenv }}" + uses: "./.github/workflows/check.yml" + test: + name: "${{ matrix.python-version }}" + uses: "./.github/workflows/test.yml" + if: success() + needs: ["check"] + coveralls: + uses: "./.github/workflows/coveralls.yml" + if: success() + needs: ["test", "check"] diff --git a/.github/workflows/check-requirements.yml b/.github/workflows/check-requirements.yml new file mode 100644 index 0000000..0901731 --- /dev/null +++ b/.github/workflows/check-requirements.yml @@ -0,0 +1,36 @@ +name: "check-requirements" +on: + schedule: + - cron: "0 3 * * *" + workflow_dispatch: + workflow_call: +env: + DEFAULT_PYTHON_VERSION: "3.10" +jobs: + check-requirements: + name: "check-requirements" + runs-on: "ubuntu-latest" + steps: + - name: "Git clone" + id: "git-clone" + uses: "actions/checkout@v2" + - name: "Set up Python ${{ env.DEFAULT_PYTHON_VERSION }}" + id: "set-up-python" + uses: "actions/setup-python@v2" + with: + python-version: "${{ env.DEFAULT_PYTHON_VERSION }}" + - name: "Pip cache" + id: "pip-cache" + uses: "actions/cache@v2" + with: + path: "~/.cache/pip" + key: "${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}" + restore-keys: | + "${{ runner.os }}-pip-" + - name: "Install requirements" + id: "install-requirements" + run: "make install" + - name: "Check outdated requirements" + id: "check-outdated-requirements" + continue-on-error: true + run: "pip-outdated" diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..585c21a --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,47 @@ +name: "check" +on: + workflow_dispatch: + workflow_call: +env: + NAME: "pre-commit-config-shellcheck" + DEFAULT_PYTHON_VERSION: "3.10" +jobs: + check: + name: "${{ matrix.toxenv }}" + runs-on: "ubuntu-latest" + strategy: + matrix: + toxenv: ["check", "check-build"] + steps: + - name: "Git clone" + id: "git-clone" + uses: "actions/checkout@v2" + - name: "Set up Python ${{ env.DEFAULT_PYTHON_VERSION }}" + id: "set-up-python" + uses: "actions/setup-python@v2" + with: + python-version: "${{ env.DEFAULT_PYTHON_VERSION }}" + - name: "Pip cache" + id: "pip-cache" + uses: "actions/cache@v2" + with: + path: "~/.cache/pip" + key: "${{ runner.os }}-pip-${{ matrix.toxenv }}-${{ hashFiles('setup.cfg') }}" + restore-keys: | + "${{ runner.os }}-pip-${{ matrix.toxenv }}-" + "${{ runner.os }}-pip-" + - name: "Pre-commit cache" + id: "pre-commit-cache" + uses: "actions/cache@v2" + with: + path: "~/.cache/pre-commit" + key: "${{ runner.os }}-pre-commit-${{ matrix.toxenv }}-${{ hashFiles('.pre-commit-config.yaml') }}" + restore-keys: | + "${{ runner.os }}-pre-commit-${{ matrix.toxenv }}-" + "${{ runner.os }}-pre-commit-" + - name: "Install requirements" + id: "install-requirements" + run: "make install" + - name: "Run ${{ matrix.toxenv }}" + id: "run" + run: "tox -e ${{ matrix.toxenv }}" diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml new file mode 100644 index 0000000..f4f52e4 --- /dev/null +++ b/.github/workflows/coveralls.yml @@ -0,0 +1,42 @@ +name: "coveralls" +on: + workflow_dispatch: + workflow_call: +env: + NAME: "pre-commit-config-shellcheck" + DEFAULT_PYTHON_VERSION: "3.10" +jobs: + coveralls: + name: "coveralls" + runs-on: "ubuntu-latest" + steps: + - name: "Git clone" + id: "git-clone" + uses: "actions/checkout@v2" + - name: "Set up Python ${{ env.DEFAULT_PYTHON_VERSION }}" + id: "set-up-python" + uses: "actions/setup-python@v2" + with: + python-version: "${{ env.DEFAULT_PYTHON_VERSION }}" + - name: "Pip cache" + id: "pip-cache" + uses: "actions/cache@v2" + with: + path: "~/.cache/pip" + key: "${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}" + restore-keys: | + "${{ runner.os }}-pip-" + - name: "Temporarily save coverage statistics" + id: "temporarily-save-coverage-statistics" + uses: "actions/cache@v2" + with: + path: ".coverage" + key: ".coverage-${{ github.run_id }}-${{ github.run_number }}" + - name: "Install requirements" + id: "install-requirements" + run: "make install" + - name: "Upload coverage report to Coveralls" + id: "upload-coverage-report-to-coveralls" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + run: "coveralls --service=github" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1c39544 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: "test" +on: + workflow_dispatch: + workflow_call: +env: + NAME: "pre-commit-config-shellcheck" +jobs: + test: + name: "${{ matrix.python-version }}" + runs-on: "ubuntu-latest" + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10"] + steps: + - name: "Git clone" + id: "git-clone" + uses: "actions/checkout@v2" + - name: "Set up Python ${{ matrix.python-version }}" + id: "set-up-python" + uses: "actions/setup-python@v2" + with: + python-version: "${{ matrix.python-version }}" + - name: "Pip cache" + id: "pip-cache" + uses: "actions/cache@v2" + with: + path: "~/.cache/pip" + key: "${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }}" + restore-keys: | + "${{ runner.os }}-pip-${{ matrix.python-version }}-" + "${{ runner.os }}-pip-" + - name: "Temporarily save coverage statistics" + id: "temporarily-save-coverage-statistics" + uses: "actions/cache@v2" + with: + path: ".coverage" + key: ".coverage-${{ github.run_id }}-${{ github.run_number }}" + - name: "Install requirements" + id: "install-requirements" + run: "make install" + - name: "Run tests" + id: "run-tests" + env: + PLATFORM: "${{ matrix.platform }}" + run: "make tox" diff --git a/setup.cfg b/setup.cfg index ae8ed5f..91b491f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = pre-commit-config-shellcheck version = 0.0.0 -description = Tool for shellchecking entry points in pre-commit config. +description = Tool for shellchecking pre-commit config files. python_requires >= 3.7 license_file = MIT-LICENSE author = Anadea From b9944c12f2d2a82ed4c1d698114a5a4197ba06b3 Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 16:11:04 +0300 Subject: [PATCH 02/11] Fixed checks --- .pre-commit-config.yaml | 2 +- setup.cfg | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8b7d5e0..43ffb9e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -90,7 +90,7 @@ repos: stages: [commit] language: system pass_filenames: false - entry: bash -c 'make build -B && check-wheel-contents dist' + entry: bash -c 'make build -B && check-wheel-contents dist -c setup.cfg' types: [python] - id: "dotenv-linter" name: "dotenv-linter" diff --git a/setup.cfg b/setup.cfg index 91b491f..7f0e839 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,9 +27,26 @@ packages = find: zip_safe = False include_package_data = True test_suite = tests +scripts = + pre_commit_config_shellcheck.py install_requires = pyyaml==6.0 +[options.package_data] +pre-commit-config-shellcheck = README.rst, MIT-LICENSE, CONTRIBUTORS + +[options.packages.find] +exclude = + tests.* + tests + +[bdist_wheel] +universal = False + +[sdist] +formats = zip + + [options.extras_require] test = bandit==1.7.4 @@ -177,7 +194,7 @@ exclude_lines = [tool:check-wheel-contents] -ignore = W004 +ignore = W004,W007 [tox:tox] From 9ec40c67780c07665144b225373b73733e08cbf8 Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 16:23:02 +0300 Subject: [PATCH 03/11] Updated github actions versions --- .github/workflows/check-requirements.yml | 6 +++--- .github/workflows/check.yml | 8 ++++---- .github/workflows/coveralls.yml | 8 ++++---- .github/workflows/test.yml | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/check-requirements.yml b/.github/workflows/check-requirements.yml index 0901731..fa14b7f 100644 --- a/.github/workflows/check-requirements.yml +++ b/.github/workflows/check-requirements.yml @@ -13,15 +13,15 @@ jobs: steps: - name: "Git clone" id: "git-clone" - uses: "actions/checkout@v2" + uses: "actions/checkout@v3.0.2" - name: "Set up Python ${{ env.DEFAULT_PYTHON_VERSION }}" id: "set-up-python" - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v4.1.0" with: python-version: "${{ env.DEFAULT_PYTHON_VERSION }}" - name: "Pip cache" id: "pip-cache" - uses: "actions/cache@v2" + uses: "actions/cache@v3.0.5" with: path: "~/.cache/pip" key: "${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}" diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 585c21a..00e6d42 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -15,15 +15,15 @@ jobs: steps: - name: "Git clone" id: "git-clone" - uses: "actions/checkout@v2" + uses: "actions/checkout@v3.0.2" - name: "Set up Python ${{ env.DEFAULT_PYTHON_VERSION }}" id: "set-up-python" - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v4.1.0" with: python-version: "${{ env.DEFAULT_PYTHON_VERSION }}" - name: "Pip cache" id: "pip-cache" - uses: "actions/cache@v2" + uses: "actions/cache@v3.0.5" with: path: "~/.cache/pip" key: "${{ runner.os }}-pip-${{ matrix.toxenv }}-${{ hashFiles('setup.cfg') }}" @@ -32,7 +32,7 @@ jobs: "${{ runner.os }}-pip-" - name: "Pre-commit cache" id: "pre-commit-cache" - uses: "actions/cache@v2" + uses: "actions/cache@v3.0.5" with: path: "~/.cache/pre-commit" key: "${{ runner.os }}-pre-commit-${{ matrix.toxenv }}-${{ hashFiles('.pre-commit-config.yaml') }}" diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index f4f52e4..c6c9076 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -12,15 +12,15 @@ jobs: steps: - name: "Git clone" id: "git-clone" - uses: "actions/checkout@v2" + uses: "actions/checkout@v3.0.2" - name: "Set up Python ${{ env.DEFAULT_PYTHON_VERSION }}" id: "set-up-python" - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v4.1.0" with: python-version: "${{ env.DEFAULT_PYTHON_VERSION }}" - name: "Pip cache" id: "pip-cache" - uses: "actions/cache@v2" + uses: "actions/cache@v3.0.5" with: path: "~/.cache/pip" key: "${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}" @@ -28,7 +28,7 @@ jobs: "${{ runner.os }}-pip-" - name: "Temporarily save coverage statistics" id: "temporarily-save-coverage-statistics" - uses: "actions/cache@v2" + uses: "actions/cache@v3.0.5" with: path: ".coverage" key: ".coverage-${{ github.run_id }}-${{ github.run_number }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c39544..ba49445 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,15 +14,15 @@ jobs: steps: - name: "Git clone" id: "git-clone" - uses: "actions/checkout@v2" + uses: "actions/checkout@v3.0.2" - name: "Set up Python ${{ matrix.python-version }}" id: "set-up-python" - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v4.1.0" with: python-version: "${{ matrix.python-version }}" - name: "Pip cache" id: "pip-cache" - uses: "actions/cache@v2" + uses: "actions/cache@v3.0.5" with: path: "~/.cache/pip" key: "${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }}" @@ -31,7 +31,7 @@ jobs: "${{ runner.os }}-pip-" - name: "Temporarily save coverage statistics" id: "temporarily-save-coverage-statistics" - uses: "actions/cache@v2" + uses: "actions/cache@v3.0.5" with: path: ".coverage" key: ".coverage-${{ github.run_id }}-${{ github.run_number }}" From b9841cf8553e417ef4df875891e1dd1f0fb767fb Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 16:39:38 +0300 Subject: [PATCH 04/11] Added badges to README, some README updates --- README.rst | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index 222c666..9996ee6 100644 --- a/README.rst +++ b/README.rst @@ -1,12 +1,12 @@ pre-commit-config-shellcheck documentation ========================================== -*pre-commit-config-shellcheck is a tool for checking entry points in pre-commit config with ShellCheck.* +|GitHub|_ |Coveralls|_ |pypi-license|_ |pypi-version|_ |pypi-python-version|_ |pypi-format|_ |pypi-wheel|_ |pypi-status|_ +*pre-commit-config-shellcheck is a tool for checking entry points in pre-commit config with ShellCheck.* Installation ------------ - In order to use the tool you should first clone it from the source: .. code-block:: bash @@ -27,10 +27,8 @@ or The installation is done and as simple as that. - Usage ----- - To run the program you should start it from terminal and provide with a config file to check: .. code-block:: bash @@ -45,11 +43,10 @@ You could change a default shellcheck call with directory access with the ``-s`` The output from tool usage is sent to the stdout or stderr depending on the operation result. - Contributing ------------ -- Fork the repository +- `Fork it `_ - Install `GNU Make `_ - Install and configure `pyenv `_ and `pyenv-virtualenv plugin `_ - Install and configure `direnv `_ @@ -89,20 +86,44 @@ Contributing git push origin my-new-fix-or-feature -- Create a new Pull Request +- `Create a new Pull Request `_ Licensing --------- - pre-commit-config-shellcheck uses the MIT license. Please check the MIT-LICENSE file for more details. Contacts -------- - **Project Website**: https://github.com/anadea/pre-commit-config-shellcheck/ **Author**: Anadea For contributors list see CONTRIBUTORS file. + + +.. |GitHub| image:: https://github.com/Anadea/pre-commit-config-shellcheck/workflows/build/badge.svg + :alt: GitHub +.. |Coveralls| image:: https://coveralls.io/repos/github/Anadea/pre-commit-config-shellcheck/badge.svg?branch=master + :alt: Coveralls +.. |pypi-license| image:: https://img.shields.io/pypi/l/pre-commit-config-shellcheck + :alt: License +.. |pypi-version| image:: https://img.shields.io/pypi/v/pre-commit-config-shellcheck + :alt: Version +.. |pypi-python-version| image:: https://img.shields.io/pypi/pyversions/pre-commit-config-shellcheck + :alt: Supported Python version +.. |pypi-format| image:: https://img.shields.io/pypi/format/pre-commit-config-shellcheck + :alt: Package format +.. |pypi-wheel| image:: https://img.shields.io/pypi/wheel/pre-commit-config-shellcheck + :alt: Python wheel support +.. |pypi-status| image:: https://img.shields.io/pypi/status/pre-commit-config-shellcheck + :alt: Package status +.. _GitHub: https://github.com/Anadea/pre-commit-config-shellcheck/actions/ +.. _Coveralls: https://coveralls.io/Anadea/pre-commit-config-shellcheck?branch=master +.. _pypi-license: https://pypi.org/project/pre-commit-config-shellcheck/ +.. _pypi-version: https://pypi.org/project/pre-commit-config-shellcheck/ +.. _pypi-python-version: https://pypi.org/project/pre-commit-config-shellcheck/ +.. _pypi-format: https://pypi.org/project/pre-commit-config-shellcheck/ +.. _pypi-wheel: https://pypi.org/project/pre-commit-config-shellcheck/ +.. _pypi-status: https://pypi.org/project/pre-commit-config-shellcheck/ From f89bd0900f9cc8a47b278361f37e9a4ae25e4f4c Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 16:42:26 +0300 Subject: [PATCH 05/11] Added ShellCheck as requirement and fixed tests for a new version --- setup.cfg | 3 ++- tests/test_pre_commit_config_shellcheck.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 7f0e839..9c0b0c7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,7 +30,8 @@ test_suite = tests scripts = pre_commit_config_shellcheck.py install_requires = - pyyaml==6.0 + pyyaml>=6.0 + shellcheck-py>=0.8.0.4 [options.package_data] pre-commit-config-shellcheck = README.rst, MIT-LICENSE, CONTRIBUTORS diff --git a/tests/test_pre_commit_config_shellcheck.py b/tests/test_pre_commit_config_shellcheck.py index 2890f35..8e41da4 100644 --- a/tests/test_pre_commit_config_shellcheck.py +++ b/tests/test_pre_commit_config_shellcheck.py @@ -367,13 +367,13 @@ def test_pre_commit_config_shellcheck___check_entries( expected = """ In entry "removestar" on line 17: removestar -i ${NAME} - ^-----^ SC2086: Double quote to prevent globbing and word splitting. + ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: \nremovestar -i "${NAME}" For more information: https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ... -""" +""" # noqa: E501 assert captured.out == expected From 4d687d23ded4c63df527b4bb67949537492ecf0c Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 16:45:32 +0300 Subject: [PATCH 06/11] Fixed README --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 9996ee6..53c6955 100644 --- a/README.rst +++ b/README.rst @@ -120,7 +120,7 @@ For contributors list see CONTRIBUTORS file. .. |pypi-status| image:: https://img.shields.io/pypi/status/pre-commit-config-shellcheck :alt: Package status .. _GitHub: https://github.com/Anadea/pre-commit-config-shellcheck/actions/ -.. _Coveralls: https://coveralls.io/Anadea/pre-commit-config-shellcheck?branch=master +.. _Coveralls: https://coveralls.io/github/Anadea/pre-commit-config-shellcheck?branch=master .. _pypi-license: https://pypi.org/project/pre-commit-config-shellcheck/ .. _pypi-version: https://pypi.org/project/pre-commit-config-shellcheck/ .. _pypi-python-version: https://pypi.org/project/pre-commit-config-shellcheck/ From 4a760766b89452b0aa40cc2dd4e369f3fe48dc7b Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 17:01:25 +0300 Subject: [PATCH 07/11] And some more checks --- Makefile | 30 ++---------------------------- setup.cfg | 9 +++++++-- 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index 10bada6..52781a4 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,7 @@ .ONESHELL: -PHONY: install tox test bumpversion build sign check check-build check-upload upload clean coveralls release help +PHONY: install tox test bumpversion build check check-build check-upload upload coveralls release help NAME ?= pre-commit-config-shellcheck TEST_PYPI_URL ?= https://test.pypi.org/legacy/ -TRASH_DIRS ?= build dist *.egg-info .tox .mypy_cache .pytest_cache __pycache__ htmlcov -TRASH_FILES ?= .coverage BUILD_TYPES ?= bdist_wheel sdist VERSION ?= `python -c "import configparser; config = configparser.ConfigParser(); config.read('setup.cfg'); print(config['metadata']['version']);"` @@ -27,12 +25,6 @@ build: python setup.py $(BUILD_TYPES);\ -sign: - for package in `ls dist`; do\ - gpg -a --detach-sign dist/$${package};\ - done;\ - - check: bash -c 'NAME="$(NAME)" pre-commit run --all-files';\ @@ -49,33 +41,19 @@ upload: twine upload --skip-existing -s dist/*;\ -clean: - for file in $(TRASH_FILES); do\ - find -iname $${file} -print0 | xargs -0 rm -rf;\ - done;\ - for dir in $(TRASH_DIRS); do\ - find -type d -name $${dir} ! -path "*/.direnv/*" -print0 | xargs -0 rm -rf;\ - done;\ - - coveralls: coveralls;\ release: - make clean && \ make bumpversion && \ git co master && \ - git merge dev && \ - git co dev && \ git push --all && \ git push --tags && \ make build && \ - make sign && \ make check-build && \ make check-upload && \ - make upload && \ - make clean;\ + make upload;\ help: @@ -91,8 +69,6 @@ help: @echo " Tag current code revision with version." @echo " build:" @echo " Build python packages, can specify packages types with 'BUILD_TYPES' variable." - @echo " sign:" - @echo " Sign python packages." @echo " check:" @echo " Perform some code checks." @echo " check-build:" @@ -101,8 +77,6 @@ help: @echo " Upload package to test PyPi using twine." @echo " upload:" @echo " Upload package to PyPi using twine." - @echo " clean:" - @echo " Recursively delete useless autogenerated files and directories, directories and files lists can be overriden through 'TRASH_DIRS' and 'TRASH_FILES' variables." @echo " coveralls:" @echo " Upload coverage report to Coveralls." @echo " release:" diff --git a/setup.cfg b/setup.cfg index 9c0b0c7..df331c2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = pre-commit-config-shellcheck -version = 0.0.0 +version = 0.1.0 description = Tool for shellchecking pre-commit config files. python_requires >= 3.7 license_file = MIT-LICENSE @@ -81,6 +81,7 @@ test = flake8-print==5.0.0 flake8-return==1.1.3 flake8-simplify==0.19.2 + flake8-spellcheck==0.28.0 flake8-typing-imports==1.12.0 flake8-use-fstring==1.3 flake8-variables-names==0.0.5 @@ -133,12 +134,16 @@ warn_no_return = True exclude = setup.py max-line-length = 88 -select = A,B,C,D,E,F,W,T4,C4,TAE,T,M511,T100,TYP,EXE,CFQ,SIM,DUO,N,DJ,ECE,FS,R,CCR,NIC +select = A,B,C,D,E,F,W,T4,C4,TAE,T,M511,T100,TYP,EXE,CFQ,SIM,DUO,N,DJ,ECE,FS,R,CCR,NIC,SC ignore = C101, D100, D104 doctests = True max-annotations-complexity = 5 max-expression-complexity = 5 max-cognitive-complexity = 5 +min-python-version = 3.10 +dictionaries = en_US,python,technical +spellcheck-targets = comments,names + [darglint] docstring_style = sphinx From 49d893661533205162dd5a4da1e137fc4bb6e3f4 Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 17:10:04 +0300 Subject: [PATCH 08/11] Added correct whitelist.txt --- setup.cfg | 1 + whitelist.txt | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 whitelist.txt diff --git a/setup.cfg b/setup.cfg index df331c2..57c41c7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -166,6 +166,7 @@ ignore = tests tests.* TODO + whitelist.txt tests/fixtures/*.yaml diff --git a/whitelist.txt b/whitelist.txt new file mode 100644 index 0000000..5bad8c9 --- /dev/null +++ b/whitelist.txt @@ -0,0 +1,11 @@ +nosec +lst +shellcheck +dst +metavar +osfile +ioerror +tmp +popen +capsys +readouterr From 1168e9d1dbb3ffffa39f4483ea2a03df417653b9 Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 17:14:19 +0300 Subject: [PATCH 09/11] Fixed whitelist.txt --- whitelist.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/whitelist.txt b/whitelist.txt index 5bad8c9..7209626 100644 --- a/whitelist.txt +++ b/whitelist.txt @@ -1,11 +1,12 @@ nosec lst shellcheck -dst +dest metavar osfile -ioerror tmp popen capsys readouterr +ioerr +cmd From 602e36064e5def66b89109d9cab09e210d63ca66 Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 17:20:14 +0300 Subject: [PATCH 10/11] Removed spellcheck due incompatibility with all supported python versions --- setup.cfg | 8 +------- whitelist.txt | 12 ------------ 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 whitelist.txt diff --git a/setup.cfg b/setup.cfg index 57c41c7..a8e3911 100644 --- a/setup.cfg +++ b/setup.cfg @@ -81,7 +81,6 @@ test = flake8-print==5.0.0 flake8-return==1.1.3 flake8-simplify==0.19.2 - flake8-spellcheck==0.28.0 flake8-typing-imports==1.12.0 flake8-use-fstring==1.3 flake8-variables-names==0.0.5 @@ -134,16 +133,12 @@ warn_no_return = True exclude = setup.py max-line-length = 88 -select = A,B,C,D,E,F,W,T4,C4,TAE,T,M511,T100,TYP,EXE,CFQ,SIM,DUO,N,DJ,ECE,FS,R,CCR,NIC,SC +select = A,B,C,D,E,F,W,T4,C4,TAE,T,M511,T100,TYP,EXE,CFQ,SIM,DUO,N,DJ,ECE,FS,R,CCR,NIC ignore = C101, D100, D104 doctests = True max-annotations-complexity = 5 max-expression-complexity = 5 max-cognitive-complexity = 5 -min-python-version = 3.10 -dictionaries = en_US,python,technical -spellcheck-targets = comments,names - [darglint] docstring_style = sphinx @@ -166,7 +161,6 @@ ignore = tests tests.* TODO - whitelist.txt tests/fixtures/*.yaml diff --git a/whitelist.txt b/whitelist.txt deleted file mode 100644 index 7209626..0000000 --- a/whitelist.txt +++ /dev/null @@ -1,12 +0,0 @@ -nosec -lst -shellcheck -dest -metavar -osfile -tmp -popen -capsys -readouterr -ioerr -cmd From cb60416256be9d472be7b2e07ca6028ef727f8b6 Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 17:26:41 +0300 Subject: [PATCH 11/11] Updated CONTRIBUTORS file --- CONTRIBUTORS | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b778502..698be0e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,3 +1,4 @@ Contributors ordered by first contribution. Eugene Pasko +Alexei Andrushievich