Skip to content

Commit

Permalink
Use ruff (#189)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
gaborbernat and pre-commit-ci[bot] committed Jun 10, 2023
1 parent 1ac7baa commit 3085ffd
Show file tree
Hide file tree
Showing 19 changed files with 248 additions and 316 deletions.
8 changes: 0 additions & 8 deletions .markdownlint.yaml

This file was deleted.

57 changes: 5 additions & 52 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,17 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: check-merge-conflict
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.4.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.272"
hooks:
- id: add-trailing-comma
args: [--py36-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
args: [--safe]
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.3]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "1.3.0"
hooks:
Expand All @@ -48,32 +22,11 @@ repos:
rev: "0.11.2"
hooks:
- id: pyproject-fmt
additional_dependencies: [tox>=4.5.1]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==23.3.23
- flake8-comprehensions==3.12
- flake8-pytest-style==1.7.2
- flake8-spellcheck==0.28
- flake8-unused-arguments==0.0.13
- flake8-noqa==1.3.1
- pep8-naming==0.13.3
- flake8-pyproject==1.2.3
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1"
rev: "v3.0.0-alpha.9-for-vscode"
hooks:
- id: prettier
additional_dependencies:
- prettier@2.7.1
- "@prettier/plugin-xml@2.2"
args: ["--print-width=120", "--prose-wrap=always"]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.34.0
hooks:
- id: markdownlint
- repo: meta
hooks:
- id: check-hooks-apply
Expand Down
6 changes: 0 additions & 6 deletions codecov.yml

This file was deleted.

8 changes: 5 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# noqa: INP001
"""Configuration for Sphinx."""
from __future__ import annotations

from datetime import datetime
from datetime import datetime, timezone

from platformdirs.version import __version__

author = "The platformdirs team"
project = "platformdirs"
copyright = "2021, The platformdirs team"
copyright = "2021, The platformdirs team" # noqa: A001

release = __version__
version = release
Expand All @@ -18,7 +20,7 @@
"sphinx_autodoc_typehints",
]
html_theme = "furo"
html_title, html_last_updated_fmt = "platformdirs", datetime.now().isoformat()
html_title, html_last_updated_fmt = "platformdirs", datetime.now(tz=timezone.utc).isoformat()
pygments_style, pygments_dark_style = "sphinx", "monokai"
autoclass_content, autodoc_member_order, autodoc_typehints = "class", "bysource", "none"
autodoc_default_options = {
Expand Down
47 changes: 28 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build-backend = "hatchling.build"
requires = [
"hatch-vcs>=0.3",
"hatchling>=1.14.1",
"hatchling>=1.17",
]

[project]
Expand Down Expand Up @@ -37,7 +37,6 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand All @@ -46,19 +45,19 @@ dynamic = [
"version",
]
dependencies = [
'typing-extensions>=4.5; python_version < "3.8"',
'typing-extensions>=4.6.3; python_version < "3.8"',
]
optional-dependencies.docs = [
"furo>=2023.3.27",
"furo>=2023.5.20",
"proselint>=0.13",
"sphinx>=6.2.1",
"sphinx>=7.0.1",
"sphinx-autodoc-typehints!=1.23.4,>=1.23",
]
optional-dependencies.test = [
"appdirs==1.4.4",
"covdefaults>=2.3",
"pytest>=7.3.1",
"pytest-cov>=4",
"pytest-cov>=4.1",
"pytest-mock>=3.10",
]
urls.Documentation = "https://platformdirs.readthedocs.io"
Expand All @@ -74,17 +73,6 @@ version.source = "vcs"
[tool.black]
line-length = 120

[tool.isort]
profile = "black"
known_first_party = ["platformdirs"]

[tool.flake8]
max-complexity = 22
max-line-length = 120
unused-arguments-ignore-abstract-functions = true
noqa-require-code = true
dictionaries = ["en_US", "python", "technical", "django"]

[tool.coverage]
html.show_contexts = true
html.skip_covered = false
Expand All @@ -100,5 +88,26 @@ show_error_codes = true
strict = true
overrides = [{ module = ["appdirs.*", "jnius.*"], ignore_missing_imports = true }]

[tool.pep8]
max-line-length = "120"
[tool.ruff]
select = ["ALL"]
line-length = 120
target-version = "py37"
isort = {known-first-party = ["platformdirs", "tests"], required-imports = ["from __future__ import annotations"]}
ignore = [
"ANN101", # Missing type annotation for `self` in method
"D301", # Use `r"""` if any backslashes in a docstring
"D205", # 1 blank line required between summary line and description
"D401", # First line of docstring should be in imperative mood
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
"S104", # Possible binding to all interface
]
[tool.ruff.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts allowed in tests...
"FBT", # don"t care about booleans as positional arguments in tests
"INP001", # no implicit namespace
"D", # don"t care about documentation in tests
"S603", # `subprocess` call: check for execution of untrusted input
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
]
Loading

0 comments on commit 3085ffd

Please sign in to comment.