diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 24ffa82..68d6abb 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,12 +1,17 @@ [bumpversion] -current_version = 0.0.0 +current_version = 0.1.1 commit = True tag = True [bumpversion:file:repo_helper.yml] -[bumpversion:file:__pkginfo__.py] - [bumpversion:file:README.rst] -[bumpversion:file:flake8_github_action/__init__.py] +[bumpversion:file:flake8_github_actions/__init__.py] + +search = : str = "{current_version}" +replace = : str = "{new_version}" + +[bumpversion:file:pyproject.toml] +search = version = "{current_version}" +replace = version = "{new_version}" diff --git a/.dependabot/config.yml b/.dependabot/config.yml deleted file mode 100644 index 4584924..0000000 --- a/.dependabot/config.yml +++ /dev/null @@ -1,9 +0,0 @@ -# This file is managed by 'repo_helper'. Don't edit it directly. ---- -version: 1 -update_configs: -- package_manager: python - directory: / - update_schedule: weekly - default_reviewers: - - domdfcoding diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 671951b..5551752 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -17,7 +17,10 @@ THE ISSUE WILL BE CLOSED IF INSUFFICIENT INFORMATION IS PROVIDED. ## Steps to Reproduce - + 1. 2. @@ -38,10 +41,10 @@ THE ISSUE WILL BE CLOSED IF INSUFFICIENT INFORMATION IS PROVIDED. * Operating System: * Python: - * flake8-github-action: + * flake8-github-actions: ## Installation source - + ## Other Additional Information: diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index e2e6b5d..e19bfc2 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -20,7 +20,7 @@ assignees: domdfcoding * Operating System: * Python: - * flake8-github-action: + * flake8-github-actions: ## Other Additional Information: diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..454225a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# This file is managed by 'repo_helper'. Don't edit it directly. +--- +version: 2 +updates: +- package-ecosystem: pip + directory: / + schedule: + interval: weekly + open-pull-requests-limit: 0 + reviewers: + - domdfcoding diff --git a/.github/milestones.py b/.github/milestones.py new file mode 100755 index 0000000..5e868dc --- /dev/null +++ b/.github/milestones.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +# stdlib +import os +import sys + +# 3rd party +from github3 import GitHub +from github3.repos import Repository +from packaging.version import InvalidVersion, Version + +latest_tag = os.environ["GITHUB_REF_NAME"] + +try: + current_version = Version(latest_tag) +except InvalidVersion: + sys.exit() + +gh: GitHub = GitHub(token=os.environ["GITHUB_TOKEN"]) +repo: Repository = gh.repository(*os.environ["GITHUB_REPOSITORY"].split('/', 1)) + +for milestone in repo.milestones(state="open"): + try: + milestone_version = Version(milestone.title) + except InvalidVersion: + continue + if milestone_version == current_version: + sys.exit(not milestone.update(state="closed")) diff --git a/.github/stale.yml b/.github/stale.yml index bb7ca3f..bb7fa62 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -7,7 +7,7 @@ daysUntilStale: 180 # Number of days of inactivity before an Issue or Pull Request with the stale label is closed. # Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. -daysUntilClose: 180 +daysUntilClose: false # Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) onlyLabels: [] @@ -28,13 +28,13 @@ exemptMilestones: false exemptAssignees: false # Label to use when marking as stale -staleLabel: wontfix +staleLabel: stale # Comment to post when marking as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. +markComment: false +# This issue has been automatically marked as stale because it has not had +# recent activity. It will be closed if no further activity occurs. Thank you +# for your contributions. # Comment to post when removing the stale label. # unmarkComment: > diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml deleted file mode 100644 index 741c0bd..0000000 --- a/.github/workflows/cleanup.yml +++ /dev/null @@ -1,14 +0,0 @@ -# This file is managed by 'repo_helper'. Don't edit it directly. ---- -name: Artefact Cleaner -on: - schedule: - - cron: 0 9 1 * * -jobs: - Clean: - runs-on: ubuntu-latest - steps: - - name: cleanup - uses: glassechidna/artifact-cleaner@v2 - with: - minimumAge: 1000000.0 diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 4b7ae3e..af1b394 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -4,31 +4,47 @@ name: Flake8 on: push: + branches-ignore: + - 'repo-helper-update' + - 'pre-commit-ci-update-config' + - 'imgbot' pull_request: - branches: ["master"] + +permissions: + contents: read jobs: Run: name: "Flake8" - runs-on: "ubuntu-18.04" + runs-on: "ubuntu-22.04" steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" + + - name: Check for changed files + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!(doc-source/**|CONTRIBUTING.rst|.imgbotconfig|.pre-commit-config.yaml|.pylintrc|.readthedocs.yml)' - name: Setup Python 🐍 - uses: "actions/setup-python@v2" + if: steps.changes.outputs.code == 'true' + uses: "actions/setup-python@v5" with: python-version: "3.8" - name: Install dependencies 🔧 + if: steps.changes.outputs.code == 'true' run: | python -VV python -m site python -m pip install --upgrade pip setuptools wheel - python -m pip install . + python -m pip install tox~=3.0 - name: "Run Flake8" - run: "python -m flake8_github_action flake8_github_action --exit-zero" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: steps.changes.outputs.code == 'true' + run: "python -m tox -e lint -s false -- --format github" diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 0000000..bd74787 --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,54 @@ +# This file is managed by 'repo_helper'. Don't edit it directly. +--- +name: mypy + +on: + push: + branches-ignore: + - 'repo-helper-update' + - 'pre-commit-ci-update-config' + - 'imgbot' + pull_request: + +permissions: + contents: read + +jobs: + Run: + name: "mypy / ${{ matrix.os }}" + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: ['ubuntu-22.04', 'windows-2019'] + fail-fast: false + + steps: + - name: Checkout 🛎️ + uses: "actions/checkout@v4" + + - name: Check for changed files + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!(doc-source/**|CONTRIBUTING.rst|.imgbotconfig|.pre-commit-config.yaml|.pylintrc|.readthedocs.yml)' + + - name: Setup Python 🐍 + if: steps.changes.outputs.code == 'true' + uses: "actions/setup-python@v5" + with: + python-version: "3.8" + + - name: Install dependencies 🔧 + run: | + python -VV + python -m site + python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade tox~=3.0 virtualenv!=20.16.0 + + - name: "Run mypy" + if: steps.changes.outputs.code == 'true' + run: "python -m tox -e mypy -s false" diff --git a/.github/workflows/octocheese.yml b/.github/workflows/octocheese.yml new file mode 100644 index 0000000..208a753 --- /dev/null +++ b/.github/workflows/octocheese.yml @@ -0,0 +1,18 @@ +# This file is managed by 'repo_helper'. Don't edit it directly. +--- + +name: "GitHub Releases" +on: + schedule: + - cron: 0 12 * * * + +jobs: + Run: + runs-on: ubuntu-latest + steps: + - uses: domdfcoding/octocheese@master + with: + pypi_name: "flake8-github-actions" + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + if: startsWith(github.ref, 'refs/tags/') != true diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 7578c5a..cb345af 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -1,39 +1,81 @@ # This file is managed by 'repo_helper'. Don't edit it directly. --- -name: Windows Tests +name: Windows on: push: + branches-ignore: + - 'repo-helper-update' + - 'pre-commit-ci-update-config' + - 'imgbot' + pull_request: - branches: ["master"] + +permissions: + actions: write + issues: write + contents: read jobs: tests: - name: "Python ${{ matrix.python-version }}" + name: "windows-2019 / Python ${{ matrix.config.python-version }}" runs-on: "windows-2019" + continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9' strategy: fail-fast: False matrix: - python-version: ["3.6","3.7","3.8","3.9"] + config: + - {python-version: "3.7", testenvs: "py37-flake8{4,5},build", experimental: False} + - {python-version: "3.8", testenvs: "py38-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.9", testenvs: "py39-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.10", testenvs: "py310-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.11", testenvs: "py311-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.12", testenvs: "py312-flake8{6,7},build", experimental: False} + - {python-version: "3.13", testenvs: "py313-flake8{6,7},build", experimental: False} + - {python-version: "pypy-3.7", testenvs: "pypy37-flake8{4,5},build", experimental: False} + - {python-version: "pypy-3.8", testenvs: "pypy38-flake8{4,5,6,7},build", experimental: False} + - {python-version: "pypy-3.9-v7.3.15", testenvs: "pypy39-flake8{4,5,6,7},build", experimental: True} steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" + + - name: Check for changed files + if: startsWith(github.ref, 'refs/tags/') != true + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!(doc-source/**|CONTRIBUTING.rst|.imgbotconfig|.pre-commit-config.yaml|.pylintrc|.readthedocs.yml)' - name: Setup Python 🐍 - uses: "actions/setup-python@v2" + id: setup-python + if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} + uses: "actions/setup-python@v5" with: - python-version: "${{ matrix.python-version }}" + python-version: "${{ matrix.config.python-version }}" - name: Install dependencies 🔧 + if: steps.setup-python.outcome == 'success' run: | python -VV python -m site python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox tox-gh-actions virtualenv + python -m pip install --upgrade tox~=3.0 virtualenv!=20.16.0 + + - name: "Run Tests for Python ${{ matrix.config.python-version }}" + if: steps.setup-python.outcome == 'success' + run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - - name: "Run Tests for Python ${{ matrix.python-version }}" - run: "python -m tox" + - name: "Upload Coverage 🚀" + uses: actions/upload-artifact@v4 + if: ${{ always() && steps.setup-python.outcome == 'success' }} + with: + name: "coverage-${{ matrix.config.python-version }}" + path: .coverage + include-hidden-files: true diff --git a/.github/workflows/python_ci_linux.yml b/.github/workflows/python_ci_linux.yml index bf1d4c8..375441c 100644 --- a/.github/workflows/python_ci_linux.yml +++ b/.github/workflows/python_ci_linux.yml @@ -1,72 +1,176 @@ # This file is managed by 'repo_helper'. Don't edit it directly. --- -name: Linux Tests +name: Linux on: push: + branches-ignore: + - 'repo-helper-update' + - 'pre-commit-ci-update-config' + - 'imgbot' + tags: + - '*' pull_request: - branches: ["master"] + +permissions: + actions: write + issues: write + contents: read jobs: tests: - name: "Python ${{ matrix.python-version }}" - runs-on: "ubuntu-18.04" + name: "ubuntu-22.04 / Python ${{ matrix.config.python-version }}" + runs-on: "ubuntu-22.04" + continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9' strategy: fail-fast: False matrix: - python-version: ["3.6","3.7","3.8","3.9"] + config: + - {python-version: "3.7", testenvs: "py37-flake8{4,5},build", experimental: False} + - {python-version: "3.8", testenvs: "py38-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.9", testenvs: "py39-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.10", testenvs: "py310-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.11", testenvs: "py311-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.12", testenvs: "py312-flake8{6,7},build", experimental: False} + - {python-version: "3.13", testenvs: "py313-flake8{6,7},build", experimental: False} + - {python-version: "pypy-3.7", testenvs: "pypy37-flake8{4,5},build", experimental: False} + - {python-version: "pypy-3.8", testenvs: "pypy38-flake8{4,5,6,7},build", experimental: False} + - {python-version: "pypy-3.9", testenvs: "pypy39-flake8{4,5,6,7},build", experimental: True} steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" + + - name: Check for changed files + if: startsWith(github.ref, 'refs/tags/') != true + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!(doc-source/**|CONTRIBUTING.rst|.imgbotconfig|.pre-commit-config.yaml|.pylintrc|.readthedocs.yml)' - name: Setup Python 🐍 - uses: "actions/setup-python@v2" + id: setup-python + if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} + uses: "actions/setup-python@v5" with: - python-version: "${{ matrix.python-version }}" + python-version: "${{ matrix.config.python-version }}" - name: Install dependencies 🔧 + if: steps.setup-python.outcome == 'success' run: | python -VV python -m site python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox tox-gh-actions virtualenv + python -m pip install --upgrade tox~=3.0 virtualenv!=20.16.0 + python -m pip install --upgrade coverage_pyver_pragma + + - name: "Run Tests for Python ${{ matrix.config.python-version }}" + if: steps.setup-python.outcome == 'success' + run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - - name: "Run Tests for Python ${{ matrix.python-version }}" - run: "python -m tox" + - name: "Upload Coverage 🚀" + uses: actions/upload-artifact@v4 + if: ${{ always() && steps.setup-python.outcome == 'success' }} + with: + name: "coverage-${{ matrix.config.python-version }}" + path: .coverage + include-hidden-files: true + + + Coverage: + needs: tests + runs-on: "ubuntu-22.04" + steps: + - name: Checkout 🛎️ + uses: "actions/checkout@v4" + - name: Setup Python 🐍 + uses: "actions/setup-python@v5" + with: + python-version: 3.8 + - name: Install dependencies 🔧 + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade "coveralls>=3.0.0" coverage_pyver_pragma + + - name: "Download Coverage 🪂" + uses: actions/download-artifact@v4 + with: + path: coverage + + - name: Display structure of downloaded files + id: show + run: ls -R + working-directory: coverage + continue-on-error: true + + - name: Combine Coverage 👷 + if: ${{ steps.show.outcome != 'failure' }} + run: | + shopt -s globstar + python -m coverage combine coverage/**/.coverage + + - name: "Upload Combined Coverage Artefact 🚀" + if: ${{ steps.show.outcome != 'failure' }} + uses: actions/upload-artifact@v4 + with: + name: "combined-coverage" + path: .coverage + include-hidden-files: true + + - name: "Upload Combined Coverage to Coveralls" + if: ${{ steps.show.outcome != 'failure' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + coveralls --service=github Deploy: needs: tests - runs-on: "ubuntu-18.04" + runs-on: "ubuntu-22.04" steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" + if: startsWith(github.ref, 'refs/tags/') - name: Setup Python 🐍 - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v5" + if: startsWith(github.ref, 'refs/tags/') with: python-version: 3.8 - name: Install dependencies 🔧 + if: startsWith(github.ref, 'refs/tags/') run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox + python -m pip install --upgrade tox~=3.0 - name: Build distributions 📦 + if: startsWith(github.ref, 'refs/tags/') run: | tox -e build - - name: Upload distribution 📦 to PyPI + - name: Upload distribution to PyPI 🚀 if: startsWith(github.ref, 'refs/tags/') - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@v1.4.2 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} skip_existing: true + + - name: Close milestone 🚪 + if: startsWith(github.ref, 'refs/tags/') + run: | + python -m pip install --upgrade github3.py packaging + python .github/milestones.py + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/python_ci_macos.yml b/.github/workflows/python_ci_macos.yml index dbdba84..ea5934c 100644 --- a/.github/workflows/python_ci_macos.yml +++ b/.github/workflows/python_ci_macos.yml @@ -1,39 +1,81 @@ # This file is managed by 'repo_helper'. Don't edit it directly. --- -name: macOS Tests +name: macOS on: push: + branches-ignore: + - 'repo-helper-update' + - 'pre-commit-ci-update-config' + - 'imgbot' + pull_request: - branches: ["master"] + +permissions: + actions: write + issues: write + contents: read jobs: tests: - name: "Python ${{ matrix.python-version }}" - runs-on: "macos-latest" + name: "macos-${{ matrix.config.os-ver }} / Python ${{ matrix.config.python-version }}" + runs-on: "macos-${{ matrix.config.os-ver }}" + continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9' strategy: fail-fast: False matrix: - python-version: ["3.6","3.7","3.8","3.9"] + config: + - {python-version: "3.7", os-ver: "13", testenvs: "py37-flake8{4,5},build", experimental: False} + - {python-version: "3.8", os-ver: "14", testenvs: "py38-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.9", os-ver: "14", testenvs: "py39-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.10", os-ver: "14", testenvs: "py310-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.11", os-ver: "14", testenvs: "py311-flake8{4,5,6,7},build", experimental: False} + - {python-version: "3.12", os-ver: "14", testenvs: "py312-flake8{6,7},build", experimental: False} + - {python-version: "3.13", os-ver: "14", testenvs: "py313-flake8{6,7},build", experimental: False} + - {python-version: "pypy-3.7", os-ver: "13", testenvs: "pypy37-flake8{4,5},build", experimental: False} + - {python-version: "pypy-3.8", os-ver: "14", testenvs: "pypy38-flake8{4,5,6,7},build", experimental: False} + - {python-version: "pypy-3.9", os-ver: "14", testenvs: "pypy39-flake8{4,5,6,7},build", experimental: True} steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" + + - name: Check for changed files + if: startsWith(github.ref, 'refs/tags/') != true + uses: dorny/paths-filter@v2 + id: changes + with: + list-files: "json" + filters: | + code: + - '!(doc-source/**|CONTRIBUTING.rst|.imgbotconfig|.pre-commit-config.yaml|.pylintrc|.readthedocs.yml)' - name: Setup Python 🐍 - uses: "actions/setup-python@v2" + id: setup-python + if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} + uses: "actions/setup-python@v5" with: - python-version: "${{ matrix.python-version }}" + python-version: "${{ matrix.config.python-version }}" - name: Install dependencies 🔧 + if: steps.setup-python.outcome == 'success' run: | python -VV python -m site python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox tox-gh-actions virtualenv + python -m pip install --upgrade tox~=3.0 virtualenv!=20.16.0 + + - name: "Run Tests for Python ${{ matrix.config.python-version }}" + if: steps.setup-python.outcome == 'success' + run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - - name: "Run Tests for Python ${{ matrix.python-version }}" - run: "python -m tox" + - name: "Upload Coverage 🚀" + uses: actions/upload-artifact@v4 + if: ${{ always() && steps.setup-python.outcome == 'success' }} + with: + name: "coverage-${{ matrix.config.python-version }}" + path: .coverage + include-hidden-files: true diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index 7800ed5..0000000 --- a/.isort.cfg +++ /dev/null @@ -1,28 +0,0 @@ -[settings] -line_length = 115 -force_to_top = True -indent = " " -multi_line_output = 8 -import_heading_stdlib = stdlib -import_heading_thirdparty = 3rd party -import_heading_firstparty = this package -import_heading_localfolder = this package -balanced_wrapping = False -lines_between_types = 0 -use_parentheses = True -remove_redundant_aliases = True -default_section = THIRDPARTY -known_third_party = - apeye - attrs - click - consolekit - domdf_python_tools - dulwich - flake8 - flake8_json - github - github3_py - requests - typing_extensions -known_first_party = flake8_github_action diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e40722b..e730967 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,19 @@ # This file is managed by 'repo_helper'. Don't edit it directly. --- -exclude: ^$ +exclude: ^tests/bad_code.py$ + +ci: + autoupdate_schedule: quarterly repos: + - repo: https://github.com/repo-helper/pyproject-parser + rev: v0.13.0 + hooks: + - id: reformat-pyproject + - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.3.0 + rev: v3.4.0 hooks: - id: check-added-large-files - id: check-ast @@ -25,50 +33,64 @@ repos: - id: end-of-file-fixer - repo: https://github.com/domdfcoding/pre-commit-hooks - rev: v0.1.6 + rev: v0.4.0 hooks: - id: requirements-txt-sorter args: - --allow-git - id: check-docstring-first - exclude: ^(doc-source/conf|__pkginfo__|make_conda_recipe|setup|tests/.*)\.py$ + exclude: ^(doc-source/conf|__pkginfo__|setup|tests/.*)\.py$ - id: bind-requirements - - repo: https://github.com/domdfcoding/flake8-dunder-all - rev: v0.1.3 + - repo: https://github.com/python-formate/flake8-dunder-all + rev: v0.4.1 hooks: - id: ensure-dunder-all - files: ^flake8_github_action/.*\.py$ + files: ^flake8_github_actions/.*\.py$ + + - repo: https://github.com/domdfcoding/flake2lint + rev: v0.4.3 + hooks: + - id: flake2lint - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.7.0 + rev: v1.10.0 hooks: - id: python-no-eval + - id: rst-backticks + - id: rst-directive-colons + - id: rst-inline-touching-normal - repo: https://github.com/asottile/pyupgrade - rev: v2.7.4 + rev: v2.12.0 hooks: - id: pyupgrade args: - --py36-plus + - --keep-runtime-typing - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.1.9 + rev: v1.5.1 hooks: - id: remove-crlf - id: forbid-crlf - - repo: https://github.com/domdfcoding/yapf-isort - rev: v0.5.4 + - repo: https://github.com/python-formate/snippet-fmt + rev: v0.1.5 hooks: - - id: yapf-isort - exclude: ^(doc-source/conf|__pkginfo__|make_conda_recipe|setup)\.py$ + - id: snippet-fmt - - repo: https://github.com/domdfcoding/dep_checker - rev: v0.4.1 + - repo: https://github.com/python-formate/formate + rev: v0.8.0 + hooks: + - id: formate + exclude: ^(doc-source/conf|__pkginfo__|setup)\.(_)?py$ + + - repo: https://github.com/python-coincidence/dep_checker + rev: v0.8.0 hooks: - id: dep_checker args: - - flake8_github_action + - flake8_github_actions # Custom hooks can be added below this comment diff --git a/.pylintrc b/.pylintrc index cfee0f1..81ecba0 100644 --- a/.pylintrc +++ b/.pylintrc @@ -66,7 +66,7 @@ confidence= # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" disable=all -enable=assert-on-tuple,astroid-error,bad-except-order,bad-inline-option,bad-option-value,bad-reversed-sequence,bare-except,binary-op-exception,boolean-datetime,catching-non-exception,cell-var-from-loop,confusing-with-statement,consider-merging-isinstance,consider-using-enumerate,consider-using-ternary,continue-in-finally,cyclic-import,deprecated-pragma,django-not-available,duplicate-except,duplicate-key,eval-used,exec-used,expression-not-assigned,fatal,file-ignored,fixme,global-at-module-level,global-statement,global-variable-not-assigned,global-variable-undefined,http-response-with-content-type-json,http-response-with-json-dumps,invalid-all-object,invalid-characters-in-docstring,len-as-condition,literal-comparison,locally-disabled,locally-enabled,lost-exception,lowercase-l-suffix,misplaced-bare-raise,missing-kwoa,mixed-line-endings,model-has-unicode,model-missing-unicode,model-no-explicit-unicode,model-unicode-not-callable,multiple-imports,multiple-statements,new-db-field-with-default,non-ascii-bytes-literals,nonexistent-operator,not-an-iterable,not-in-loop,notimplemented-raised,overlapping-except,parse-error,pointless-statement,pointless-string-statement,raising-bad-type,raising-non-exception,raw-checker-failed,redefine-in-handler,redefined-argument-from-local,redefined-builtin,redundant-content-type-for-json-response,reimported,relative-import,return-outside-function,simplifiable-if-statement,singleton-comparison,syntax-error,trailing-comma-tuple,trailing-newlines,unbalanced-tuple-unpacking,undefined-all-variable,undefined-loop-variable,unexpected-line-ending-format,unidiomatic-typecheck,unnecessary-lambda,unnecessary-pass,unnecessary-semicolon,unneeded-not,unpacking-non-sequence,unreachable,unrecognized-inline-option,used-before-assignment,useless-else-on-loop,using-constant-test,wildcard-import,yield-outside-function,useless-return +enable=assert-on-tuple,astroid-error,bad-except-order,bad-inline-option,bad-option-value,bad-reversed-sequence,bare-except,binary-op-exception,boolean-datetime,catching-non-exception,cell-var-from-loop,confusing-with-statement,consider-merging-isinstance,consider-using-enumerate,consider-using-ternary,continue-in-finally,deprecated-pragma,django-not-available,duplicate-except,duplicate-key,eval-used,exec-used,expression-not-assigned,fatal,file-ignored,fixme,global-at-module-level,global-statement,global-variable-not-assigned,global-variable-undefined,http-response-with-content-type-json,http-response-with-json-dumps,invalid-all-object,invalid-characters-in-docstring,len-as-condition,literal-comparison,locally-disabled,locally-enabled,lost-exception,lowercase-l-suffix,misplaced-bare-raise,missing-kwoa,mixed-line-endings,model-has-unicode,model-missing-unicode,model-no-explicit-unicode,model-unicode-not-callable,multiple-imports,new-db-field-with-default,non-ascii-bytes-literals,nonexistent-operator,not-in-loop,notimplemented-raised,overlapping-except,parse-error,pointless-statement,pointless-string-statement,raising-bad-type,raising-non-exception,raw-checker-failed,redefine-in-handler,redefined-argument-from-local,redefined-builtin,redundant-content-type-for-json-response,reimported,relative-import,return-outside-function,simplifiable-if-statement,singleton-comparison,syntax-error,trailing-comma-tuple,trailing-newlines,unbalanced-tuple-unpacking,undefined-all-variable,undefined-loop-variable,unexpected-line-ending-format,unidiomatic-typecheck,unnecessary-lambda,unnecessary-pass,unnecessary-semicolon,unneeded-not,unpacking-non-sequence,unreachable,unrecognized-inline-option,used-before-assignment,useless-else-on-loop,using-constant-test,wildcard-import,yield-outside-function,useless-return [REPORTS] diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index bd9ebf4..81ce059 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -4,7 +4,8 @@ Contributing .. This file based on https://github.com/PyGithub/PyGithub/blob/master/CONTRIBUTING.md -``flake8-github-action`` uses `tox `_ to automate testing and packaging, and `pre-commit `_ to maintain code quality. +``flake8-github-actions`` uses `tox `_ to automate testing and packaging, +and `pre-commit `_ to maintain code quality. Install ``pre-commit`` with ``pip`` and install the git hook: @@ -17,13 +18,13 @@ Install ``pre-commit`` with ``pip`` and install the git hook: Coding style -------------- -`yapf-isort `_ is used for code formatting. +`formate `_ is used for code formatting. It can be run manually via ``pre-commit``: .. code-block:: bash - $ pre-commit run yapf-isort -a + $ pre-commit run formate -a Or, to run the complete autoformatting suite: @@ -36,11 +37,12 @@ Or, to run the complete autoformatting suite: Automated tests ------------------- -Tests are run with ``tox`` and ``pytest``. To run tests for a specific Python version, such as Python 3.6, run: +Tests are run with ``tox`` and ``pytest``. +To run tests for a specific Python version, such as Python 3.10: .. code-block:: bash - $ tox -e py36 + $ tox -e py310 To run tests for all Python versions, simply run: diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 0bde31e..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include __pkginfo__.py -include LICENSE -include requirements.txt -prune **/__pycache__ -recursive-include flake8_github_action *.pyi -include flake8_github_action/py.typed diff --git a/README.rst b/README.rst index a295278..a965bec 100644 --- a/README.rst +++ b/README.rst @@ -1,10 +1,10 @@ -##################### -flake8-github-action -##################### +####################### +flake8-github-actions +####################### .. start short_desc -**GitHub Action to run flake8.** +**GitHub Actions integration for flake8.** .. end short_desc @@ -16,76 +16,85 @@ flake8-github-action :widths: 10 90 * - Tests - - |travis| |actions_windows| |actions_macos| |codefactor| |pre_commit_ci| - + - |actions_linux| |actions_windows| |actions_macos| |coveralls| + * - PyPI + - |pypi-version| |supported-versions| |supported-implementations| |wheel| * - Activity - - |commits-latest| |commits-since| |maintained| + - |commits-latest| |commits-since| |maintained| |pypi-downloads| + * - QA + - |codefactor| |actions_flake8| |actions_mypy| * - Other - - |license| |language| |requires| |pre_commit| - + - |license| |language| |requires| - -.. |travis| image:: https://github.com/domdfcoding/flake8-github-action/workflows/Linux%20Tests/badge.svg - :target: https://github.com/domdfcoding/flake8-github-action/actions?query=workflow%3A%22Linux+Tests%22 +.. |actions_linux| image:: https://github.com/python-formate/flake8-github-actions/workflows/Linux/badge.svg + :target: https://github.com/python-formate/flake8-github-actions/actions?query=workflow%3A%22Linux%22 :alt: Linux Test Status -.. |actions_windows| image:: https://github.com/domdfcoding/flake8-github-action/workflows/Windows%20Tests/badge.svg - :target: https://github.com/domdfcoding/flake8-github-action/actions?query=workflow%3A%22Windows+Tests%22 +.. |actions_windows| image:: https://github.com/python-formate/flake8-github-actions/workflows/Windows/badge.svg + :target: https://github.com/python-formate/flake8-github-actions/actions?query=workflow%3A%22Windows%22 :alt: Windows Test Status -.. |actions_macos| image:: https://github.com/domdfcoding/flake8-github-action/workflows/macOS%20Tests/badge.svg - :target: https://github.com/domdfcoding/flake8-github-action/actions?query=workflow%3A%22macOS+Tests%22 +.. |actions_macos| image:: https://github.com/python-formate/flake8-github-actions/workflows/macOS/badge.svg + :target: https://github.com/python-formate/flake8-github-actions/actions?query=workflow%3A%22macOS%22 :alt: macOS Test Status -.. |requires| image:: https://requires.io/github/domdfcoding/flake8-github-action/requirements.svg?branch=master - :target: https://requires.io/github/domdfcoding/flake8-github-action/requirements/?branch=master +.. |actions_flake8| image:: https://github.com/python-formate/flake8-github-actions/workflows/Flake8/badge.svg + :target: https://github.com/python-formate/flake8-github-actions/actions?query=workflow%3A%22Flake8%22 + :alt: Flake8 Status + +.. |actions_mypy| image:: https://github.com/python-formate/flake8-github-actions/workflows/mypy/badge.svg + :target: https://github.com/python-formate/flake8-github-actions/actions?query=workflow%3A%22mypy%22 + :alt: mypy status + +.. |requires| image:: https://dependency-dash.repo-helper.uk/github/python-formate/flake8-github-actions/badge.svg + :target: https://dependency-dash.repo-helper.uk/github/python-formate/flake8-github-actions/ :alt: Requirements Status -.. |codefactor| image:: https://img.shields.io/codefactor/grade/github/domdfcoding/flake8-github-action?logo=codefactor - :target: https://www.codefactor.io/repository/github/domdfcoding/flake8-github-action +.. |coveralls| image:: https://img.shields.io/coveralls/github/python-formate/flake8-github-actions/master?logo=coveralls + :target: https://coveralls.io/github/python-formate/flake8-github-actions?branch=master + :alt: Coverage + +.. |codefactor| image:: https://img.shields.io/codefactor/grade/github/python-formate/flake8-github-actions?logo=codefactor + :target: https://www.codefactor.io/repository/github/python-formate/flake8-github-actions :alt: CodeFactor Grade -.. |pypi-version| image:: https://img.shields.io/pypi/v/flake8-github-action - :target: https://pypi.org/project/flake8-github-action/ +.. |pypi-version| image:: https://img.shields.io/pypi/v/flake8-github-actions + :target: https://pypi.org/project/flake8-github-actions/ :alt: PyPI - Package Version -.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/flake8-github-action?logo=python&logoColor=white - :target: https://pypi.org/project/flake8-github-action/ +.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/flake8-github-actions?logo=python&logoColor=white + :target: https://pypi.org/project/flake8-github-actions/ :alt: PyPI - Supported Python Versions -.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/flake8-github-action - :target: https://pypi.org/project/flake8-github-action/ +.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/flake8-github-actions + :target: https://pypi.org/project/flake8-github-actions/ :alt: PyPI - Supported Implementations -.. |wheel| image:: https://img.shields.io/pypi/wheel/flake8-github-action - :target: https://pypi.org/project/flake8-github-action/ +.. |wheel| image:: https://img.shields.io/pypi/wheel/flake8-github-actions + :target: https://pypi.org/project/flake8-github-actions/ :alt: PyPI - Wheel -.. |license| image:: https://img.shields.io/github/license/domdfcoding/flake8-github-action - :target: https://github.com/domdfcoding/flake8-github-action/blob/master/LICENSE +.. |license| image:: https://img.shields.io/github/license/python-formate/flake8-github-actions + :target: https://github.com/python-formate/flake8-github-actions/blob/master/LICENSE :alt: License -.. |language| image:: https://img.shields.io/github/languages/top/domdfcoding/flake8-github-action +.. |language| image:: https://img.shields.io/github/languages/top/python-formate/flake8-github-actions :alt: GitHub top language -.. |commits-since| image:: https://img.shields.io/github/commits-since/domdfcoding/flake8-github-action/v0.0.0 - :target: https://github.com/domdfcoding/flake8-github-action/pulse +.. |commits-since| image:: https://img.shields.io/github/commits-since/python-formate/flake8-github-actions/v0.1.1 + :target: https://github.com/python-formate/flake8-github-actions/pulse :alt: GitHub commits since tagged version -.. |commits-latest| image:: https://img.shields.io/github/last-commit/domdfcoding/flake8-github-action - :target: https://github.com/domdfcoding/flake8-github-action/commit/master +.. |commits-latest| image:: https://img.shields.io/github/last-commit/python-formate/flake8-github-actions + :target: https://github.com/python-formate/flake8-github-actions/commit/master :alt: GitHub last commit -.. |maintained| image:: https://img.shields.io/maintenance/yes/2020 +.. |maintained| image:: https://img.shields.io/maintenance/yes/2025 :alt: Maintenance -.. |pre_commit| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white - :target: https://github.com/pre-commit/pre-commit - :alt: pre-commit - -.. |pre_commit_ci| image:: https://results.pre-commit.ci/badge/github/domdfcoding/flake8-github-action/master.svg - :target: https://results.pre-commit.ci/latest/github/domdfcoding/flake8-github-action/master - :alt: pre-commit.ci status +.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/flake8-github-actions + :target: https://pypi.org/project/flake8-github-actions/ + :alt: PyPI - Downloads .. end shields @@ -93,4 +102,59 @@ Installation -------------- .. start installation + +``flake8-github-actions`` can be installed from PyPI. + +To install with ``pip``: + +.. code-block:: bash + + $ python -m pip install flake8-github-actions + .. end installation + +Use with GitHub Actions +---------------------------- + +Example workflow: + +.. code-block:: yaml + + --- + + name: Flake8 + + on: + push: + pull_request: + branches: ["master"] + + jobs: + Run: + name: "Flake8" + runs-on: "ubuntu-18.04" + + steps: + - name: Checkout 🛎️ + uses: "actions/checkout@v2" + + - name: Setup Python 🐍 + uses: "actions/setup-python@v2" + with: + python-version: "3.8" + + - name: Install dependencies 🔧 + run: | + python -VV + python -m site + python -m pip install --upgrade pip setuptools wheel + python -m pip install flake8 + python -m pip install flake8-github-actions + + - name: "Run Flake8" + run: "flake8 --format github" + + +The annotations will look something like: + +.. image:: https://raw.githubusercontent.com/domdfcoding/flake8-github-actions/master/example_annotations.png diff --git a/__pkginfo__.py b/__pkginfo__.py deleted file mode 100644 index f107a7e..0000000 --- a/__pkginfo__.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file is managed by 'repo_helper'. Don't edit it directly. -# Copyright © 2020 Dominic Davis-Foster -# -# This file is distributed under the same license terms as the program it came with. -# There will probably be a file called LICEN[S/C]E in the same directory as this file. -# -# In any case, this program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# -# This script based on https://github.com/rocky/python-uncompyle6/blob/master/__pkginfo__.py -# - -# stdlib -import pathlib - -__all__ = [ - "__copyright__", - "__version__", - "repo_root", - "install_requires", - "extras_require", - ] - -__copyright__ = """ -2020 Dominic Davis-Foster -""" - -__version__ = "0.0.0" - -repo_root = pathlib.Path(__file__).parent -install_requires = (repo_root / "requirements.txt").read_text(encoding="utf-8").split('\n') -extras_require = {"all": []} diff --git a/example_annotations.png b/example_annotations.png new file mode 100644 index 0000000..50d3f0d Binary files /dev/null and b/example_annotations.png differ diff --git a/flake8_github_action/__init__.py b/flake8_github_action/__init__.py deleted file mode 100644 index 996b86c..0000000 --- a/flake8_github_action/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python3 -# -# __init__.py -""" -GitHub Action to run flake8. -""" -# -# Copyright © 2020 Dominic Davis-Foster -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE -# OR OTHER DEALINGS IN THE SOFTWARE. -# - -# 3rd party -from typing_extensions import NoReturn - -# this package -from flake8_github_action.flake8_app import Application - -__author__: str = "Dominic Davis-Foster" -__copyright__: str = "2020 Dominic Davis-Foster" -__license__: str = "MIT License" -__version__: str = "0.0.0" -__email__: str = "dominic@davis-foster.co.uk" - -__all__ = ["action"] - - -def action(*args, ) -> NoReturn: - r""" - Action! - - :param \*args: flake8 command line arguments. - """ - - flake8_app = Application() - flake8_app.run(args) - flake8_app.exit() diff --git a/flake8_github_action/__main__.py b/flake8_github_action/__main__.py deleted file mode 100644 index 9012f7e..0000000 --- a/flake8_github_action/__main__.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 -# -# __main__.py -""" -CLI entry point. -""" -# -# Copyright (c) 2020 Dominic Davis-Foster -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# - -# stdlib -import sys - -# 3rd party -import click -from consolekit import CONTEXT_SETTINGS - -__all__ = ["main"] - - -@click.command(context_settings={"ignore_unknown_options": True, "allow_extra_args": True, **CONTEXT_SETTINGS}) -@click.pass_context -def main(ctx: click.Context): - """ - Run flake8 and add the errors as annotations on GitHub. - - All options and arguments are passed through to flake8. - """ - - # this package - from flake8_github_action import action - - action(*ctx.args) - - -if __name__ == "__main__": - sys.exit(main(obj={})) - - - - diff --git a/flake8_github_action/flake8_app.py b/flake8_github_action/flake8_app.py deleted file mode 100644 index 0e591a7..0000000 --- a/flake8_github_action/flake8_app.py +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/env python3 -# -# flake8_app.py -""" -Subclass of Flake8's ``Application``. -""" -# -# Copyright (c) 2020 Dominic Davis-Foster -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# "Application" based on Flake8 -# Copyright (C) 2011-2013 Tarek Ziade -# Copyright (C) 2012-2016 Ian Cordasco -# MIT Licensed -# -# "GitHubFormatter" based on https://gitlab.com/pycqa/flake8-json -# Copyright (C) 2017-2018 Ian Stapleton Cordasco -# MIT Licensed -# - -# stdlib -from functools import partial -from gettext import ngettext -from typing import Optional, Tuple, Type - -# 3rd party -import click -import flake8.main.application # type: ignore -from flake8.formatting.base import BaseFormatter # type: ignore -from typing_extensions import NoReturn - -__all__ = ["Application", "GitHubFormatter"] - -_error = partial(ngettext, "error", "errors") -_file = partial(ngettext, "file", "files") - - -class Application(flake8.main.application.Application): - """ - Subclass of Flake8's ``Application``. - """ - - def exit(self) -> NoReturn: - """ - Handle finalization and exiting the program. - - This should be the last thing called on the application instance. - It will check certain options and exit appropriately. - """ - - if self.options.count: - if True: - files_checked = self.file_checker_manager.statistics["files"] - files_with_errors = self.file_checker_manager.statistics["files_with_errors"] - if self.result_count: - click.echo( - f"Found {self.result_count} {_error(self.result_count)} " - f"in {files_with_errors} {_file(files_with_errors)} " - f"(checked {files_checked} source {_file(files_checked)})" - ) - else: - click.echo(f"Success: no issues found in {files_checked} source {_file(files_checked)}") - - if self.options.exit_zero: - raise SystemExit(self.catastrophic_failure) - else: - raise SystemExit((self.result_count > 0) or self.catastrophic_failure) - - def report_errors(self) -> None: - """ - Report all the errors found by flake8 3.0. - - This also updates the :attr:`result_count` attribute with the total - number of errors, warnings, and other messages found. - """ - - flake8.main.application.LOG.info("Reporting errors") - - files_with_errors = results_reported = results_found = 0 - - for checker in self.file_checker_manager._all_checkers: - results_ = sorted(checker.results, key=lambda tup: (tup[1], tup[2])) - filename = checker.display_name - - with self.file_checker_manager.style_guide.processing_file(filename): - results_reported_for_file = self.file_checker_manager._handle_results(filename, results_) - if results_reported_for_file: - results_reported += results_reported_for_file - files_with_errors += 1 - - results_found += len(results_) - - results: Tuple[int, int] = (results_found, results_reported) - - self.total_result_count, self.result_count = results - flake8.main.application.LOG.info( - "Found a total of %d violations and reported %d", - self.total_result_count, - self.result_count, - ) - - self.file_checker_manager.statistics["files_with_errors"] = files_with_errors - - def make_formatter(self, formatter_class: Optional[Type[BaseFormatter]] = None) -> None: - """ - Initialize a formatter based on the parsed options. - """ - - self.formatter = GitHubFormatter(self.options) - - -class GitHubFormatter(BaseFormatter): - - def write_line(self, line): - """ - Override write for convenience. - """ - self.write(line, None) - - def start(self): - super().start() - self.files_reported_count = 0 - - def beginning(self, filename): - """ - We're starting a new file. - """ - - self.reported_errors_count = 0 - - def finished(self, filename): - """ - We've finished processing a file. - """ - - self.files_reported_count += 1 - - def format(self, violation): - """ - Format a violation. - """ - - if self.reported_errors_count == 0: - self.write_line(violation.filename) - - self.write_line( - f"::warning " - f"file={violation.filename},line={violation.line_number},col={violation.column_number}" - f"::{violation.code}: {violation.text}" - ) - - self.reported_errors_count += 1 diff --git a/flake8_github_actions/__init__.py b/flake8_github_actions/__init__.py new file mode 100644 index 0000000..6bb2be0 --- /dev/null +++ b/flake8_github_actions/__init__.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +# +# __init__.py +""" +GitHub Actions integration for flake8. +""" +# +# Copyright © 2020-2021 Dominic Davis-Foster +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +# OR OTHER DEALINGS IN THE SOFTWARE. +# + +# stdlib +from typing import Any + +# 3rd party +from flake8.formatting.base import BaseFormatter # type: ignore + +__author__: str = "Dominic Davis-Foster" +__copyright__: str = "2020-2021 Dominic Davis-Foster" +__license__: str = "MIT License" +__version__: str = "0.1.1" +__email__: str = "dominic@davis-foster.co.uk" + +__all__ = ("GitHubFormatter", ) + + +class GitHubFormatter(BaseFormatter): + """ + Custom Flake8 formatter for GitHub actions. + """ + + reported_errors_count: int + + def write_line(self, line: str) -> None: + """ + Override write for convenience. + """ + self.write(line, None) + + def start(self) -> None: # noqa: D102 + super().start() + self.files_reported_count = 0 + + def beginning(self, filename: Any) -> None: + """ + We're starting a new file. + """ + + self.reported_errors_count = 0 + + def finished(self, filename: Any) -> None: + """ + We've finished processing a file. + """ + + self.files_reported_count += 1 + + def format(self, violation) -> None: # noqa: A003 # pylint: disable=redefined-builtin + """ + Format a violation. + """ + + if self.reported_errors_count == 0: + self.write_line(violation.filename) + + self.write_line( + f"::warning " + f"file={violation.filename},line={violation.line_number},col={violation.column_number}" + f"::{violation.code}: {violation.text}" + ) + + self.reported_errors_count += 1 diff --git a/flake8_github_actions/py.typed b/flake8_github_actions/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/formate.toml b/formate.toml new file mode 100644 index 0000000..0ca5060 --- /dev/null +++ b/formate.toml @@ -0,0 +1,57 @@ +[hooks] +dynamic_quotes = 10 +collections-import-rewrite = 20 +reformat-generics = 40 +noqa-reformat = 60 +ellipsis-reformat = 70 +squish_stubs = 80 + +[hooks.yapf] +priority = 30 + +[hooks.yapf.kwargs] +yapf_style = ".style.yapf" + +[hooks.isort] +priority = 50 + +[hooks.isort.kwargs] +indent = " " +multi_line_output = 8 +import_heading_stdlib = "stdlib" +import_heading_thirdparty = "3rd party" +import_heading_firstparty = "this package" +import_heading_localfolder = "this package" +balanced_wrapping = false +lines_between_types = 0 +use_parentheses = true +remove_redundant_aliases = true +default_section = "THIRDPARTY" +known_third_party = [ + "apeye", + "attrs", + "click", + "coincidence", + "consolekit", + "coverage", + "coverage_pyver_pragma", + "domdf_python_tools", + "dulwich", + "flake8", + "flake8_json", + "flake8_prettycount", + "github", + "github3_py", + "importlib_metadata", + "pytest", + "pytest_cov", + "pytest_randomly", + "pytest_timeout", + "requests", + "typing_extensions", +] +known_first_party = [ "flake8_github_actions",] + +[config] +indent = " " +line_length = 115 diff --git a/justfile b/justfile new file mode 100644 index 0000000..e8ed871 --- /dev/null +++ b/justfile @@ -0,0 +1,22 @@ +default: lint + +pdf-docs: latex-docs + make -C doc-source/build/latex/ + +latex-docs: + SPHINX_BUILDER=latex tox -e docs + +unused-imports: + tox -e lint -- --select F401 + +incomplete-defs: + tox -e lint -- --select MAN + +vdiff: + git diff $(repo-helper show version -q)..HEAD + +bare-ignore: + greppy '# type:? *ignore(?!\[|\w)' -s + +lint: unused-imports incomplete-defs bare-ignore + tox -n qa diff --git a/pyproject.toml b/pyproject.toml index c6e758f..8fe3167 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,72 @@ [build-system] -requires = ["setuptools>=40.6.0", "wheel>=0.34.2"] -build-backend = "setuptools.build_meta" +requires = [ "whey",] +build-backend = "whey" + +[project] +name = "flake8-github-actions" +version = "0.1.1" +description = "GitHub Actions integration for flake8." +readme = "README.rst" +requires-python = ">=3.6" +keywords = [ "flake8", "github", "github-actions",] +dynamic = [ "classifiers", "dependencies",] + +[project.license] +file = "LICENSE" + +[[project.authors]] +name = "Dominic Davis-Foster" +email = "dominic@davis-foster.co.uk" + +[project.urls] +Homepage = "https://github.com/python-formate/flake8-github-actions" +"Issue Tracker" = "https://github.com/python-formate/flake8-github-actions/issues" +"Source Code" = "https://github.com/python-formate/flake8-github-actions" + +[project.entry-points."flake8.report"] +github = "flake8_github_actions:GitHubFormatter" + +[tool.whey] +base-classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Framework :: Flake8", + "Intended Audience :: Developers", + "Typing :: Typed", +] +python-versions = [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13",] +python-implementations = [ "CPython", "PyPy",] +platforms = [ "Windows", "macOS", "Linux",] +license-key = "MIT" +package = "flake8_github_actions" + +[tool.mypy] +python_version = "3.8" +namespace_packages = true +check_untyped_defs = true +warn_unused_ignores = true +no_implicit_optional = true +show_error_codes = true + +[tool.snippet-fmt] +directives = [ "code-block",] + +[tool.snippet-fmt.languages.python] +reformat = true + +[tool.snippet-fmt.languages.TOML] +reformat = true + +[tool.snippet-fmt.languages.ini] + +[tool.snippet-fmt.languages.json] + +[tool.dep_checker] +allowed_unused = [ "flake8",] + +[tool.dependency-dash."requirements.txt"] +order = 10 + +[tool.dependency-dash."tests/requirements.txt"] +order = 20 +include = false diff --git a/repo_helper.yml b/repo_helper.yml index 44922c0..b23d943 100644 --- a/repo_helper.yml +++ b/repo_helper.yml @@ -1,24 +1,49 @@ # Configuration for 'repo_helper' (https://github.com/domdfcoding/repo_helper) --- -modname: 'flake8-github-action' +modname: 'flake8-github-actions' copyright_years: '2020' author: 'Dominic Davis-Foster' email: 'dominic@davis-foster.co.uk' -username: 'domdfcoding' -version: '0.0.0' +username: "python-formate" +assignee: "domdfcoding" +version: '0.1.1' license: 'MIT' -short_desc: 'GitHub Action to run flake8.' +short_desc: 'GitHub Actions integration for flake8.' +min_coverage: 100 enable_conda: false -enable_tests: false enable_docs: false -on_pypi: False +requires_python: 3.6 +pre_commit_exclude: "^tests/bad_code.py$" +use_whey: true python_versions: - - 3.6 - - 3.7 - - 3.8 - - 3.9 + 3.7: + matrix_exclude: + flake8: + - 6 + - 7 + 3.8: + 3.9: + "3.10": + 3.11: + 3.12: + matrix_exclude: + flake8: + - 4 + - 5 + 3.13: + matrix_exclude: + flake8: + - 4 + - 5 + pypy37: + matrix_exclude: + flake8: + - 6 + - 7 + pypy38: + pypy39: additional_ignore: - action.py @@ -27,3 +52,23 @@ keywords: - flake8 - github - github-actions + +entry_points: + flake8.report: + - github = flake8_github_actions:GitHubFormatter + +classifiers: + - 'Development Status :: 4 - Beta' + - 'Environment :: Console' + - 'Framework :: Flake8' + - 'Intended Audience :: Developers' + +tox_unmanaged: + - "testenv:lint" + +third_party_version_matrix: + flake8: + - 4 + - 5 + - 6 + - 7 diff --git a/requirements.txt b/requirements.txt index 435ada9..4163a01 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1 @@ -click>=7.1.2 -consolekit>=0.6.0 flake8>=3.8.4 -typing-extensions>=3.7.4.3 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 9da3b7f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,49 +0,0 @@ -# This file is managed by 'repo_helper'. -# You may add new sections, but any changes made to the following sections will be lost: -# * metadata -# * options -# * options.packages.find -# * mypy -# * options.entry_points - -[metadata] -name = flake8-github-action -author = Dominic Davis-Foster -author_email = dominic@davis-foster.co.uk -license = MIT License -keywords = flake8, github, github-actions -long_description = file: README.rst -long_description_content_type = text/x-rst -platforms = Windows, macOS, Linux -url = https://github.com/domdfcoding/flake8-github-action -project_urls = - Issue_Tracker = https://github.com/domdfcoding/flake8-github-action/issues - Source_Code = https://github.com/domdfcoding/flake8-github-action -classifiers = - License :: OSI Approved :: MIT License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: Implementation :: CPython - -[options] -python_requires = >=3.6.1 -zip_safe = False -include_package_data = True -packages = find: - -[options.packages.find] -exclude = - doc-source - tests - tests.* - -[mypy] -python_version = 3.6 -namespace_packages = True -check_untyped_defs = True -warn_unused_ignores = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 4a67ad2..0000000 --- a/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# This file is managed by 'repo_helper'. Don't edit it directly. - -# stdlib -import sys - -# 3rd party -from setuptools import setup - -sys.path.append('.') - -# this package -from __pkginfo__ import * # pylint: disable=wildcard-import - -setup( - description="GitHub Action to run flake8.", - extras_require=extras_require, - install_requires=install_requires, - py_modules=[], - version=__version__, - ) diff --git a/tests/bad_code.py b/tests/bad_code.py new file mode 100644 index 0000000..ba3f389 --- /dev/null +++ b/tests/bad_code.py @@ -0,0 +1,13 @@ +# type: ignore +import warnings + + +from __future__ import annotations + + + + + +print(name) + +break \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..81ca008 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1 @@ +pytest_plugins = ("coincidence", ) diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 0000000..ee69d13 --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,10 @@ +coincidence>=0.2.0 +coverage>=5.1 +coverage-pyver-pragma>=0.2.1 +domdf-python-tools[testing]>=2.0.1 +importlib-metadata>=3.6.0 +iniconfig!=1.1.0,>=1.0.1 +pytest>=6.0.0 +pytest-cov>=2.8.1 +pytest-randomly>=3.7.0 +pytest-timeout>=1.4.2 diff --git a/tests/test_output.py b/tests/test_output.py new file mode 100644 index 0000000..79ce5a1 --- /dev/null +++ b/tests/test_output.py @@ -0,0 +1,23 @@ +# 3rd party +import pytest +from coincidence.regressions import FileRegressionFixture, check_file_regression +from domdf_python_tools.compat import importlib_metadata +from domdf_python_tools.paths import PathPlus +from flake8.main import cli # type: ignore + +bad_code = PathPlus(__file__).parent / "bad_code.py" + + +def test_output(file_regression: FileRegressionFixture, capsys): + args = [str(bad_code), "--select", "F401,F404,F821,F701,E303", "--format", "github"] + + if int(importlib_metadata.version("flake8").split('.')[0]) >= 5: + cli.main(args) + + else: + with pytest.raises(SystemExit): + cli.main(args) + + stdout = capsys.readouterr().out.replace(str(bad_code), "bad_code.py") + check_file_regression(stdout, file_regression) + assert not capsys.readouterr().err diff --git a/tests/test_output_/test_output.txt b/tests/test_output_/test_output.txt new file mode 100644 index 0000000..e8450c4 --- /dev/null +++ b/tests/test_output_/test_output.txt @@ -0,0 +1,7 @@ +bad_code.py +::warning file=bad_code.py,line=2,col=1::F401: 'warnings' imported but unused +::warning file=bad_code.py,line=5,col=1::F404: from __future__ imports must occur at the beginning of the file +::warning file=bad_code.py,line=11,col=1::E303: too many blank lines (5) +::warning file=bad_code.py,line=11,col=7::F821: undefined name 'name' +::warning file=bad_code.py,line=13,col=1::F701: 'break' outside loop +5 diff --git a/tox.ini b/tox.ini index a0b0a1f..6969262 100644 --- a/tox.ini +++ b/tox.ini @@ -2,11 +2,15 @@ # You may add new sections, but any changes made to the following sections will be lost: # * tox # * envlists -# * gh-actions # * testenv +# * testenv:.package +# * testenv:py313-dev +# * testenv:py313 +# * testenv:py312-dev +# * testenv:py312 # * testenv:docs # * testenv:build -# * testenv:lint +# * testenv:perflint # * testenv:mypy # * testenv:pyup # * testenv:coverage @@ -17,120 +21,230 @@ # * pytest [tox] -envlist = py36, py37, py38, py39, mypy, build +envlist = + py37-flake8{4,5} + py38-flake8{4,5,6,7} + py39-flake8{4,5,6,7} + py310-flake8{4,5,6,7} + py311-flake8{4,5,6,7} + py312-flake8{6,7} + py313-flake8{6,7} + pypy37-flake8{4,5} + pypy38-flake8{4,5,6,7} + pypy39-flake8{4,5,6,7} + mypy + build skip_missing_interpreters = True -requires = pip>=20.2.1 isolated_build = True +requires = + pip>=21,!=22.2 + tox-envlist>=0.2.1 + tox~=3.0 + virtualenv!=20.16.0 [envlists] -test = py36, py37, py38, py39 +test = + py37-flake8{4,5} + py38-flake8{4,5,6,7} + py39-flake8{4,5,6,7} + py310-flake8{4,5,6,7} + py311-flake8{4,5,6,7} + py312-flake8{6,7} + py313-flake8{6,7} + pypy37-flake8{4,5} + pypy38-flake8{4,5,6,7} + pypy39-flake8{4,5,6,7} qa = mypy, lint - -[gh-actions] -python = - 3.6: py36, build, mypy - 3.7: py37, build - 3.8: py38, build - 3.9: py39, build +cov = py38-flake84, coverage [testenv] setenv = - PIP_USE_FEATURE = 2020-resolver - PYTHONDEVMODE = 1 -commands = python --version + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 + SETUPTOOLS_USE_DISTUTILS=stdlib +deps = + -r{toxinidir}/tests/requirements.txt + flake84: flake8~=4.0 + flake85: flake8~=5.0 + flake86: flake8~=6.0 + flake87: flake8~=7.0 +commands = + python --version + python -m pytest --cov=flake8_github_actions -r aR tests/ {posargs} + +[testenv:.package] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 + +[testenv:py313] +download = True +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 + UNSAFE_PYO3_SKIP_VERSION_CHECK=1 + +[testenv:py312] +download = True +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 [testenv:build] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 + PIP_PREFER_BINARY=1 + UNSAFE_PYO3_SKIP_VERSION_CHECK=1 skip_install = True changedir = {toxinidir} deps = - twine>=3.2.0 - pep517>=0.9.1 + build[virtualenv]>=0.3.1 check-wheel-contents>=0.1.0 + twine>=3.2.0 + cryptography<40; implementation_name == "pypy" and python_version <= "3.7" commands = - python -m pep517.build --source --binary "{toxinidir}" + python -m build --sdist --wheel "{toxinidir}" twine check dist/*.tar.gz dist/*.whl check-wheel-contents dist/ -[testenv:lint] -basepython = python3.6 +[testenv:perflint] +basepython = python3.8 changedir = {toxinidir} ignore_errors = True skip_install = True -deps = - flake8 >=3.8.2 - flake8-2020 >= 1.6.0 - flake8-builtins>=1.5.3 - flake8-docstrings>=1.5.0 - flake8-dunder-all>=0.1.1 - flake8-pyi>=20.10.0 - flake8-pytest-style>=1.3.0 - flake8-sphinx-links>=0.0.4 - flake8-strftime>=0.1.1 - flake8-typing-imports>=1.10.0 - git+https://github.com/PyCQA/pydocstyle@5118faa7173b0e5bbc230c4adf628758e13605bf - git+https://github.com/domdfcoding/flake8-quotes.git - git+https://github.com/domdfcoding/flake8-rst-docstrings.git - git+https://github.com/domdfcoding/flake8-rst-docstrings-sphinx.git - pygments>=2.7.1 -commands = python3 -m flake8_rst_docstrings_sphinx flake8_github_action --allow-toolbox +deps = perflint +commands = python3 -m perflint flake8_github_actions {posargs} [testenv:mypy] -basepython = python3.6 +basepython = python3.8 ignore_errors = True changedir = {toxinidir} deps = - mypy==0.790 - lxml -commands = mypy flake8_github_action {posargs} + mypy==0.971 + -r{toxinidir}/tests/requirements.txt +commands = mypy flake8_github_actions tests {posargs} [testenv:pyup] -basepython = python3.6 +basepython = python3.8 skip_install = True ignore_errors = True changedir = {toxinidir} deps = pyupgrade-directories -commands = pyup_dirs flake8_github_action --py36-plus --recursive +commands = pyup_dirs flake8_github_actions tests --py36-plus --recursive + +[testenv:coverage] +basepython = python3.8 +skip_install = True +ignore_errors = True +whitelist_externals = /bin/bash +passenv = + COV_PYTHON_VERSION + COV_PLATFORM + COV_PYTHON_IMPLEMENTATION + * +changedir = {toxinidir} +deps = + coverage>=5 + coverage_pyver_pragma>=0.2.1 +commands = + /bin/bash -c "rm -rf htmlcov" + coverage html + /bin/bash -c "DISPLAY=:0 firefox 'htmlcov/index.html'" [flake8] max-line-length = 120 -select = E301 E303 E304 E305 E306 E502 W291 W293 W391 E226 E225 E241 E231 W292 E265 E111 E112 E113 E121 E122 E125 E127 E128 E129 E131 E133 E201 E202 E203 E211 E222 E223 E224 E225 E227 E228 E242 E251 E261 E262 E271 E272 E402 E703 E711 E712 E713 E714 E721 W504 E302 YTT101 YTT102 YTT103 YTT201 YTT202 YTT203 YTT204 YTT301 YTT302 YTT303 STRFTIME001 STRFTIME002 SXL001 PT001 PT002 PT003 PT005 PT006 PT007 PT008 PT009 PT010 PT011 PT012 PT013 PT014 PT015 PT016 PT017 PT018 PT019 PT020 PT021 RST201 RST202 RST203 RST204 RST205 RST206 RST207 RST208 RST210 RST211 RST212 RST213 RST214 RST215 RST216 RST217 RST218 RST219 RST299 RST301 RST302 RST303 RST304 RST305 RST306 RST399 RST401 RST499 RST900 RST901 RST902 RST903 Q001 Q002 Q003 A001 A002 A003 TYP001 TYP002 TYP003 TYP004 TYP005 TYP006 Y001,Y002 Y003 Y004 Y005 Y006 Y007 Y008 Y009 Y010 Y011 Y012 Y013 Y014 Y015 Y090 Y091 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000 -exclude = .git,__pycache__,doc-source,old,build,dist,make_conda_recipe.py,__pkginfo__.py,setup.py,.tox,venv +select = E111 E112 E113 E121 E122 E125 E127 E128 E129 E131 E133 E201 E202 E203 E211 E222 E223 E224 E225 E225 E226 E227 E228 E231 E241 E242 E251 E261 E262 E265 E271 E272 E303 E304 E306 E402 E502 E703 E711 E712 E713 E714 E721 W291 W292 W293 W391 W504 YTT101 YTT102 YTT103 YTT201 YTT202 YTT203 YTT204 YTT301 YTT302 YTT303 STRFTIME001 STRFTIME002 SXL001 PT001 PT002 PT003 PT006 PT007 PT008 PT009 PT010 PT011 PT012 PT013 PT014 PT015 PT016 PT017 PT018 PT019 PT020 PT021 RST201 RST202 RST203 RST204 RST205 RST206 RST207 RST208 RST210 RST211 RST212 RST213 RST214 RST215 RST216 RST217 RST218 RST219 RST299 RST301 RST302 RST303 RST304 RST305 RST306 RST399 RST401 RST499 RST900 RST901 RST902 RST903 Q001 Q002 Q003 A001 A002 TYP001 TYP002 TYP003 TYP004 TYP005 TYP006 ENC001 ENC002 ENC003 ENC004 ENC011 ENC012 ENC021 ENC022 ENC023 ENC024 ENC025 ENC026 Y001,Y002 Y003 Y004 Y005 Y006 Y007 Y008 Y009 Y010 Y011 Y012 Y013 Y014 Y015 Y090 Y091 NQA001 NQA002 NQA003 NQA004 NQA005 NQA102 NQA103 E301 E302 E305 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000 SLOT000 SLOT001 SLOT002 +extend-exclude = doc-source,old,build,dist,__pkginfo__.py,setup.py,venv rst-directives = TODO envvar extras-require + license + license-info +rst-roles = choosealicense per-file-ignores = - tests/*: D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000 - */*.pyi: D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000 + tests/*: D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000 SLOT000 SLOT001 SLOT002 + */*.pyi: E301 E302 E305 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000 SLOT000 SLOT001 SLOT002 pytest-parametrize-names-type = csv inline-quotes = " multiline-quotes = """ docstring-quotes = """ count = True +min_python_version = 3.6 +unused-arguments-ignore-abstract-functions = True +unused-arguments-ignore-overload-functions = True +unused-arguments-ignore-magic-methods = True +unused-arguments-ignore-variadic-names = True [coverage:run] plugins = coverage_pyver_pragma [coverage:report] +fail_under = 100 +show_missing = True exclude_lines = raise AssertionError raise NotImplementedError if 0: if False: - if TYPE_CHECKING: - if typing.TYPE_CHECKING: + if TYPE_CHECKING + if typing.TYPE_CHECKING if __name__ == .__main__.: [check-wheel-contents] ignore = W002 -toplevel = flake8_github_action -package = flake8_github_action +toplevel = flake8_github_actions +package = flake8_github_actions [pytest] addopts = --color yes --durations 25 timeout = 300 +filterwarnings = + error + ignore:SelectableGroups dict interface is deprecated. Use select.:DeprecationWarning:flake8 + ignore:can't resolve package from __spec__ or __package__, falling back on __name__ and __path__:ImportWarning + ignore:ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead:DeprecationWarning -[dep_checker] -name_mapping = - flake8_json = flake8_json_reporter - attrs = attr +[testenv:py312-flake8{4,5,6,7}] +download = True +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 + +[testenv:py313-flake8{4,5,6,7}] +download = True +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 + UNSAFE_PYO3_SKIP_VERSION_CHECK=1 + +[testenv:lint] +basepython = python3.8 +changedir = {toxinidir} +ignore_errors = True +skip_install = False +deps = + flake8>=3.8.2,<5 + flake8-2020>=1.6.0 + flake8-builtins>=1.5.3 + flake8-docstrings>=1.5.0 + flake8-dunder-all>=0.1.1 + flake8-encodings>=0.1.0 + flake8-github-actions>=0.1.0 + flake8-noqa>=1.1.0,<=1.2.2 + flake8-pyi>=20.10.0,<=22.8.0 + flake8-pytest-style>=1.3.0 + flake8-quotes>=3.3.0 + flake8-slots>=0.1.0 + flake8-sphinx-links>=0.0.4 + flake8-strftime>=0.1.1 + flake8-typing-imports>=1.10.0 + git+https://github.com/domdfcoding/flake8-rst-docstrings-sphinx.git + git+https://github.com/domdfcoding/flake8-rst-docstrings.git + git+https://github.com/python-formate/flake8-unused-arguments.git@magic-methods + git+https://github.com/python-formate/flake8-missing-annotations.git + pydocstyle>=6.0.0 + pygments>=2.7.1 + importlib_metadata<4.5.0; python_version<'3.8' +commands = python3 -m flake8_rst_docstrings_sphinx flake8_github_actions tests --allow-toolbox --extend-exclude bad_code.py {posargs}