Skip to content

Commit

Permalink
Upgrade build system to flit, add new pre-commit hooks, switch to ruf…
Browse files Browse the repository at this point in the history
…f for most linting checks, and lint and clean up code using ruff

(cherry picked from commit praw-dev/prawcore@17022f8)
  • Loading branch information
LilSpazJoekp committed Nov 27, 2023
1 parent 654abff commit ab27e6a
Show file tree
Hide file tree
Showing 18 changed files with 387 additions and 331 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

55 changes: 28 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
exclude: .*\.txt
rev: v4.5.0
- id: mixed-line-ending
args: [ --fix=no ]
- id: name-tests-test
args: [ --pytest-test-first ]
files: ^tests/integration/.*\.py|tests/unit/.*\.py$
- id: sort-simple-yaml
files: ^(\.github/workflows/.*\.ya?ml|\.readthedocs.ya?ml)$
- id: trailing-whitespace

- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort-fix
files: ^(.*\.toml)$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.290
hooks:
- id: ruff
args: [ --exit-non-zero-on-fix, --fix ]
files: ^(asyncprawcore/.*.py)$

- repo: https://github.com/psf/black
hooks:
Expand All @@ -14,28 +38,5 @@ repos:
- repo: https://github.com/LilSpazJoekp/docstrfmt
hooks:
- id: docstrfmt
require_serial: true
rev: v1.5.1

- repo: https://github.com/pycqa/flake8
hooks:
- id: flake8
rev: 6.1.0

- repo: https://github.com/ikamensh/flynt/
hooks:
- id: flynt
args:
- '-ll'
- '1000'
rev: '1.0.1'

- repo: https://github.com/pycqa/isort
hooks:
- id: isort
rev: 5.12.0

- repo: https://github.com/pycqa/pydocstyle
hooks:
- id: pydocstyle
files: asyncprawcore/.*
rev: 6.3.0
12 changes: 6 additions & 6 deletions asyncprawcore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""asyncprawcore: Low-level asynchronous communication layer for Async PRAW 7+."""
"""Low-level asynchronous communication layer for Async PRAW 7+."""

import logging

from .auth import ( # noqa
from .auth import (
Authorizer,
DeviceIDAuthorizer,
ImplicitAuthorizer,
Expand All @@ -11,9 +11,9 @@
TrustedAuthenticator,
UntrustedAuthenticator,
)
from .const import __version__ # noqa
from .exceptions import * # noqa
from .requestor import Requestor # noqa
from .sessions import Session, session # noqa
from .const import __version__
from .exceptions import * # noqa: F403
from .requestor import Requestor
from .sessions import Session, session

logging.getLogger(__package__).addHandler(logging.NullHandler())
Loading

0 comments on commit ab27e6a

Please sign in to comment.