mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-07-10 05:51:50 +08:00
chore(lint): extract ruff configs into .ruff.toml file keeping pyproject.toml clean (#11222)
This commit is contained in:
parent
ef204817ae
commit
a67b0d4771
93
api/.ruff.toml
Normal file
93
api/.ruff.toml
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
exclude = [
|
||||||
|
"migrations/*",
|
||||||
|
]
|
||||||
|
line-length = 120
|
||||||
|
|
||||||
|
[format]
|
||||||
|
quote-style = "double"
|
||||||
|
|
||||||
|
[lint]
|
||||||
|
preview = true
|
||||||
|
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
|
||||||
|
]
|
||||||
|
|
||||||
|
ignore = [
|
||||||
|
"E402", # module-import-not-at-top-of-file
|
||||||
|
"E711", # none-comparison
|
||||||
|
"E712", # true-false-comparison
|
||||||
|
"E721", # type-comparison
|
||||||
|
"E722", # bare-except
|
||||||
|
"E731", # lambda-assignment
|
||||||
|
"F821", # undefined-name
|
||||||
|
"F841", # unused-variable
|
||||||
|
"FURB113", # repeated-append
|
||||||
|
"FURB152", # math-constant
|
||||||
|
"UP007", # non-pep604-annotation
|
||||||
|
"UP032", # f-string
|
||||||
|
"B005", # strip-with-multi-characters
|
||||||
|
"B006", # mutable-argument-default
|
||||||
|
"B007", # unused-loop-control-variable
|
||||||
|
"B026", # star-arg-unpacking-after-keyword-arg
|
||||||
|
"B904", # raise-without-from-inside-except
|
||||||
|
"B905", # zip-without-explicit-strict
|
||||||
|
"N806", # non-lowercase-variable-in-function
|
||||||
|
"N815", # mixed-case-variable-in-class-scope
|
||||||
|
"PT011", # pytest-raises-too-broad
|
||||||
|
"SIM102", # collapsible-if
|
||||||
|
"SIM103", # needless-bool
|
||||||
|
"SIM105", # suppressible-exception
|
||||||
|
"SIM107", # return-in-try-except-finally
|
||||||
|
"SIM108", # if-else-block-instead-of-if-exp
|
||||||
|
"SIM113", # eumerate-for-loop
|
||||||
|
"SIM117", # multiple-with-statements
|
||||||
|
"SIM210", # if-expr-with-true-false
|
||||||
|
"SIM300", # yoda-conditions,
|
||||||
|
]
|
||||||
|
|
||||||
|
[lint.per-file-ignores]
|
||||||
|
"__init__.py" = [
|
||||||
|
"F401", # unused-import
|
||||||
|
"F811", # redefined-while-unused
|
||||||
|
]
|
||||||
|
"configs/*" = [
|
||||||
|
"N802", # invalid-function-name
|
||||||
|
]
|
||||||
|
"libs/gmpy2_pkcs10aep_cipher.py" = [
|
||||||
|
"N803", # invalid-argument-name
|
||||||
|
]
|
||||||
|
"tests/*" = [
|
||||||
|
"F811", # redefined-while-unused
|
||||||
|
"F401", # unused-import
|
||||||
|
]
|
||||||
|
|
||||||
|
[lint.pyflakes]
|
||||||
|
extend-generics = [
|
||||||
|
"_pytest.monkeypatch",
|
||||||
|
"tests.integration_tests",
|
||||||
|
]
|
40
api/poetry.lock
generated
40
api/poetry.lock
generated
@ -8462,29 +8462,29 @@ pyasn1 = ">=0.1.3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruff"
|
name = "ruff"
|
||||||
version = "0.7.4"
|
version = "0.8.1"
|
||||||
description = "An extremely fast Python linter and code formatter, written in Rust."
|
description = "An extremely fast Python linter and code formatter, written in Rust."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "ruff-0.7.4-py3-none-linux_armv6l.whl", hash = "sha256:a4919925e7684a3f18e18243cd6bea7cfb8e968a6eaa8437971f681b7ec51478"},
|
{file = "ruff-0.8.1-py3-none-linux_armv6l.whl", hash = "sha256:fae0805bd514066f20309f6742f6ee7904a773eb9e6c17c45d6b1600ca65c9b5"},
|
||||||
{file = "ruff-0.7.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:cfb365c135b830778dda8c04fb7d4280ed0b984e1aec27f574445231e20d6c63"},
|
{file = "ruff-0.8.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b8a4f7385c2285c30f34b200ca5511fcc865f17578383db154e098150ce0a087"},
|
||||||
{file = "ruff-0.7.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:63a569b36bc66fbadec5beaa539dd81e0527cb258b94e29e0531ce41bacc1f20"},
|
{file = "ruff-0.8.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:cd054486da0c53e41e0086e1730eb77d1f698154f910e0cd9e0d64274979a209"},
|
||||||
{file = "ruff-0.7.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d06218747d361d06fd2fdac734e7fa92df36df93035db3dc2ad7aa9852cb109"},
|
{file = "ruff-0.8.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2029b8c22da147c50ae577e621a5bfbc5d1fed75d86af53643d7a7aee1d23871"},
|
||||||
{file = "ruff-0.7.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e0cea28d0944f74ebc33e9f934238f15c758841f9f5edd180b5315c203293452"},
|
{file = "ruff-0.8.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2666520828dee7dfc7e47ee4ea0d928f40de72056d929a7c5292d95071d881d1"},
|
||||||
{file = "ruff-0.7.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:80094ecd4793c68b2571b128f91754d60f692d64bc0d7272ec9197fdd09bf9ea"},
|
{file = "ruff-0.8.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:333c57013ef8c97a53892aa56042831c372e0bb1785ab7026187b7abd0135ad5"},
|
||||||
{file = "ruff-0.7.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:997512325c6620d1c4c2b15db49ef59543ef9cd0f4aa8065ec2ae5103cedc7e7"},
|
{file = "ruff-0.8.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:288326162804f34088ac007139488dcb43de590a5ccfec3166396530b58fb89d"},
|
||||||
{file = "ruff-0.7.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:00b4cf3a6b5fad6d1a66e7574d78956bbd09abfd6c8a997798f01f5da3d46a05"},
|
{file = "ruff-0.8.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b12c39b9448632284561cbf4191aa1b005882acbc81900ffa9f9f471c8ff7e26"},
|
||||||
{file = "ruff-0.7.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7dbdc7d8274e1422722933d1edddfdc65b4336abf0b16dfcb9dedd6e6a517d06"},
|
{file = "ruff-0.8.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:364e6674450cbac8e998f7b30639040c99d81dfb5bbc6dfad69bc7a8f916b3d1"},
|
||||||
{file = "ruff-0.7.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e92dfb5f00eaedb1501b2f906ccabfd67b2355bdf117fea9719fc99ac2145bc"},
|
{file = "ruff-0.8.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b22346f845fec132aa39cd29acb94451d030c10874408dbf776af3aaeb53284c"},
|
||||||
{file = "ruff-0.7.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3bd726099f277d735dc38900b6a8d6cf070f80828877941983a57bca1cd92172"},
|
{file = "ruff-0.8.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b2f2f7a7e7648a2bfe6ead4e0a16745db956da0e3a231ad443d2a66a105c04fa"},
|
||||||
{file = "ruff-0.7.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:2e32829c429dd081ee5ba39aef436603e5b22335c3d3fff013cd585806a6486a"},
|
{file = "ruff-0.8.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:adf314fc458374c25c5c4a4a9270c3e8a6a807b1bec018cfa2813d6546215540"},
|
||||||
{file = "ruff-0.7.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:662a63b4971807623f6f90c1fb664613f67cc182dc4d991471c23c541fee62dd"},
|
{file = "ruff-0.8.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:a885d68342a231b5ba4d30b8c6e1b1ee3a65cf37e3d29b3c74069cdf1ee1e3c9"},
|
||||||
{file = "ruff-0.7.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:876f5e09eaae3eb76814c1d3b68879891d6fde4824c015d48e7a7da4cf066a3a"},
|
{file = "ruff-0.8.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:d2c16e3508c8cc73e96aa5127d0df8913d2290098f776416a4b157657bee44c5"},
|
||||||
{file = "ruff-0.7.4-py3-none-win32.whl", hash = "sha256:75c53f54904be42dd52a548728a5b572344b50d9b2873d13a3f8c5e3b91f5cac"},
|
{file = "ruff-0.8.1-py3-none-win32.whl", hash = "sha256:93335cd7c0eaedb44882d75a7acb7df4b77cd7cd0d2255c93b28791716e81790"},
|
||||||
{file = "ruff-0.7.4-py3-none-win_amd64.whl", hash = "sha256:745775c7b39f914238ed1f1b0bebed0b9155a17cd8bc0b08d3c87e4703b990d6"},
|
{file = "ruff-0.8.1-py3-none-win_amd64.whl", hash = "sha256:2954cdbe8dfd8ab359d4a30cd971b589d335a44d444b6ca2cb3d1da21b75e4b6"},
|
||||||
{file = "ruff-0.7.4-py3-none-win_arm64.whl", hash = "sha256:11bff065102c3ae9d3ea4dc9ecdfe5a5171349cdd0787c1fc64761212fc9cf1f"},
|
{file = "ruff-0.8.1-py3-none-win_arm64.whl", hash = "sha256:55873cc1a473e5ac129d15eccb3c008c096b94809d693fc7053f588b67822737"},
|
||||||
{file = "ruff-0.7.4.tar.gz", hash = "sha256:cd12e35031f5af6b9b93715d8c4f40360070b2041f81273d0527683d5708fce2"},
|
{file = "ruff-0.8.1.tar.gz", hash = "sha256:3583db9a6450364ed5ca3f3b4225958b24f78178908d5c4bc0f46251ccca898f"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -10983,4 +10983,4 @@ cffi = ["cffi (>=1.11)"]
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = ">=3.11,<3.13"
|
python-versions = ">=3.11,<3.13"
|
||||||
content-hash = "521ed11b05c586a627cef1fadf0a6eb529449099d8f531200c060a870304c2d3"
|
content-hash = "b762e282fd140c87ae1b0be8d56ec0e1be6515ced28996f1ab0a23f3842120af"
|
||||||
|
@ -1,108 +1,12 @@
|
|||||||
[project]
|
[project]
|
||||||
|
name = "dify-api"
|
||||||
requires-python = ">=3.11,<3.13"
|
requires-python = ">=3.11,<3.13"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.ruff]
|
|
||||||
exclude=[
|
|
||||||
"migrations/*",
|
|
||||||
]
|
|
||||||
line-length = 120
|
|
||||||
|
|
||||||
[tool.ruff.lint]
|
|
||||||
preview = true
|
|
||||||
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
|
|
||||||
"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
|
|
||||||
]
|
|
||||||
ignore = [
|
|
||||||
"E402", # module-import-not-at-top-of-file
|
|
||||||
"E711", # none-comparison
|
|
||||||
"E712", # true-false-comparison
|
|
||||||
"E721", # type-comparison
|
|
||||||
"E722", # bare-except
|
|
||||||
"E731", # lambda-assignment
|
|
||||||
"F821", # undefined-name
|
|
||||||
"F841", # unused-variable
|
|
||||||
"FURB113", # repeated-append
|
|
||||||
"FURB152", # math-constant
|
|
||||||
"UP007", # non-pep604-annotation
|
|
||||||
"UP032", # f-string
|
|
||||||
"B005", # strip-with-multi-characters
|
|
||||||
"B006", # mutable-argument-default
|
|
||||||
"B007", # unused-loop-control-variable
|
|
||||||
"B026", # star-arg-unpacking-after-keyword-arg
|
|
||||||
"B904", # raise-without-from-inside-except
|
|
||||||
"B905", # zip-without-explicit-strict
|
|
||||||
"N806", # non-lowercase-variable-in-function
|
|
||||||
"N815", # mixed-case-variable-in-class-scope
|
|
||||||
"PT011", # pytest-raises-too-broad
|
|
||||||
"SIM102", # collapsible-if
|
|
||||||
"SIM103", # needless-bool
|
|
||||||
"SIM105", # suppressible-exception
|
|
||||||
"SIM107", # return-in-try-except-finally
|
|
||||||
"SIM108", # if-else-block-instead-of-if-exp
|
|
||||||
"SIM113", # eumerate-for-loop
|
|
||||||
"SIM117", # multiple-with-statements
|
|
||||||
"SIM210", # if-expr-with-true-false
|
|
||||||
"SIM300", # yoda-conditions,
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.ruff.lint.per-file-ignores]
|
|
||||||
"app.py" = [
|
|
||||||
]
|
|
||||||
"__init__.py" = [
|
|
||||||
"F401", # unused-import
|
|
||||||
"F811", # redefined-while-unused
|
|
||||||
]
|
|
||||||
"configs/*" = [
|
|
||||||
"N802", # invalid-function-name
|
|
||||||
]
|
|
||||||
"libs/gmpy2_pkcs10aep_cipher.py" = [
|
|
||||||
"N803", # invalid-argument-name
|
|
||||||
]
|
|
||||||
"tests/*" = [
|
|
||||||
"F811", # redefined-while-unused
|
|
||||||
"F401", # unused-import
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.ruff.lint.pyflakes]
|
|
||||||
extend-generics=[
|
|
||||||
"_pytest.monkeypatch",
|
|
||||||
"tests.integration_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.ruff.format]
|
|
||||||
exclude = [
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "dify-api"
|
|
||||||
package-mode = false
|
package-mode = false
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
@ -281,4 +185,4 @@ pytest-mock = "~3.14.0"
|
|||||||
optional = true
|
optional = true
|
||||||
[tool.poetry.group.lint.dependencies]
|
[tool.poetry.group.lint.dependencies]
|
||||||
dotenv-linter = "~0.5.0"
|
dotenv-linter = "~0.5.0"
|
||||||
ruff = "~0.7.3"
|
ruff = "~0.8.1"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user