Skip to content

Commit

Permalink
doc: adding docstring linting based on ruff (#7463)
Browse files Browse the repository at this point in the history
* wip: docstrings linting

* set ruff rules
  • Loading branch information
davidsbatista authored Apr 23, 2024
1 parent 9c56dbe commit 958f1eb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/docstrings_linting.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion haystack/core/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ def run(self, word: str):
},
) 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
Expand Down
23 changes: 15 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = [
Expand Down

0 comments on commit 958f1eb

Please sign in to comment.