Merge "Add autopep8, doc8 and ruff"

This commit is contained in:
Zuul authored and Gerrit Code Review committed 2026-09-24 23:31:00 +00:00
commit 7bb19ca610
4 files changed
+64 -5

No files matched your search

+16 -5
View File
@@ -18,19 +18,30 @@ repos:
- id: debug-statements
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://github.com/hhatto/autopep8
rev: v2.3.2
hooks:
- id: autopep8
files: '^.*\.py$'
- repo: https://opendev.org/openstack/hacking
rev: 7.0.0
rev: 8.0.0
hooks:
- id: hacking
additional_dependencies: []
- repo: https://github.com/asottile/pyupgrade
rev: v3.20.0
- repo: https://github.com/PyCQA/doc8
rev: v2.0.0
hooks:
- id: pyupgrade
args: [--py311-plus]
- id: doc8
- repo: https://github.com/openstack/bashate
rev: 2.1.1
hooks:
- id: bashate
args: ['-v', '-iE006']
exclude: '.tox/.*'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.7
hooks:
- id: ruff-check
args: ['--fix', '--unsafe-fixes', '--show-fixes']
# TODO(tkajinam): Enable this later
#- id: ruff-format
+2
View File
@@ -17,6 +17,7 @@ Install your OpenStack environment and patch your ``openstack`` client
application using python.
.. code:: console
git clone https://opendev.org/openstack/python-observabilityclient.git
cd python-observabilityclient
sudo pip install .
@@ -30,6 +31,7 @@ Use ``openstack metric query somequery`` to query for metrics in prometheus.
To use the python api do the following:
.. code:: python
from observabilityclient import client
c = client.Client(
+45
View File
@@ -44,3 +44,48 @@ metric_query = "observabilityclient.v1.cli:Query"
metric_delete = "observabilityclient.v1.cli:Delete"
metric_clean-tombstones = "observabilityclient.v1.cli:CleanTombstones"
metric_snapshot = "observabilityclient.v1.cli:Snapshot"
[tool.autopep8]
aggressive = 3
in-place = true
recursive = true
ignore = ["E731"]
[tool.doc8]
ignore = ["D001"]
[tool.ruff]
line-length = 79
[tool.ruff.lint]
select = [
# mcabe complexity checks
"C90",
# multiple-imports-on-one-line, module-import-not-at-top-of-file
"E4",
# line-too-long, redundant-backslash
"E5",
"E7",
"E9",
# pyflakes
"F",
"G",
"LOG",
"S",
"UP",
"W",
]
external = ["H"]
ignore = [
# UP031 % format — defer f-string migration to a later pass
"UP031",
# UP032 f-string — defer migration to a later pass
"UP032",
]
[tool.ruff.lint.per-file-ignores]
"observabilityclient/tests/*" = ["S"]
[tool.ruff.lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds 20.
max-complexity = 20
+1
View File
@@ -52,6 +52,7 @@ deps =
commands = sphinx-build --keep-going -b html doc/source doc/build/html
[flake8]
select = H
show-source = True
# W504 line break after binary operator
ignore = W504