From c3f4fad01f437f672ae63e09c7510696832b9a46 Mon Sep 17 00:00:00 2001 From: James Garner Date: Thu, 22 Aug 2024 15:16:49 +1200 Subject: [PATCH] Selectively disable linting for docs/custom_conf.py Re-enable linting for docs/custom_conf.py (removing global noqa), but selectively disable tests that fail, as much of this code is based on sphinx-docs-starter-pack/custom_conf.py, which does not use the same linting as this project. --- docs/custom_conf.py | 3 +-- pyproject.toml | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/custom_conf.py b/docs/custom_conf.py index f82747b25..29e964360 100644 --- a/docs/custom_conf.py +++ b/docs/custom_conf.py @@ -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 @@ -100,7 +99,7 @@ def _compute_navigation_tree(context): # -H 'Accept: application/vnd.github.v3.raw' \ # https://api.github.com/repos/canonical/ | 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/) diff --git a/pyproject.toml b/pyproject.toml index df8e348b9..e6f21a653 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -160,6 +160,7 @@ ignore = [ # Unnecessary `tuple` call (rewrite as a literal) "C408", ] + [tool.ruff.lint.per-file-ignores] "test/*" = [ # All documentation linting. @@ -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"