Skip to content

Commit

Permalink
Activate ALL Ruff rules with some exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
cbornet committed Aug 22, 2024
1 parent 0607ad7 commit 90b45ab
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
44 changes: 40 additions & 4 deletions libs/astradb/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,46 @@ optional = true
langchain-core = { git = "https://github.com/langchain-ai/langchain.git", subdirectory = "libs/core" }

[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # pyflakes
"I", # isort
pydocstyle.convention = "google"
pep8-naming.classmethod-decorators = [
"langchain_core.pydantic_v1.validator",
]
select = ["ALL"]
ignore = [
"ANN", # Already checked by mypy
"C90", # Do we want to activate (complexity) ?
"COM812", # Messes with the formatter
"D100", # Do we want to activate (docstring in module) ?
"D104", # Do we want to activate (docstring in package) ?
"D105", # Do we want to activate (docstring in magic method) ?
"D107", # Do we want to activate (docstring in __init__) ?
"EM", # Do we want to activate (error messages) ?
"ERA", # Do we want to activate (no commented code) ?
"FBT", # Do we want to activate (boolean trap) ?
"ISC001", # Messes with the formatter
"PERF203", # Incorrect detection
"PLR09", # TODO: do we enforce these ones (complexity) ?
"PTH", # Do we want to activate (use pathlib) ?
"TRY003", # A bit too strict ?

"BLE001", # TODO
"PT011", # TODO
"PT012", # TODO
"D101", # TODO
"D417", # TODO

]

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"D",
"S101",
"SLF001",
"T201",
"PLR2004",
]
"scripts/*" = [
"T201",
]

[tool.mypy]
Expand Down
4 changes: 2 additions & 2 deletions libs/astradb/tests/integration_tests/test_caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ async def aembed_query(self, text: str) -> list[float]:
class FakeLLM(LLM):
"""Fake LLM wrapper for testing purposes."""

queries: Optional[Mapping] = None
sequential_responses: Optional[bool] = False
queries: Optional[Mapping] = None # noqa: UP007
sequential_responses: Optional[bool] = False # noqa: UP007
response_index: int = 0

@validator("queries", always=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ def test_astradb_loader_findoptions_deprecation(
self,
astra_db_credentials: AstraDBCredentials,
collection: Collection,
core_astra_db: AstraDB,
) -> None:
"""Test deprecation of 'find_options' and related warnings/errors."""
loader0 = AstraDBLoader(
Expand Down

0 comments on commit 90b45ab

Please sign in to comment.