Skip to content

Commit

Permalink
Merge pull request #562 from dbfixtures/pre-commit
Browse files Browse the repository at this point in the history
Use pre-commit for maintaining code style and linting
  • Loading branch information
fizyk authored Mar 1, 2025
2 parents b4c2a4f + a4fa12e commit d094cfd
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 501 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
### What are the results


### What are the expected results
### What are the expected results
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Chore that needs to be done:

* [ ] Add newsfragment `pipenv run towncrier create [issue_number].[type].rst`

Types are defined in the pyproject.toml, issue_numer either from issue tracker or the Pull request number
Types are defined in the pyproject.toml, issue_numer either from issue tracker or the Pull request number
14 changes: 0 additions & 14 deletions .github/workflows/linters.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Run linters

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]


jobs:
pre-commit:
uses: fizyk/actions-reuse/.github/workflows/[email protected]
62 changes: 62 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
ci:
skip: [pipenv, mypy]

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
minimum_pre_commit_version: 4.0.0
default_stages: [pre-commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: trailing-whitespace
- id: check-toml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: check-yaml
- id: pretty-format-json
- id: detect-private-key
- id: debug-statements

- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
entry: black --config pyproject.toml .

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --respect-gitignore, --show-fixes]

- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.4
hooks:
- id: rstcheck
additional_dependencies: [sphinx, toml]

- repo: local
hooks:
- id: pipenv
stages: [pre-commit, manual]
language: system
name: Install dependencies for the local linters
entry: bash -c "pip install pipenv && pipenv install --dev"
types_or:
- python
- toml # Pipfile
pass_filenames: false
- id: mypy
stages: [pre-commit, manual]
name: mypy
entry: pipenv run mypy .
language: system
types_or:
- python
- toml # Pipfile
pass_filenames: false
2 changes: 2 additions & 0 deletions .rstcheck.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[rstcheck]
report_level = warning
2 changes: 1 addition & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ of pytest-rabbitmq along its history.
* Karolina Blümke
* Michał Masłowski
* Dwayne Litzenberger
* Damian Skrzypczak
* Damian Skrzypczak
8 changes: 4 additions & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Contribute to pytest-rabbitmq
==============
=============================

Thank you for taking time to contribute to pytest-rabbitmq!

Expand All @@ -19,7 +19,7 @@ Feature requests/proposals
#. Provide as detailed description as possible
* Use case is great to have
#. There'll be a bit of discussion for the feature. Don't worry, if it is to be accepted, we'd like to support it, so we need to understand it thoroughly.


Pull requests
-------------
Expand All @@ -40,5 +40,5 @@ Commits
Coding style
------------

#. All python coding style are being enforced by `Pylama <https://pypi.python.org/pypi/pylama>`_ and configured in pylama.ini file.
#. Additional, not always mandatory checks are being performed by `QuantifiedCode <https://www.quantifiedcode.com/app/project/gh:ClearcodeHQ:pytest-rabbitmq>`_
#. Coding style is being handled by black and doublechecked by ruff.
* We provide a `pre-commit <https://pre-commit.com/>`_ configuration for invoking these on commit.
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
2 changes: 1 addition & 1 deletion COPYING.lesser
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ General Public License ever published by the Free Software Foundation.
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
Library.
2 changes: 0 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ mirakuru = "==2.6.0"
towncrier = "==24.8.0"
pytest-cov = "==6.0.0"
pytest-xdist = "==3.6.1"
black = "==25.1.0"
ruff = "==0.9.8"
mypy = "==1.15.0"
tbump = "==6.11.0"
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. image:: https://raw.githubusercontent.com/dbfixtures/pytest-rabbitmq/master/logo.png
:width: 100px
:height: 100px

pytest-rabbitmq
===============

Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ warn_unreachable = True
warn_unused_ignores = True

[mypy-pika.*]
ignore_missing_imports = True
ignore_missing_imports = True
2 changes: 1 addition & 1 deletion newsfragments/+001464e0.misc.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Adjust workflows for actions-reuse 3
Adjust workflows for actions-reuse 3
1 change: 1 addition & 0 deletions newsfragments/+c150915a.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use pre-commit for maintaining code style and linting
Loading

0 comments on commit d094cfd

Please sign in to comment.