Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into dont-ignore-c-const…
Browse files Browse the repository at this point in the history
…ructs
  • Loading branch information
hugovk committed Sep 2, 2024
2 parents b5cc7dc + 82e6aec commit f603221
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v1
- uses: hynek/build-and-inspect-python-package@v2

# Upload to Test PyPI on every commit on main.
release-test-pypi:
Expand All @@ -40,7 +40,7 @@ jobs:

steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
Expand All @@ -64,7 +64,7 @@ jobs:

steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
- uses: pre-commit/action@v3.0.1
9 changes: 6 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
# friend projects below to the latest one
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, macos-latest, windows-latest]
test-set: [base]
include:
- {python-version: "3.13", os: ubuntu-latest, test-set: friend-projects}
exclude:
# TODO Add Windows when regex wheel available for 3.13
- {os: windows-latest, python-version: "3.13"}
Expand All @@ -29,7 +32,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand All @@ -42,14 +45,14 @@ jobs:
pip install -U tox
- name: Download more tests from friend projects
if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest'
if: matrix.test-set == 'friend-projects'
run: sh download-more-tests.sh
- name: Tox tests
run: |
tox -e py
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
flags: ${{ matrix.os }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
16 changes: 13 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.6.2
hooks:
- id: ruff
args: ["--exit-non-zero-on-fix"]
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
Expand All @@ -19,14 +19,24 @@ repos:
- id: trailing-whitespace
exclude: tests/fixtures/xfail/trailing-whitespaces.rst

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.2
hooks:
- id: check-github-workflows

- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
- id: actionlint

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
hooks:
- id: pyproject-fmt
additional_dependencies: [tox]

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
rev: v0.19
hooks:
- id: validate-pyproject

Expand Down
12 changes: 12 additions & 0 deletions sphinxlint/checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,3 +513,15 @@ def check_dangling_hyphen(file, lines, options):
stripped_line = line.rstrip("\n")
if _has_dangling_hyphen(stripped_line):
yield lno + 1, "Line ends with dangling hyphen"


@checker(".rst", ".po", rst_only=False, enabled=True)
def check_unnecessary_parentheses(filename, lines, options):
"""Check for unnecessary parentheses in :func: and :meth: roles.
Bad: :func:`test()`
Good: :func:`test`
"""
for lno, line in enumerate(lines, start=1):
if match := rst.ROLE_WITH_UNNECESSARY_PARENTHESES_RE.search(line):
yield lno, f"Unnecessary parentheses in {match.group(0).strip()!r}"
2 changes: 2 additions & 0 deletions sphinxlint/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,5 @@ def inline_markup_gen(start_string, end_string, extra_allowed_before=""):
)

ROLE_MISSING_CLOSING_BACKTICK_RE = re.compile(rf"({ROLE_HEAD}`[^`]+?)[^`]*$")

ROLE_WITH_UNNECESSARY_PARENTHESES_RE = re.compile(r"(^|\s):(func|meth):`[^`]+\(\)`")

0 comments on commit f603221

Please sign in to comment.