From f66ef5f74169dd2e9dd0bea68175071a89b50d99 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 9 Jan 2026 14:03:47 +0000 Subject: [PATCH] Enable more ruff rules Change-Id: Ife8ecbb9c411c475c346cdf1616f2e766d0d6527 Signed-off-by: Stephen Finucane --- .pre-commit-config.yaml | 6 +++--- api-ref/source/conf.py | 1 - doc/source/conf.py | 1 - openstackdocstheme/ext.py | 11 +++++------ pyproject.toml | 3 +++ releasenotes/source/conf.py | 1 - tox.ini | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 95b0db57..857ef4dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,13 +13,13 @@ repos: - id: check-yaml files: .*\.(yaml|yml)$ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.13.0 + rev: v0.14.11 hooks: - - id: ruff + - id: ruff-check args: ['--fix'] - id: ruff-format - repo: https://opendev.org/openstack/hacking - rev: 7.0.0 + rev: 8.0.0 hooks: - id: hacking additional_dependencies: [] diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index 02d07738..b70dbfd1 100644 --- a/api-ref/source/conf.py +++ b/api-ref/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2020 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/doc/source/conf.py b/doc/source/conf.py index 9ec3ff35..95dfd4eb 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2020 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/openstackdocstheme/ext.py b/openstackdocstheme/ext.py index 6621be2f..329cbeb5 100644 --- a/openstackdocstheme/ext.py +++ b/openstackdocstheme/ext.py @@ -319,10 +319,8 @@ def _get_series_name(): def _setup_link_roles(app): series = _get_series_name() for project_name in app.config.openstackdocs_projects: - url = 'https://docs.openstack.org/{}/{}/%s'.format( - project_name, series - ) - role_name = '{}-doc'.format(project_name) + url = f'https://docs.openstack.org/{project_name}/{series}/%s' + role_name = f'{project_name}-doc' logger.debug( '[openstackdocstheme] adding role %s to link to %s', role_name, @@ -439,8 +437,9 @@ def _config_inited(app, config): doc_parts = os.path.abspath(app.srcdir).split(os.sep)[-2:] if doc_parts[0] in ('api-guide', 'api-ref', 'releasenotes'): logger.debug( - f'[openstackdocstheme] auto-versioning disabled (doc name ' - f'contains {doc_parts[0]}' + '[openstackdocstheme] auto-versioning disabled (doc name ' + 'contains %s)', + doc_parts[0], ) auto_version = False else: diff --git a/pyproject.toml b/pyproject.toml index 7adf863f..8ed396ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,3 +47,6 @@ line-length = 79 [tool.ruff.format] quote-style = "preserve" docstring-code-format = true + +[tool.ruff.lint] +select = ["E4", "E5", "E7", "E9", "F", "G", "LOG", "UP"] diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 12a3b1d7..19481f98 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/tox.ini b/tox.ini index 2f7c4070..bb7a3ef1 100644 --- a/tox.ini +++ b/tox.ini @@ -82,7 +82,7 @@ deps = bindep commands = bindep test [flake8] -exclude=.venv,.git,.tox,dist,doc,api-ref,*lib/python*,*egg,tools +exclude = .venv,.git,.tox,dist,doc,api-ref,*lib/python*,*egg,tools show-source = True # We only enable the hacking (H) checks select = H