Skip to content

The agent engineering platform.

langchain-groq[patch]: Add ruff bandit rules to linter (#31797)

Mason Daugherty0efaa483e44b
diff --git a/libs/partners/groq/pyproject.toml b/libs/partners/groq/pyproject.toml
index 2a404452ff..94b29ecce8 100644
--- a/libs/partners/groq/pyproject.toml
+++ b/libs/partners/groq/pyproject.toml
@@ -44,7 +44,7 @@ disallow_untyped_defs = "True"
target-version = "py39"
[tool.ruff.lint]
-select = ["E", "F", "I", "W", "UP"]
+select = ["E", "F", "I", "W", "UP", "S"]
ignore = [ "UP007", ]
[tool.coverage.run]
@@ -57,3 +57,9 @@ markers = [
"scheduled: mark tests to run in scheduled testing",
]
asyncio_mode = "auto"
+
+[tool.ruff.lint.extend-per-file-ignores]
+"tests/**/*.py" = [
+ "S101", # Tests need assertions
+ "S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
+]
\ No newline at end of file
diff --git a/libs/partners/groq/tests/unit_tests/test_chat_models.py b/libs/partners/groq/tests/unit_tests/test_chat_models.py
index c14f793e6b..ef623c947d 100644
--- a/libs/partners/groq/tests/unit_tests/test_chat_models.py
+++ b/libs/partners/groq/tests/unit_tests/test_chat_models.py
@@ -245,8 +245,8 @@ def test_chat_groq_invalid_streaming_params() -> None:
def test_chat_groq_secret() -> None:
"""Test that secret is not printed"""
- secret = "secretKey"
- not_secret = "safe"
+ secret = "secretKey" # noqa: S105
+ not_secret = "safe" # noqa: S105
llm = ChatGroq(model="foo", api_key=secret, model_kwargs={"not_secret": not_secret}) # type: ignore[call-arg, arg-type]
stringified = str(llm)
assert not_secret in stringified