mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-21 18:05:30 -04:00
5cb24625c3
* chore(python): temporarily disable `UP007` rule in Ruff Disable the `UP007` rule temporarily due to numerous existing violations in the current codebase. * ci(python): add lint and test for Python SDK * ci: Add mega-linter * chore(python): Add final newline to markdown files * fix(python): Fix linter issues by using ruff's auto fix * fix(python): Fix TRY400 linter violations Ruff suggests using `logger.exception` to log when logging an exception, instead of using `logging.error`. The former logs the exception and the traceback automatically. ref: https://docs.astral.sh/ruff/rules/error-instead-of-exception/ * fix(python): fix ruff linter violations * test(python): Add Test cases for LLM entities Test the initialization of `LLMResult` and `LLMResultChunk`. * test(python): Add test for `AgentModelConfig` Ensures that the `history_prompt_messages` attribute is not shared between instances of `AgentModelConfig`. * chore(python): output diffs in Ruff's format check * style(python): format code with Ruff * chore(python): Add a bash script for fix and format python code * chore: add `persist-credentials: false` to checkout action Enhances security by preventing subsequent steps from accessing GitHub credentials, reducing potential attack surfaces. Ref: https://github.com/actions/checkout#checkout-v4
97 lines
2.9 KiB
TOML
97 lines
2.9 KiB
TOML
line-length = 120
|
|
|
|
[format]
|
|
quote-style = "double"
|
|
|
|
[lint]
|
|
preview = false
|
|
select = [
|
|
"B", # flake8-bugbear rules
|
|
"C4", # flake8-comprehensions
|
|
"E", # pycodestyle E rules
|
|
"F", # pyflakes rules
|
|
"FURB", # refurb rules
|
|
"I", # isort rules
|
|
"N", # pep8-naming
|
|
"PT", # flake8-pytest-style rules
|
|
"PLC0208", # iteration-over-set
|
|
"PLC2801", # unnecessary-dunder-call
|
|
"PLC0414", # useless-import-alias
|
|
"PLR0402", # manual-from-import
|
|
"PLR1711", # useless-return
|
|
"PLR1714", # repeated-equality-comparison
|
|
"RUF013", # implicit-optional
|
|
"RUF019", # unnecessary-key-check
|
|
"RUF100", # unused-noqa
|
|
"RUF101", # redirected-noqa
|
|
"RUF200", # invalid-pyproject-toml
|
|
"S506", # unsafe-yaml-load
|
|
"SIM", # flake8-simplify rules
|
|
"TRY400", # error-instead-of-exception
|
|
"TRY401", # verbose-log-message
|
|
"UP", # pyupgrade rules
|
|
"W191", # tab-indentation
|
|
"W605", # invalid-escape-sequence
|
|
|
|
# Security related linting rules
|
|
# https://docs.astral.sh/ruff/rules/#flake8-bandit-s
|
|
"S",
|
|
|
|
# avoid shadowing builtins
|
|
# https://docs.astral.sh/ruff/rules/#flake8-builtins-a
|
|
"A",
|
|
|
|
# prohibit calls to `breakpoint()` in committed code
|
|
# https://docs.astral.sh/ruff/rules/#flake8-debugger-t10
|
|
"T10",
|
|
|
|
# disallow calling functions with boolean positional
|
|
# arguments.
|
|
#
|
|
# https://docs.astral.sh/ruff/rules/boolean-positional-value-in-call/
|
|
"FBT003",
|
|
|
|
# Pycodestyle's warning
|
|
# https://docs.astral.sh/ruff/rules/#warning-w
|
|
"W",
|
|
|
|
# Ruff specific rules
|
|
# https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
|
|
"RUF",
|
|
]
|
|
|
|
ignore = [
|
|
# ===================== Ruff-specific rules (RUF) =====================
|
|
# ambiguous-unicode-character-string,
|
|
# disabled beacause of false positives
|
|
# ref: https://docs.astral.sh/ruff/rules/ambiguous-unicode-character-string/
|
|
"RUF001",
|
|
|
|
# ===================== flake8-bandit (S) rules =====================
|
|
"S101", # use of assert detected, https://docs.astral.sh/ruff/rules/assert/
|
|
# hardcoded-bind-all-interfaces, https://docs.astral.sh/ruff/rules/hardcoded-bind-all-interfaces/
|
|
# disabled beacause of false positives
|
|
"S104",
|
|
# hardcoded-password-string, https://docs.astral.sh/ruff/rules/hardcoded-password-string/
|
|
# disabled beacause of false positives
|
|
"S105",
|
|
|
|
"E402", # module-import-not-at-top-of-file
|
|
"N815", # mixed-case-variable-in-class-scope
|
|
|
|
# deprecated and not recommended
|
|
#
|
|
# https://docs.astral.sh/ruff/rules/non-pep604-isinstance/
|
|
"UP038",
|
|
|
|
# Disable UP007 for now due to the significant number of
|
|
# violations in the current codebase.
|
|
#
|
|
# Reference: https://docs.astral.sh/ruff/rules/non-pep604-annotation-union/
|
|
"UP007",
|
|
]
|
|
|
|
|
|
[lint.pyflakes]
|
|
extend-generics = ["_pytest.monkeypatch", "tests.integration_tests"]
|