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

use ruff #180

Merged
merged 1 commit into from
Jul 13, 2024
Merged
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: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ jobs:
- if: ${{ github.event_name == 'lower-bound' }}
run: uv pip install "fsspec==2021.7.0" --system
- uses: pre-commit/[email protected]
- run: pylint src tests
continue-on-error: ${{ matrix.pyv == '3.13' }}
- run: mypy
- run: pip show fsspec
- run: pytest --cov-report=xml
Expand Down
35 changes: 6 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,17 @@ repos:
- id: mixed-line-ending
- id: sort-simple-yaml
- id: trailing-whitespace
- hooks:
- id: black
language_version: python3
repo: https://github.com/psf/black
rev: 24.4.2
- hooks:
- id: isort
language_version: python3
repo: https://github.com/pycqa/isort
rev: 5.13.2
- hooks:
- id: flake8
language_version: python3
additional_dependencies:
- flake8-bugbear
- flake8-broken-line
- flake8-comprehensions
- flake8-debugger
- flake8-string-format
- flake8-docstrings
repo: https://github.com/pycqa/flake8
rev: 7.1.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.5.1'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/asottile/blacken-docs
rev: 1.18.0
hooks:
- id: blacken-docs
additional_dependencies: [black]
- repo: https://github.com/pycqa/bandit
rev: 1.7.9
hooks:
- id: bandit
exclude: ^tests/
args: [-c, pyproject.toml]
additional_dependencies: ["bandit[toml]"]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ or an [ownCloud server using docker-compose](https://doc.owncloud.com/server/adm
Please install `pre-commit` and add the hooks, so that it enforces proper
code standard in your code changes.

Also make sure to run `pylint` and `mypy`.
Also make sure to run `mypy`:
```shell
pylint src tests
mypy
```
7 changes: 2 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Configuration file for the Sphinx documentation builder."""

# pylint: disable=invalid-name

# This file only contains a selection of the most common options. For a full
# list see the documentation:
Expand All @@ -14,7 +13,7 @@
sys.path.insert(0, "..")

project = "webdav4"
copyright = "2022, Saugat Pachhai" # pylint: disable=redefined-builtin
copyright = "2022, Saugat Pachhai"
author = "Saugat Pachhai"
version = __version__

Expand Down Expand Up @@ -46,8 +45,6 @@
html_title = "webdav4"
html_static_path = ["_static"]

copybutton_prompt_text = (
r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
)
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
copybutton_prompt_is_regexp = True
autoclass_content = "both"
79 changes: 78 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ optional-dependencies.http2 = [
optional-dependencies.qa = [
"mypy==1.10.1",
"pre-commit",
"pylint==3.2.5",
"types-colorama",
"types-pkg-resources",
"types-python-dateutil",
Expand Down Expand Up @@ -90,6 +89,84 @@ packages = [ "src/webdav4" ]
[tool.black]
line-length = 79

[tool.ruff]
show-fixes = true

lint.select = [
"ASYNC", # flake8-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe
"DTZ", # flake8-datetimez
"E", # pycodestyle - Error
"EXE", # flake8-executable
"F", # pyflakes
"FLY", # flynt
"FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"NPY", # numpy
"PERF", # perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff rules
"RUF022", # unsorted-dunder-all
"RUF023", # unsorted-dunder-slots
"RUF025", # unnecessary-dict-comprehension-for-iterable
"RUF027", # missing-f-string-syntax
"RUF030", # assert-with-print-message
"RUF101", # redirected-noqa
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLOT", # flake8-slots
"T10", # flake8-debugger
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"TRY004", # type-check-without-type-error
"TRY201", # verbose-raise
"TRY302", # useless-try-except
"TRY401", # verbose-log-message
"UP", # pyupgrade
"W", # pycodestyle - Warning
"YTT", # flake8-2020
]
lint.ignore = [
"ISC001", # single-line-implicit-string-concatenation, incompatible with ruff format
"PERF203", # perflint - try-except-in-loop, irrelevant for Python>=3.11
"PGH003",
"PLR2004", # magic-value-comparison
"PLW2901", # redefined-loop-name
"RET502", # implicit-return-value
"RET503", # implicit-return
"S101", # assert
"SIM105", # suppressible-exception
"SIM108", # if-else-block-instead-of-if-exp
"SIM117", # multiple-with-statements
]
lint.explicit-preview-rules = true
lint.per-file-ignores."docs/**" = [
"INP001",
]
lint.per-file-ignores."tests/**" = [
"DTZ002",
"S106",
"S314",
]
lint.flake8-type-checking.strict = true
lint.isort.known-first-party = [ "webdav4" ]
lint.preview = true

[tool.isort]
profile = "black"
line_length = 79
Expand Down
1 change: 0 additions & 1 deletion src/webdav4/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def __iter__(self) -> Iterator[AnyStr]:
if method != "read":
raise

# pylint: disable=import-outside-toplevel
from .stream import read_until

chunks = read_until(stream, "\n")
Expand Down
Loading
Loading