doc: adding docstring linting based on ruff (#7463)

* wip: docstrings linting

* set ruff rules
This commit is contained in:
David S. Batista 2024-04-23 18:43:09 +02:00 committed by GitHub
parent 9c56dbe288
commit 958f1eb3a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 9 deletions

View File

@ -0,0 +1,20 @@
name: run docstrings linting
on:
push:
branches:
- docstrings-linting
jobs:
docstrings-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Hatch
run: pip install hatch=="1.9.3"
- name: ruff docstrings linting
run: hatch run ruff check haystack

View File

@ -851,7 +851,7 @@ class Pipeline:
},
) as span:
span.set_content_tag("haystack.component.input", last_inputs[name])
logger.info("Running component {name}", name=name)
logger.info("Running component {component_name}", component_name=name)
res = comp.run(**last_inputs[name])
self.graph.nodes[name]["visits"] += 1

View File

@ -296,14 +296,14 @@ ignore_missing_imports = true
[tool.ruff]
line-length = 301
target-version = "py38"
exclude= ["test"]
[tool.ruff.lint]
select = [
"AIR", # Airflow
"ASYNC", # flake8-async
"C4", # flake8-comprehensions
"C90", # McCabe cyclomatic complexity
"DJ", # flake8-django
"E501", # Long lines
"EXE", # flake8-executable
"F", # Pyflakes
@ -316,12 +316,19 @@ select = [
"T10", # flake8-debugger
"W", # pycodestyle
"YTT", # flake8-2020
"I" # isort
# "E", # pycodestyle
# "NPY", # NumPy-specific rules
# "PD", # pandas-vet
# "PT", # flake8-pytest-style
# "UP", # pyupgrade
"I", # isort
# built-in shadowing
"A001", # builtin-variable-shadowing
"A002", # builtin-argument-shadowing
"A003", # builtin-attribute-shadowing
# docstring rules
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D209", # Closing triple quotes go to new line
"D205", # 1 blank line required between summary line and description
"D213", # summary lines must be positioned on the second physical line of the docstring
"D417", # undocumented-parameter
"D419", # undocumented-returns
]
ignore = [