Skip to content
Closed
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
61 changes: 15 additions & 46 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3"
- name: Install pip
run: python -m pip install --upgrade pip

- name: Install known good Ruff
run: python -m pip install ruff==0.0.284
- name: Lint with known good Ruff
run: ruff . --format github

- name: Install latest Ruff
run: python -m pip install --upgrade ruff
- name: Lint with latest Ruff
continue-on-error: true
run: ruff . --format github
- uses: pre-commit/[email protected]
with:
extra_args: ruff --all-files

flake8:
runs-on: ubuntu-latest
Expand All @@ -48,12 +38,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade "flake8>=3.5.0" "flake8-simplify"
- name: Lint with flake8
run: flake8 .
- uses: pre-commit/[email protected]
with:
extra_args: flake8 --all-files

isort:
runs-on: ubuntu-latest
Expand All @@ -64,12 +51,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade isort
- name: Lint with isort
run: isort --check-only --diff .
- uses: pre-commit/[email protected]
with:
extra_args: isort --all-files

mypy:
runs-on: ubuntu-latest
Expand All @@ -80,12 +64,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade "mypy>=0.990" docutils-stubs types-requests
- name: Type check with mypy
run: mypy sphinx/
- uses: pre-commit/[email protected]
with:
extra_args: mypy --all-files

docs-lint:
runs-on: ubuntu-latest
Expand All @@ -96,21 +77,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade sphinx-lint
- name: Lint documentation with sphinx-lint
run: >
sphinx-lint
--enable line-too-long
--max-line-length 85
AUTHORS.rst
CHANGES.rst
CODE_OF_CONDUCT.rst
CONTRIBUTING.rst
README.rst
doc/
- uses: pre-commit/[email protected]
with:
extra_args: sphinx-lint --all-files

twine:
runs-on: ubuntu-latest
Expand Down
49 changes: 49 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-json
- id: check-yaml
- id: debug-statements
exclude: '^sphinx/cmd/build.py$'

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.284
hooks:
- id: ruff
args: ['--diff', '--format', 'github']

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

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.0
hooks:
- id: mypy
additional_dependencies:
- docutils-stubs
- types-requests
files: ^sphinx/

- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v0.6.8
hooks:
- id: sphinx-lint
args: ['--enable', 'line-too-long', '--max-line-length', '85']
files: |
(?x)^(
CHANGES
| CONTRIBUTING.rst
| README.rst
| doc/.*
)
10 changes: 0 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,6 @@ dynamic = ["version"]
docs = [
"sphinxcontrib-websupport",
]
lint = [
"flake8>=3.5.0",
"flake8-simplify",
"isort",
"ruff",
"mypy>=0.990",
"sphinx-lint",
"docutils-stubs",
"types-requests",
]
test = [
"pytest>=4.6",
"html5lib",
Expand Down
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ setenv =
commands=
python -X dev -X warn_default_encoding -m pytest --durations 25 {posargs}

[testenv:lint]
description =
Run style checks.
deps =
pre-commit
commands =
pre-commit run --all-files --show-diff-on-failure

[testenv:docs]
basepython = python3
description =
Expand Down