Skip to content

Add sphinx-lint session to noxfile #1800

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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: 1 addition & 1 deletion .github/workflows/test-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ jobs:

- name: Lint translation file
if: always()
run: sphinx-lint locales/${{ matrix.language }}/LC_MESSAGES/messages.po
run: nox -s sphinx_lint -- locales/${{ matrix.language }}/LC_MESSAGES/messages.po
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
noxenv:
- build
- linkcheck
- sphinx_lint

steps:
- uses: actions/checkout@v3
Expand Down
11 changes: 11 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,14 @@ def checkqa(session):
"--all-files",
"--show-diff-on-failure",
)


@nox.session()
def sphinx_lint(session):
"""
Check for reST format issues in source rst files,
accepting another path as positional argument.
"""
session.install("sphinx-lint==1.0.0")
target = session.posargs if len(session.posargs) >= 1 else ["source"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this would probably be more elegant

Suggested change
target = session.posargs if len(session.posargs) >= 1 else ["source"]
target = session.posargs or ["source"]

session.run("sphinx-lint", *target)
Loading