Skip to content

Commit

Permalink
More pre-commit checks (#3227)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
sobolevn and pre-commit-ci[bot] authored Dec 25, 2024
1 parent 3424061 commit 070d609
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 76 deletions.
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/Bug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ body:
Please consider supporting our collective:
👉 https://opencollective.com/wemake-python-styleguide/donate
- type: textarea
attributes:
label: "What's wrong"
Expand All @@ -26,7 +25,6 @@ body:
description: "Please, explain how do you expect it to be"
validations:
required: True

- type: textarea
attributes:
label: "Flake8 version and plugins"
Expand Down
36 changes: 18 additions & 18 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
5 changes: 0 additions & 5 deletions .github/workflows/depup.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
name: depup

'on':
workflow_dispatch:
schedule:
- cron: '30 7 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

jobs:
reviewdog:
runs-on: ubuntu-latest
Expand All @@ -24,7 +20,6 @@ jobs:
file: Dockerfile
version_name: REVIEWDOG_VERSION
repo: reviewdog/reviewdog

- name: Create Pull Request to update reviewdog
uses: peter-evans/create-pull-request@v7
with:
Expand Down
55 changes: 23 additions & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,43 @@
name: test

'on':
push:
branches:
- master
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: |
curl -sSL "https://install.python-poetry.org" | python
# Adding `poetry` to `$PATH`:
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install -U pip
poetry install
- name: Run tests
run: make test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: |
curl -sSL "https://install.python-poetry.org" | python
# Adding `poetry` to `$PATH`:
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install -U pip
poetry install
- name: Run tests
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
18 changes: 7 additions & 11 deletions .github/workflows/wps.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
name: wps

'on':
pull_request:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wemake-services/wemake-python-styleguide@master
with:
reporter: 'github-pr-review'
fail_workflow: false
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
- uses: actions/checkout@v4
- uses: wemake-services/wemake-python-styleguide@master
with:
reporter: 'github-pr-review'
fail_workflow: false
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ repos:
- id: mixed-line-ending
args: [--fix=lf]
- id: check-case-conflict
- repo: https://github.com/google/yamlfmt
rev: v0.14.0
hooks:
- id: yamlfmt
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
hooks:
Expand All @@ -19,6 +23,10 @@ repos:
rev: v1.7.4
hooks:
- id: actionlint
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.5.0
hooks:
Expand All @@ -29,9 +37,7 @@ repos:
- id: ruff
args: ["--exit-non-zero-on-fix", "--fix"]
- id: ruff-format

exclude: ^(tests/fixtures/|tests/test_formatter/__snapshots__/)

ci:
autofix_commit_msg: "[pre-commit.ci] auto fixes from pre-commit.com hooks"
autofix_prs: true
Expand Down
3 changes: 0 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
version: 2

build:
os: ubuntu-lts-latest
tools: {python: "3.12"}
Expand All @@ -11,11 +10,9 @@ build:
- poetry config virtualenvs.create false
- poetry self add poetry-plugin-export
- poetry export --only main --only docs --format=requirements.txt --output=requirements.txt

python:
install:
- requirements: requirements.txt

sphinx:
configuration: 'docs/conf.py'
# TODO: fix warnings and enable
Expand Down
2 changes: 0 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ description: 'Runs wemake-python-styleguide as a GitHub Action'
branding:
icon: 'check'
color: 'green'

inputs:
path:
description: 'Path or space-separated list of paths to lint'
Expand All @@ -34,7 +33,6 @@ inputs:
outputs:
output:
description: 'The output of wemake-python-styleguide run'

runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
4 changes: 3 additions & 1 deletion scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ flake8 --version
echo '================================='
echo

cd "$INPUT_CWD"
cd "$INPUT_CWD" || exit 1

# Runs `flake8`, possibly with `reviewdog`:
if [ "$INPUT_REPORTER" == 'terminal' ]; then
Expand All @@ -42,6 +42,7 @@ elif [ "$INPUT_REPORTER" == 'github-pr-review' ] ||
output=$(flake8 "$INPUT_PATH" --append-config='/action-config.cfg')
echo "$output" | reviewdog -f=flake8 -reporter="$INPUT_REPORTER" -level=error
# `reviewdog` does not fail with any status code, so we have to get dirty:
# shellcheck disable=SC2319
status=$(test "$output" = ''; echo $?)
else
output="Invalid action reporter specified: $INPUT_REPORTER"
Expand All @@ -52,6 +53,7 @@ fi
# See: https://help.github.com/en/articles/development-tools-for-github-action
delimiter="$(dd if=/dev/urandom bs=15 count=1 status=none | base64)"
# See: https://github.com/orgs/community/discussions/26288#discussioncomment-3876281
# shellcheck disable=SC2129
echo "output<<$delimiter" >> "$GITHUB_OUTPUT"
echo "$output" >> "$GITHUB_OUTPUT"
echo "$delimiter" >> "$GITHUB_OUTPUT"
Expand Down

0 comments on commit 070d609

Please sign in to comment.