Skip to content
Draft
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
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,12 @@ repos:
entry: pixi run -e default python scripts/check_init_files_precommit_hook.py --mode=forbid
files: ^(diracx-|extensions/gubbins/gubbins-)[a-z]+/src/[a-z]+/[a-z]+/[a-z_]+/.+\.py$
exclude: (__init__\.py$|test|_generated|__main__|/patches/)

- repo: local
hooks:
- id: forbid-rest-docstrings
name: forbid reST docstring tags (use Google style, see #927)
language: pygrep
entry: '^\s*:(param|type|returns?|rtype|raises?|ivar|cvar|vartype)\b'
types: [python]
exclude: "^(diracx-client/src/diracx/client|extensions/gubbins/gubbins-client/src/gubbins/client)/"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about?

Suggested change
exclude: "^(diracx-client/src/diracx/client|extensions/gubbins/gubbins-client/src/gubbins/client)/"
exclude: '/_generated/'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This suggestion does not work:
`pixi run -e pre-commit pre-commit run --all-files forbid-rest-docstrings
✨ Pixi task (pre-commit in pre-commit): pre-commit run --all-files forbid-rest-docstrings
forbid reST docstring tags (use Google style, see........................Failed

  • hook id: forbid-rest-docstrings
  • exit code: 1

diracx-client/src/diracx/client/patches/client/aio.py:93: :param request: The pipeline request object to be modified.
diracx-client/src/diracx/client/patches/client/aio.py:94: :type request: ~azure.core.pipeline.PipelineRequest
diracx-client/src/diracx/client/patches/client/aio.py:95: :raises: :class:~azure.core.exceptions.ServiceRequestError
diracx-client/src/diracx/client/patches/client/sync.py:73: :param request: The pipeline request object to be modified.
diracx-client/src/diracx/client/patches/client/sync.py:74: :type request: ~azure.core.pipeline.PipelineRequest
diracx-client/src/diracx/client/patches/client/sync.py:75: :raises: :class:`~azure.core.exceptions.ServiceRequestError``

8 changes: 5 additions & 3 deletions diracx-routers/tests/health/test_probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ async def test_startup(client_factory):
async def _test_after_clear(config_source, probe_fcn):
"""Ensure that the probe fails after clearing the config source caches.

:param config_source: The config source to clear.
:param probe_fcn: The function to call to make the probe request.
Args:
config_source: The config source to clear.
probe_fcn: The function to call to make the probe request.

:return: The response from the probe.
Returns:
The response from the probe.
"""
orig_r = probe_fcn()
assert orig_r.status_code == 200, orig_r.text
Expand Down
41 changes: 37 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ ignore = [
"B006",
"S101", # bandit: use of assert https://docs.astral.sh/ruff/rules/assert/
# TODO: Maybe enable these
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D107",
Expand All @@ -73,6 +69,43 @@ required-imports = ["from __future__ import annotations"]
# import-mode=importlib, packages with common names (e.g. tests/jobs) collide
# in sys.modules when several diracx-* packages are collected in one run
"diracx-*/tests/*" = ["S", "INP"]
"diracx-api/src/diracx/api/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-api/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-db/src/diracx/db/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-db/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-cli/src/diracx/cli/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-cli/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-core/src/diracx/core/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-core/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-logic/src/diracx/logic/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-logic/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-tasks/src/diracx/tasks/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-tasks/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-testing/src/diracx/testing/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-client/src/diracx/client/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-client/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"diracx-routers/src/diracx/routers/**/*py" = ["D100", "D101", "D102", "D103"]
"diracx-routers/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-api/src/gubbins/api/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-api/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-cli/src/gubbins/cli/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-cli/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-client/src/gubbins/client/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-client/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-core/src/gubbins/core/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-core/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-db/src/gubbins/db/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-db/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-logic/src/gubbins/logic/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-logic/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-routers/src/gubbins/routers/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-routers/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-tasks/src/gubbins/tasks/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-tasks/tests/**/*.py" = ["D100", "D101", "D102", "D103"]
"extensions/gubbins/gubbins-testing/src/gubbins/testing/**/*.py" = ["D100", "D101", "D102", "D103"]
Comment on lines +89 to +105

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not fully sure this is going to work, I think these need to go in extensions/gubbins/pyproject.toml.
Btw, I just noticed that the following blocks should also be added there ideally:

[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint]
select = [
    ...
    "D",   # pydocstyle

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This does work. The way I noticed a problem with gubbins was that there is a non google comment there. To silence it I added the lines above and the error is gone.

"tests/*.py" = ["D100", "D101", "D102", "D103"]
"scripts/*.py" = ["D100", "D101", "D102", "D103"]


[tool.ruff.lint.extend-per-file-ignores]
"diracx-routers/src/diracx/routers/access_policies.py" = ["I002"]
Expand Down
Loading