Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

3.7 KB
Raw Blame
exclude = [
    "migrations/*",
    ".git",
    ".git/**",
]
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
    "PLC0414", # useless-import-alias
    "PLE0604", # invalid-all-object
    "PLE0605", # invalid-all-format
    "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
    "RUF022",  # unsorted-dunder-all
    "S506",    # unsafe-yaml-load
    "SIM",     # flake8-simplify rules
    "T201",    # print-found
    "TRY400",  # error-instead-of-exception
    "TRY401",  # verbose-log-message
    "UP",      # pyupgrade rules
    "W191",    # tab-indentation
    "W605",    # invalid-escape-sequence
    "G001",    # don't use str format to logging messages
    "G003",    # don't use + in logging messages
    "G004",    # don't use f-strings to format logging messages
    "UP042",   # use StrEnum,
    "S110",    # disallow the try-except-pass pattern.

    # security related linting rules
    # RCE proctection (sort of)
    "S102", # exec-builtin, disallow use of `exec`
    "S307", # suspicious-eval-usage, disallow use of `eval` and `ast.literal_eval`
    "S301", # suspicious-pickle-usage, disallow use of `pickle` and its wrappers.
    "S302", # suspicious-marshal-usage, disallow use of `marshal` module
    "S311", # suspicious-non-cryptographic-random-usage,
    "TID",   # flake8-tidy-imports

]

ignore = [
    "B901",    # allow return in yield
    "N815",    # mixed-case-variable-in-class-scope
    "SIM102",  # collapsible-if
    "SIM117",  # multiple-with-statements
]

[lint.per-file-ignores]
"configs/*" = [
    "N802", # invalid-function-name
]
"libs/gmpy2_pkcs10aep_cipher.py" = [
    "N803", # invalid-argument-name
]
"services/billing_client/*" = [
    "TID251", # the billing client is the one place that reads billing settings and calls the transport
]
"tests/*" = [
    "T201", # allow print in tests,
    "S110", # allow ignoring exceptions in tests code (currently)
]

[lint.flake8-tidy-imports.banned-api."flask_restx.reqparse"]
msg = "Use Pydantic payload/query models instead of reqparse."

[lint.flake8-tidy-imports.banned-api."flask_restx.reqparse.RequestParser"]
msg = "Use Pydantic payload/query models instead of reqparse."

[lint.flake8-tidy-imports.banned-api."configs.dify_config.BILLING_API_URL"]
msg = "Only services.billing_client reaches billing/saas. Call a generated operation from services.billing_client instead."

[lint.flake8-tidy-imports.banned-api."configs.dify_config.BILLING_API_SECRET_KEY"]
msg = "Only services.billing_client reaches billing/saas. Call a generated operation from services.billing_client instead."

[lint.flake8-tidy-imports.banned-api."configs.dify_config.BILLING_QUOTA_API_URL"]
msg = "Only services.billing_client reaches billing/saas. Call a generated operation from services.billing_client instead."

[lint.flake8-tidy-imports.banned-api."configs.dify_config.NETWORK_ACCESS_API_URL"]
msg = "Only services.billing_client reaches billing/saas. Call a generated operation from services.billing_client instead."

[lint.flake8-tidy-imports.banned-api."services.billing_client.transport.request"]
msg = "Allowlist the operation in api/dev/generate_billing_client.py, regenerate, and call the generated function."

[lint.isort]
known-first-party = ["graphon"]