Skip to content

Commit d094cfd

Browse files
authored
Merge pull request #562 from dbfixtures/pre-commit
Use pre-commit for maintaining code style and linting
2 parents b4c2a4f + a4fa12e commit d094cfd

16 files changed

+89
-501
lines changed

.github/ISSUE_TEMPLATE.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
### What are the results
55

66

7-
### What are the expected results
7+
### What are the expected results

.github/PULL_REQUEST_TEMPLATE.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ Chore that needs to be done:
22

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

5-
Types are defined in the pyproject.toml, issue_numer either from issue tracker or the Pull request number
5+
Types are defined in the pyproject.toml, issue_numer either from issue tracker or the Pull request number

.github/workflows/linters.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/pre-commit.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Run linters
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
10+
jobs:
11+
pre-commit:
12+
uses: fizyk/actions-reuse/.github/workflows/[email protected]

.pre-commit-config.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
ci:
3+
skip: [pipenv, mypy]
4+
5+
# See https://pre-commit.com for more information
6+
# See https://pre-commit.com/hooks.html for more hooks
7+
minimum_pre_commit_version: 4.0.0
8+
default_stages: [pre-commit]
9+
repos:
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v5.0.0
12+
hooks:
13+
- id: check-added-large-files
14+
- id: check-case-conflict
15+
- id: check-merge-conflict
16+
- id: trailing-whitespace
17+
- id: check-toml
18+
- id: end-of-file-fixer
19+
- id: mixed-line-ending
20+
- id: check-yaml
21+
- id: pretty-format-json
22+
- id: detect-private-key
23+
- id: debug-statements
24+
25+
- repo: https://github.com/psf/black
26+
rev: 25.1.0
27+
hooks:
28+
- id: black
29+
entry: black --config pyproject.toml .
30+
31+
- repo: https://github.com/astral-sh/ruff-pre-commit
32+
rev: v0.9.6
33+
hooks:
34+
- id: ruff
35+
args: [--fix, --exit-non-zero-on-fix, --respect-gitignore, --show-fixes]
36+
37+
- repo: https://github.com/rstcheck/rstcheck
38+
rev: v6.2.4
39+
hooks:
40+
- id: rstcheck
41+
additional_dependencies: [sphinx, toml]
42+
43+
- repo: local
44+
hooks:
45+
- id: pipenv
46+
stages: [pre-commit, manual]
47+
language: system
48+
name: Install dependencies for the local linters
49+
entry: bash -c "pip install pipenv && pipenv install --dev"
50+
types_or:
51+
- python
52+
- toml # Pipfile
53+
pass_filenames: false
54+
- id: mypy
55+
stages: [pre-commit, manual]
56+
name: mypy
57+
entry: pipenv run mypy .
58+
language: system
59+
types_or:
60+
- python
61+
- toml # Pipfile
62+
pass_filenames: false

.rstcheck.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[rstcheck]
2+
report_level = warning

AUTHORS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ of pytest-rabbitmq along its history.
1010
* Karolina Blümke
1111
* Michał Masłowski
1212
* Dwayne Litzenberger
13-
* Damian Skrzypczak
13+
* Damian Skrzypczak

CONTRIBUTING.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Contribute to pytest-rabbitmq
2-
==============
2+
=============================
33

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

@@ -19,7 +19,7 @@ Feature requests/proposals
1919
#. Provide as detailed description as possible
2020
* Use case is great to have
2121
#. 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.
22-
22+
2323

2424
Pull requests
2525
-------------
@@ -40,5 +40,5 @@ Commits
4040
Coding style
4141
------------
4242

43-
#. All python coding style are being enforced by `Pylama <https://pypi.python.org/pypi/pylama>`_ and configured in pylama.ini file.
44-
#. Additional, not always mandatory checks are being performed by `QuantifiedCode <https://www.quantifiedcode.com/app/project/gh:ClearcodeHQ:pytest-rabbitmq>`_
43+
#. Coding style is being handled by black and doublechecked by ruff.
44+
* We provide a `pre-commit <https://pre-commit.com/>`_ configuration for invoking these on commit.

COPYING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
671671
may consider it more useful to permit linking proprietary applications with
672672
the library. If this is what you want to do, use the GNU Lesser General
673673
Public License instead of this License. But first, please read
674-
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
674+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

COPYING.lesser

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,4 @@ General Public License ever published by the Free Software Foundation.
162162
whether future versions of the GNU Lesser General Public License shall
163163
apply, that proxy's public statement of acceptance of any version is
164164
permanent authorization for you to choose that version for the
165-
Library.
165+
Library.

Pipfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ mirakuru = "==2.6.0"
1313
towncrier = "==24.8.0"
1414
pytest-cov = "==6.0.0"
1515
pytest-xdist = "==3.6.1"
16-
black = "==25.1.0"
17-
ruff = "==0.9.8"
1816
mypy = "==1.15.0"
1917
tbump = "==6.11.0"

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. image:: https://raw.githubusercontent.com/dbfixtures/pytest-rabbitmq/master/logo.png
22
:width: 100px
33
:height: 100px
4-
4+
55
pytest-rabbitmq
66
===============
77

mypy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ warn_unreachable = True
2020
warn_unused_ignores = True
2121

2222
[mypy-pika.*]
23-
ignore_missing_imports = True
23+
ignore_missing_imports = True

newsfragments/+001464e0.misc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Adjust workflows for actions-reuse 3
1+
Adjust workflows for actions-reuse 3

newsfragments/+c150915a.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use pre-commit for maintaining code style and linting

0 commit comments

Comments
 (0)