fastapi/fastapi
163 findings in 553 Python files · 34,865 lines · scanned in 26.5 s on 2026-11-12
Every number here comes from the same analyzer that runs on your upload, on the tree as it is in the repository. A finding is listed with the function or module it sits in; nothing is matched from text. Tests, examples and benchmarks are excluded from the scan, so "never referenced inside the project" means exactly that.
import_cycle 2
modules that import each other
fastapi._compatCircular import between 2 modules: fastapi._compat -> fastapi._compat.v2fastapiCircular import between 8 modules: fastapi -> fastapi.applications -> fastapi.dependencies.utils -> fastapi.exception_handlers -> fastapi.openapi.utils -> fastapi.routing -> fastapi.telemetry._asgi -> fastapi.utils
god_class 1
a class that owns too much
fastapi.routing.APIRouter32 methods — likely does too much
wide_signature 7
functions that take so many arguments the call sites are unreadable
fastapi.encoders.jsonable_encoder9 parameters — a call site says nothing about them; group them into one object or split the function - reachable from 24 call sites (docs_src/body_updates/tutorial001.py:30, docs_src/body_updates/tutorial002.py:34, docs_src/encoder/tutorial001.py:21)fastapi.routing.get_request_handler16 parameters — a call site says nothing about them; group them into one object or split the function - reachable from 1 call site (fastapi/routing.py:1285)fastapi.security.oauth2.OAuth2PasswordRequestFormStrict.__init__6 parameters — a call site says nothing about them; group them into one object or split the function - reachable from 22 call sites (fastapi/exceptions.py:83, fastapi/exceptions.py:154, fastapi/exceptions.py:220)fastapi.security.oauth2.OAuth2PasswordBearer.__init__6 parameters — a call site says nothing about them; group them into one object or split the function - reachable from 22 call sites (fastapi/exceptions.py:83, fastapi/exceptions.py:154, fastapi/exceptions.py:220)fastapi.security.oauth2.OAuth2AuthorizationCodeBearer.__init__7 parameters — a call site says nothing about them; group them into one object or split the function - reachable from 22 call sites (fastapi/exceptions.py:83, fastapi/exceptions.py:154, fastapi/exceptions.py:220)fastapi.utils.create_model_field6 parameters — a call site says nothing about them; group them into one object or split the function - reachable from 5 call sites (fastapi/dependencies/utils.py:586, fastapi/dependencies/utils.py:1418, fastapi/routing.py:1100)
and 1 more of the same check.
complex 21
branchy functions, counted from the AST
fastapi.dependencies.utils.analyze_paramcyclomatic complexity 55fastapi.encoders.jsonable_encodercyclomatic complexity 35fastapi.openapi.utils.get_openapi_pathcyclomatic complexity 45fastapi.routing.get_request_handler.<locals>.appcyclomatic complexity 38fastapi.routing._populate_api_route_statecyclomatic complexity 31fastapi.telemetry._asgi.NativeTelemetry.__call__cyclomatic complexity 49
and 15 more of the same check.
duplicate 30
the same block in two places
docs_src.custom_request_and_route.tutorial001.GzipRequest.bodyIdentical code in 2 functions (docs_src.custom_request_and_route.tutorial001.GzipRequest.body, docs_src.custom_request_and_route.tutorial001_non_an.GzipRequest.body) — extract it into one function and call it from eachdocs_src.custom_request_and_route.tutorial001.GzipRoute.get_route_handlerIdentical code in 2 functions (docs_src.custom_request_and_route.tutorial001.GzipRoute.get_route_handler, docs_src.custom_request_and_route.tutorial001_non_an.GzipRoute.get_route_handler) — extract it into one function and call it from eachdocs_src.custom_request_and_route.tutorial002.ValidationErrorLoggingRoute.get_route_handlerIdentical code in 2 functions (docs_src.custom_request_and_route.tutorial002.ValidationErrorLoggingRoute.get_route_handler, docs_src.custom_request_and_route.tutorial002_non_an.ValidationErrorLoggingRoute.get_route_handler) — extract it into one function and call it from eachdocs_src.custom_request_and_route.tutorial002.ValidationErrorLoggingRoute.get_route_handler.<locals>.custom_route_handlerIdentical code in 2 functions (docs_src.custom_request_and_route.tutorial002.ValidationErrorLoggingRoute.get_route_handler.<locals>.custom_route_handler, docs_src.custom_request_and_route.tutorial002_non_an.ValidationErrorLoggingRoute.get_route_handler.<locals>.custom_route_handler) — extract it into one function and call it from eachdocs_src.dependencies.tutorial002.read_itemsIdentical code in 3 functions (docs_src.dependencies.tutorial002.read_items, docs_src.dependencies.tutorial003.read_items, docs_src.dependencies.tutorial004.read_items) — extract it into one function and call it from eachdocs_src.dependencies.tutorial002_non_an.read_itemsIdentical code in 2 functions (docs_src.dependencies.tutorial002_non_an.read_items, docs_src.dependencies.tutorial003_non_an.read_items) — extract it into one function and call it from each
and 24 more of the same check.
hub 2
a module everything depends on
fastapi._compat.shared.lenient_issubclasscalled from 17 places — change here ripples widelyfastapi.encoders.jsonable_encodercalled from 15 places — change here ripples widely
deep_conditions 1
conditionals nested past the point anyone can hold them
fastapi.openapi.utils.get_openapi_path5 nested if-blocks — return early on the failing case, or extract the innermost branch into its own function - reachable from 3 call sites (fastapi/openapi/utils.py:386, fastapi/openapi/utils.py:623, fastapi/openapi/utils.py:643)
mutable_default 3
a default argument shared between every call
docs_src.query_params_str_validations.tutorial012.read_itemsdefault for q is shared by every call — append to it and the next caller inherits the leftoversdocs_src.query_params_str_validations.tutorial013.read_itemsdefault for q is shared by every call — append to it and the next caller inherits the leftoversfastapi._compat.v2.ModelField.validatedefault for values is shared by every call — append to it and the next caller inherits the leftovers - reachable from 3 call sites (fastapi/dependencies/utils.py:803, fastapi/routing.py:336, fastapi/routing.py:530)
suspicious_host 4
a hard-coded host or address
fastapi.telemetry._asgisends data to opentelemetry.io - not a host this project's manifest would explain; review what it uploadsfastapi.utilssends data to fastapi.tiangolo.com - not a host this project's manifest would explain; review what it uploadsscripts.doc_parsing_utilssends data to fastapi.tiangolo.com - not a host this project's manifest would explain; review what it uploadsscripts.prepare_releasesends data to fastapi.tiangolo.com - not a host this project's manifest would explain; review what it uploads
large_module 3
a check from the analyzer
fastapi.applications4816 linesfastapi.param_functions2568 linesfastapi.routing6552 lines
unused 24
never called, never imported, never read
docs_src.dependencies.tutorial007.get_dbnever referenced inside the project (dead code or public API)docs_src.dependencies.tutorial008.dependency_cnever referenced inside the project (dead code or public API)docs_src.dependencies.tutorial008_non_an.dependency_cnever referenced inside the project (dead code or public API)docs_src.dependencies.tutorial010.get_dbnever referenced inside the project (dead code or public API)docs_src.python_types.tutorial003.get_name_with_agenever referenced inside the project (dead code or public API)docs_src.python_types.tutorial004.get_name_with_agenever referenced inside the project (dead code or public API)
and 18 more of the same check.
bad_name 19
a name that does not say what the thing holds
fastapi.concurrency.contextmanager_in_threadpoolnames say nothing (cm, ok) — rename to what they holdfastapi.param_functions.Pathnames say nothing (ge, gt, le, lt) — rename to what they holdfastapi.param_functions.Querynames say nothing (ge, gt, le, lt) — rename to what they holdfastapi.param_functions.Headernames say nothing (ge, gt, le, lt) — rename to what they holdfastapi.param_functions.Cookienames say nothing (ge, gt, le, lt) — rename to what they holdfastapi.param_functions.Bodynames say nothing (ge, gt, le, lt) — rename to what they hold
and 13 more of the same check.
no_contract 46
a function whose docstring promises nothing
docs_src.custom_docs_ui.tutorial001.custom_swagger_ui_htmlno docstring and no type hints — what it takes and returns is only visible by reading the bodydocs_src.custom_docs_ui.tutorial001.redoc_htmlno docstring and no type hints — what it takes and returns is only visible by reading the bodydocs_src.custom_docs_ui.tutorial002.custom_swagger_ui_htmlno docstring and no type hints — what it takes and returns is only visible by reading the bodydocs_src.custom_docs_ui.tutorial002.redoc_htmlno docstring and no type hints — what it takes and returns is only visible by reading the bodydocs_src.custom_response.tutorial002.read_itemsno docstring and no type hints — what it takes and returns is only visible by reading the bodydocs_src.custom_response.tutorial003.read_itemsno docstring and no type hints — what it takes and returns is only visible by reading the body
and 40 more of the same check.
Five projects free. A .zip or a public GitHub URL.
Other repositories, same treatment
- Textualize/rich 97 findings
- celery/celery 1052 findings
- encode/django-rest-framework 337 findings
- encode/httpx 26 findings
- pallets/click 85 findings
- pallets/flask 45 findings
- psf/requests 47 findings
- pydantic/pydantic 164 findings
- scrapy/scrapy 186 findings