mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
16
.github/workflows/lint.yml
vendored
16
.github/workflows/lint.yml
vendored
@@ -28,6 +28,22 @@ jobs:
|
||||
- name: Run Tox
|
||||
run: tox -e ${{ matrix.tool }}
|
||||
|
||||
ruff:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade ruff
|
||||
- name: Lint with Ruff
|
||||
run: ruff . --diff --format github
|
||||
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@@ -135,6 +135,54 @@ exclude = [
|
||||
[tool.isort]
|
||||
line_length = 95
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py38" # Pin Ruff to Python 3.8
|
||||
line-length = 95
|
||||
exclude = [
|
||||
'.git',
|
||||
'.tox',
|
||||
'.venv',
|
||||
'tests/roots/*',
|
||||
'build/*',
|
||||
'doc/_build/*',
|
||||
'sphinx/search/*',
|
||||
'doc/usage/extensions/example*.py',
|
||||
]
|
||||
ignore = [
|
||||
# pycodestyle
|
||||
'E741',
|
||||
# flake8-bugbear
|
||||
'B006',
|
||||
'B023',
|
||||
# flake8-bugbear opinionated (disabled by default in flake8)
|
||||
'B904',
|
||||
'B905',
|
||||
]
|
||||
external = [ # Whitelist for RUF100 unkown code warnings
|
||||
"E704",
|
||||
"W291",
|
||||
"W293",
|
||||
]
|
||||
select = [
|
||||
"E", # pycodestyle
|
||||
"F", # Pyflakes
|
||||
"W", # pycodestyle
|
||||
# plugins:
|
||||
"B", # flake8-bugbear
|
||||
"C4", # flake8-comprehensions
|
||||
"SIM", # flake8-simplify
|
||||
"RUF100" # yesqa
|
||||
]
|
||||
|
||||
[tool.ruff.per-file-ignores]
|
||||
"tests/*" = ["E501"]
|
||||
"sphinx/environment/collectors/toctree.py" = ["B026"]
|
||||
"sphinx/environment/adapters/toctree.py" = ["B026"]
|
||||
|
||||
# Ruff does not support 'import-order-style = smarkets'
|
||||
"sphinx/util/__init__.py" = ["F401"]
|
||||
"sphinx/util/inspect.py" = ["F401"]
|
||||
|
||||
[tool.mypy]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
|
||||
@@ -1320,7 +1320,7 @@ def deprecate_html_4(_app: Sphinx, config: Config) -> None:
|
||||
# for compatibility
|
||||
import sphinxcontrib.serializinghtml # noqa: E402,F401
|
||||
|
||||
import sphinx.builders.dirhtml # noqa: E402,F401
|
||||
import sphinx.builders.dirhtml # noqa: E402,F401,RUF100
|
||||
import sphinx.builders.singlehtml # noqa: E402,F401
|
||||
|
||||
deprecated_alias('sphinx.builders.html',
|
||||
|
||||
@@ -27,7 +27,7 @@ from sphinx.util.nodes import (caption_ref_re, explicit_title_re, # noqa: F401
|
||||
nested_parse_with_titles, split_explicit_title)
|
||||
# import other utilities; partly for backwards compatibility, so don't
|
||||
# prune unused ones indiscriminately
|
||||
from sphinx.util.osutil import (SEP, copyfile, copytimes, ensuredir, # noqa: F401,E501
|
||||
from sphinx.util.osutil import (SEP, copyfile, copytimes, ensuredir, # noqa: F401
|
||||
make_filename, mtimes_of_files, os_path, relative_uri)
|
||||
from sphinx.util.typing import PathMatcher
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ def test_restify_type_hints_alias():
|
||||
|
||||
def test_restify_type_ForwardRef():
|
||||
from typing import ForwardRef # type: ignore
|
||||
assert restify(ForwardRef("myint")) == ":py:class:`myint`"
|
||||
assert restify(ForwardRef("myint")) == ":py:class:`myint`" # NoQA: F821
|
||||
|
||||
|
||||
def test_restify_type_Literal():
|
||||
|
||||
Reference in New Issue
Block a user