Skip to content
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

refactor: enable linting of docs/custom_conf.py #1330

Merged
Merged
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
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# ruff: noqa
import sys
import os

Expand Down Expand Up @@ -99,6 +98,12 @@
]
exclude_patterns.extend(custom_excludes)

rst_epilog = '''
.. include:: /reuse/links.txt
'''
if 'custom_rst_epilog' in locals():
rst_epilog = custom_rst_epilog

source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
Expand Down
7 changes: 3 additions & 4 deletions docs/custom_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# ruff: noqa
import datetime
import pathlib
import sys
Expand Down Expand Up @@ -100,7 +99,7 @@ def _compute_navigation_tree(context):
# -H 'Accept: application/vnd.github.v3.raw' \
# https://api.github.com/repos/canonical/<REPO> | jq '.created_at'

copyright = '%s, %s' % (datetime.date.today().year, author)
copyright = '%s, %s' % (datetime.date.today().year, author) # noqa: A001

## Open Graph configuration - defines what is displayed as a link preview
## when linking to the documentation from another website (see https://ogp.me/)
Expand Down Expand Up @@ -235,7 +234,7 @@ def _compute_navigation_tree(context):
# Specify a reST string that is included at the end of each file.
# If commented out, use the default (which pulls the reuse/links.txt
# file into each reST file).
# custom_rst_epilog = ''
custom_rst_epilog = ''

# By default, the documentation includes a feedback button at the top.
# You can disable it by setting the following configuration to True.
Expand Down Expand Up @@ -409,7 +408,7 @@ def run(self):
domain = self.env.get_domain('changeset')
domain.note_changeset(node)

ret: list[Node] = [node]
ret = [node]
ret += messages
return ret

Expand Down
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ ignore = [
# Unnecessary `tuple` call (rewrite as a literal)
"C408",
]

[tool.ruff.lint.per-file-ignores]
"test/*" = [
# All documentation linting.
Expand All @@ -181,6 +182,16 @@ ignore = [
"S605", # Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
"S607", # Starting a process with a partial executable path
]
"docs/custom_conf.py" = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"E266", # Too many leading `#` before block comment
"I001", # Import block is un-sorted or un-formatted
"RUF003", # Comment contains ambiguous unicode characters (EN DASH, RIGHT SINGLE QUOTATION MARK)
"UP031", # Use format specifiers instead of percent format
]

[tool.ruff.lint.pydocstyle]
convention = "google"
Expand Down
Loading