Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pre-commit #338

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ current_version = 5.0.0a1
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<releaselevel>[a-z\d]+)?
serialize =
serialize =
{major}.{minor}.{patch}{releaselevel}
{major}.{minor}.{patch}

Expand Down
34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# We from the py-amqp project decided to pin repos based on the
# commit hash instead of the version tag to prevend arbitrary
# code from running in developer's machines. To update to a
# newer version, run `pre-commit autoupdate` and then replace
# the newer versions with their commit hash.

default_language_version:
python: python3

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: ebc15addedad713c86ef18ae9632c88e187dd0af # v3.1.0
hooks:
- id: trailing-whitespace
# Replaces or checks mixed line ending
- id: mixed-line-ending
args: ['--fix', 'lf']
exclude: '.*\.(svg)$'
# Forbid files which have a UTF-8 byte-order marker
- id: check-byte-order-marker
# Checks that non-binary executables have a proper shebang
- id: check-executables-have-shebangs
# Check for files that contain merge conflict strings.
- id: check-merge-conflict
# Check for debugger imports and py37+ breakpoint()
# calls in python source
- id: debug-statements
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://gitlab.com/pycqa/flake8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it available in github as well?

rev: 181bb46098dddf7e2d45319ea654b4b4d58c2840 # 3.8.3
hooks:
- id: flake8
exclude: ^extra/
10 changes: 5 additions & 5 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ error like `pack_into requires a buffer of at least 408736 bytes`.
:release-date: 20-06-01 12.00 P.M UTC+6:00
:release-by: Asif Saif Uddin

- Implement speedups in cython (#311)
- Implement speedups in cython (#311)
- Updated some tests & code improvements
- Separate logger for Connection.heartbeat_tick method
- Separate logger for Connection.heartbeat_tick method
- Cython generic content (#315)
- Improve documentation a_global parameter of basic_qos() method.
- Fix saving partial read buffer on windows during socket timeout. (#321)
Expand All @@ -66,7 +66,7 @@ error like `pack_into requires a buffer of at least 408736 bytes`.
:release-date: 2019-09-30 19.00 P.M UTC+6:00
:release-by: Asif Saif Uddin

- Fixed a channel issue against a connection already closed
- Fixed a channel issue against a connection already closed
- Updated some tests & code improvements


Expand All @@ -78,8 +78,8 @@ error like `pack_into requires a buffer of at least 408736 bytes`.
:release-by: Asif Saif Uddin

- Ignore all methods except Close and Close-OK when channel/connection is closing
- Fix faulty ssl sni intiation parameters (#283)
- Undeprecate auto_delete flag for exchanges. (#287)
- Fix faulty ssl sni intiation parameters (#283)
- Undeprecate auto_delete flag for exchanges. (#287)
- Improved tests and testing environments


Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Further
.. |pyimp| image:: https://img.shields.io/pypi/implementation/amqp.svg
:alt: Support Python implementations.
:target: https://pypi.org/project/amqp/

py-amqp as part of the Tidelift Subscription
=======

Expand Down
10 changes: 8 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import pytest


def pytest_addoption(parser):
parser.addoption("-E", action="store", metavar="NAME",
parser.addoption(
"-E", action="store", metavar="NAME",
help="only run tests matching the environment NAME.")


def pytest_configure(config):
# register an additional marker
config.addinivalue_line("markers",
config.addinivalue_line(
"markers",
"env(name): mark test to run only on named environment")


def pytest_runtest_setup(item):
envnames = [mark.args[0] for mark in item.iter_markers(name='env')]
if envnames:
Expand Down
Loading