Skip to content

Lay out function bodies and clause headers in the builtin formatter - #6663

Merged
Koudai Aono (koxudaxi) merged 1 commit into
bfmt-4from
bfmt-5
Nov 10, 2026
Merged

Koudai Aono (koxudaxi) merged 1 commit into
bfmt-4from
bfmt-5

Conversation

@koxudaxi

@koxudaxi Koudai Aono (koxudaxi) commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Fixes: #6649

Summary by CodeRabbit

  • New Features

    • The built-in formatter now handles more nested statements, decorators, compound-clause headers, and conditional expressions, producing consistent multiline layouts for long code.
    • Formatting coverage includes assignments, returns, raises, assertions, loop and exception headers, match/case statements, and nested imports. Unsupported constructs remain unchanged.
  • Documentation

    • Updated formatter guidance to describe supported layouts, unchanged statement forms, and differences from Black.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The built-in formatter now formats additional nested statements, compound-statement headers, and conditional expressions. Tests and generated-output snapshots reflect the revised layouts. The documentation describes the expanded formatting scope and supported exceptions.

Changes: Formatter layout

Layer / File(s) Summary
Recursive statement formatting and line splitting
src/datamodel_code_generator/_builtin_formatter.py, src/datamodel_code_generator/_builtin_line_split.py
The formatter now traverses nested statements and clause headers, and the line splitter handles additional keyword-led statements and conditional expressions. Specific constructs remain unsupported.
Formatter expectations and generated outputs
tests/test_format.py, docs/formatter-behavior.md, tests/data/expected/*, tests/main/jsonschema/test_main_jsonschema.refs, tests/test_input_model.refs
Tests cover the new layouts and unchanged unsupported forms. Documentation and snapshot references are updated. Generated client, FastAPI, and JSON Schema outputs show the formatter’s changed line wrapping; several builtin snapshots now refer to corresponding primary snapshots.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 9b026

No actionable issue identified in the formatter changes; merge after normal checks.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: the built-in formatter now lays out function bodies and clause headers.
Linked Issues check Passed Issue #6649 requires Black-style line splitting for long statements in function bodies and nested definition headers. The formatter changes add statement traversal and wrapping for simple statements a…
Out of Scope Changes check Passed The documentation changes describe the formatter behavior. The generated expected-output changes show formatter reflow, and snapshot-reference updates consolidate expected files where outputs now matc…
Docstring Coverage Passed Docstring coverage is 86.96% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Full details: Linked Issues check

Explanation

Issue #6649 requires Black-style line splitting for long statements in function bodies and nested definition headers. The formatter changes add statement traversal and wrapping for simple statements and compound-clause headers. The updated line splitter handles expressions, returns, and header annotations. Tests compare builtin output with Black for long calls, conditions, loop and exception headers, match statements, and nested definitions. These changes cover the issue examples and add automated tests.

Full details: Out of Scope Changes check

Explanation

The documentation changes describe the formatter behavior. The generated expected-output changes show formatter reflow, and snapshot-reference updates consolidate expected files where outputs now match. The test changes cover supported and unsupported formatter constructs. The summary shows no unrelated production behavior change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 86.96% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 23 functions across 50 files. (142 skipped: 3 unsupported, 139 over the file limit.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0c1816b and 9b026dd.

Files ignored due to path filters: 16

  • docs/llms-full.txt is excluded by none and included by none
  • tests/data/expected/main/generation_platform/client/fields-shared-refs.txt is excluded by !tests/data/**/*.txt and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/check/models-in-package-stale.json is excluded by !tests/data/**/*.json and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/check/models-in-package-stale.txt is excluded by !tests/data/**/*.txt and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/check/stale.json is excluded by !tests/data/**/*.json and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/check/stale.txt is excluded by !tests/data/**/*.txt and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/configured.txt is excluded by !tests/data/**/*.txt and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/input-diff/changed.json is excluded by !tests/data/**/*.json and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/input-diff/changed.txt is excluded by !tests/data/**/*.txt and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/input-diff/form-baseline.json is excluded by !tests/data/**/*.json and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/input-diff/form-baseline.txt is excluded by !tests/data/**/*.txt and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/json/carriage-return-header.txt is excluded by !tests/data/**/*.txt and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/json/latin-1.txt is excluded by !tests/data/**/*.txt and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/json/models-in-package.txt is excluded by !tests/data/**/*.txt and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/json/modular.txt is excluded by !tests/data/**/*.txt and included by none
  • tests/data/expected/main/generation_platform/fastapi/cli/json/package-in-models.txt is excluded by !tests/data/**/*.txt and included by none
Files selected for processing: 202

  • docs/formatter-behavior.md
  • src/datamodel_code_generator/_builtin_formatter.py
  • src/datamodel_code_generator/_builtin_line_split.py
  • tests/data/expected/api_generation/fastapi_cli/check_outputs[json-package-in-models-services].2/server/application.py
  • tests/data/expected/api_generation/fastapi_cli/check_outputs[json-package-in-models].2/server/application.py
  • tests/data/expected/main/generation_platform/client/packages/asyncapi-events/pydantic_v2_BaseModel~client_render[asyncapi-events]/client/_async_client.py
  • tests/data/expected/main/generation_platform/client/packages/asyncapi-events/pydantic_v2_BaseModel~client_render[asyncapi-events]/client/_client.py
  • tests/data/expected/main/generation_platform/client/packages/asyncapi-events/pydantic_v2_BaseModel~client_render[asyncapi-events]/client/errors.py
  • tests/data/expected/main/generation_platform/client/packages/asyncapi-handshake-v2/pydantic_v2_BaseModel/client/_client.py
  • tests/data/expected/main/generation_platform/client/packages/asyncapi-handshake/msgspec_Struct/client/_client.py
  • tests/data/expected/main/generation_platform/client/packages/asyncapi-handshake/pydantic_v2_BaseModel/client/_client.py
  • tests/data/expected/main/generation_platform/client/packages/auth-context/pydantic_v2_BaseModel/client/_async_client.py
  • tests/data/expected/main/generation_platform/client/packages/auth-context/pydantic_v2_BaseModel/client/_client.py
  • tests/data/expected/main/generation_platform/client/packages/auth-context/pydantic_v2_BaseModel/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/auth-shared-wire/pydantic_v2_BaseModel/client/_client.py
  • tests/data/expected/main/generation_platform/client/packages/auth/pydantic_v2_BaseModel/client/_async_client.py
  • tests/data/expected/main/generation_platform/client/packages/auth/pydantic_v2_BaseModel/client/_client.py
  • tests/data/expected/main/generation_platform/client/packages/auth/pydantic_v2_BaseModel/client/resources/auth/_async.py
  • tests/data/expected/main/generation_platform/client/packages/binary-text/dataclasses_dataclass/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/binary-text/pydantic_v2_BaseModel/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/credential-name-errors/pydantic_v2_BaseModel/client/_client.py
  • tests/data/expected/main/generation_platform/client/packages/evolution/msgspec_Struct/client/resources/orders/_async.py
  • tests/data/expected/main/generation_platform/client/packages/fields-optional-models/pydantic_v2_BaseModel/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/fields-structural/dataclasses_dataclass/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/fields-unpack/pydantic_v2_BaseModel/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/fields-unpack/pydantic_v2_BaseModel/client/resources/default/_sync.py
  • tests/data/expected/main/generation_platform/client/packages/fields/pydantic_v2_BaseModel/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/media-errors/pydantic_v2_BaseModel/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/media/pydantic_v2_BaseModel/client/resources/documents/_async.py
  • tests/data/expected/main/generation_platform/client/packages/media/pydantic_v2_BaseModel/client/resources/files/_async.py
  • tests/data/expected/main/generation_platform/client/packages/media/pydantic_v2_BaseModel/client/resources/forms/_async.py
  • tests/data/expected/main/generation_platform/client/packages/names-unpack/pydantic_v2_BaseModel/client/resources/store/_async.py
  • tests/data/expected/main/generation_platform/client/packages/names-unpack/pydantic_v2_BaseModel/client/resources/store/_sync.py
  • tests/data/expected/main/generation_platform/client/packages/names/pydantic_v2_BaseModel/client/resources/admin/_async.py
  • tests/data/expected/main/generation_platform/client/packages/names/pydantic_v2_BaseModel/client/resources/admin/users/_async.py
  • tests/data/expected/main/generation_platform/client/packages/names/pydantic_v2_BaseModel/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/names/pydantic_v2_BaseModel/client/resources/store/_async.py
  • tests/data/expected/main/generation_platform/client/packages/names/pydantic_v2_BaseModel/client/resources/ユーザー/_async.py
  • tests/data/expected/main/generation_platform/client/packages/naming-snake/pydantic_v2_BaseModel/client/resources/item_store/_sync.py
  • tests/data/expected/main/generation_platform/client/packages/naming/pydantic_v2_BaseModel/client/resources/item_store/_sync.py
  • tests/data/expected/main/generation_platform/client/packages/pagination-querystring/pydantic_v2_BaseModel/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pagination/pydantic_v2_BaseModel/client/_async_client.py
  • tests/data/expected/main/generation_platform/client/packages/pagination/pydantic_v2_BaseModel/client/_client.py
  • tests/data/expected/main/generation_platform/client/packages/pagination/pydantic_v2_BaseModel/client/resources/archive/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pagination/pydantic_v2_BaseModel/client/resources/labels/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pagination/pydantic_v2_BaseModel/client/resources/loose/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pagination/pydantic_v2_BaseModel/client/resources/nested/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pagination/pydantic_v2_BaseModel/client/resources/secure/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pagination/pydantic_v2_BaseModel/client/resources/statuses/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pagination/pydantic_v2_BaseModel/client/resources/users/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pets-unpack/pydantic_v2_BaseModel/client/resources/pets/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pets-unpack/pydantic_v2_BaseModel/client/resources/pets/_sync.py
  • tests/data/expected/main/generation_platform/client/packages/pets-unpack/pydantic_v2_BaseModel/client/resources/pets/photos/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pets/pydantic_v2_BaseModel/client/resources/pets/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pets/pydantic_v2_BaseModel/client/resources/pets/photos/_async.py
  • tests/data/expected/main/generation_platform/client/packages/pets/pydantic_v2_BaseModel/client/types/pets/_operations.py
  • tests/data/expected/main/generation_platform/client/packages/retries/pydantic_v2_BaseModel/client/resources/retry/_async.py
  • tests/data/expected/main/generation_platform/client/packages/retry-headers/pydantic_v2_BaseModel/client/_async_client.py
  • tests/data/expected/main/generation_platform/client/packages/retry-headers/pydantic_v2_BaseModel/client/_client.py
  • tests/data/expected/main/generation_platform/client/packages/retry-headers/pydantic_v2_BaseModel/client/resources/headers/_async.py
  • tests/data/expected/main/generation_platform/client/packages/skip-operations-helper-disabled/pydantic_v2_BaseModel/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/skip-operations/pydantic_v2_BaseModel/client/resources/default/_async.py
  • tests/data/expected/main/generation_platform/client/packages/templates/pydantic_v2_BaseModel/client/types/pets/_operations.py
  • tests/data/expected/main/generation_platform/codecs/plan/directions-accepted/application.py
  • tests/data/expected/main/generation_platform/codecs/plan/oas30/application.py
  • tests/data/expected/main/generation_platform/codecs/plan/oas31/application.py
  • tests/data/expected/main/generation_platform/codecs/plan/oas32/application.py
  • tests/data/expected/main/generation_platform/codecs/plan/parameters/application.py
  • tests/data/expected/main/generation_platform/fastapi/cli/watch/pets.py
  • tests/data/expected/main/generation_platform/fastapi/packages/auth-parameters/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/binary-allowed/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/binary-allowed/pydantic_v2_BaseModel/server/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/packages/containers/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/containers/pydantic_v2_BaseModel/server/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/packages/docstrings/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/empty-body/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/native-merged-null/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/parameter-ref-loop-30/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/parameter-ref-loop-30/pydantic_v2_BaseModel/server/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/packages/pets/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/pets/pydantic_v2_BaseModel/server/routers/pets.py
  • tests/data/expected/main/generation_platform/fastapi/packages/pets/pydantic_v2_BaseModel~generate_server_without_output/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/pets/pydantic_v2_BaseModel~generate_server_without_output/server/routers/pets.py
  • tests/data/expected/main/generation_platform/fastapi/packages/pets~fastapi_render[pets]/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/pets~fastapi_render[pets]/pydantic_v2_BaseModel/server/routers/pets.py
  • tests/data/expected/main/generation_platform/fastapi/packages/pointer-references/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/querystring-nameless/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/querystring-nameless/pydantic_v2_BaseModel/server/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/packages/references/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/references/pydantic_v2_BaseModel/server/routes.py
  • tests/data/expected/main/generation_platform/fastapi/packages/response-keys/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/scheme-names/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/scheme-names/pydantic_v2_BaseModel/server/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/packages/security-roles/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/security-roles/pydantic_v2_BaseModel/server/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/packages/serialize-as-any-aliases/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/serialize-as-any-aliases/pydantic_v2_BaseModel/server/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/packages/templates/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/packages/templates/pydantic_v2_BaseModel/server/routers/pets.py
  • tests/data/expected/main/generation_platform/fastapi/packages/version-per-document/pydantic_v2_BaseModel/server/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/defaults/pydantic_v2_BaseModel/defaults_basemodel/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/defaults/pydantic_v2_BaseModel/defaults_basemodel/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/locals/pydantic_v2_BaseModel/locals_basemodel/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/locals/pydantic_v2_BaseModel/locals_basemodel/routers/security.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/locals/pydantic_v2_BaseModel/locals_basemodel/routers/wiring.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/nullable-results/pydantic_v2_BaseModel/nullable_results_basemodel/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/nullable-results/pydantic_v2_BaseModel/nullable_results_basemodel/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/nullable/pydantic_v2_BaseModel/nullable_basemodel/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/nullable/pydantic_v2_BaseModel/nullable_basemodel/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/parameters/pydantic_v2_BaseModel/parameters_basemodel/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/parameters/pydantic_v2_BaseModel/parameters_basemodel/routers/default.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/pets/pydantic_v2_BaseModel/pets_basemodel/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/pets/pydantic_v2_BaseModel/pets_basemodel/routers/pets.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/pets/pydantic_v2_dataclass/pets_dataclass/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/pets/pydantic_v2_dataclass/pets_dataclass/routers/pets.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/spellings-exact/pydantic_v2_BaseModel/spellings_exact_basemodel/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/spellings-exact/pydantic_v2_BaseModel/spellings_exact_basemodel/routers/days.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/spellings-exact/pydantic_v2_BaseModel/spellings_exact_basemodel/routers/fields.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/spellings-exact/pydantic_v2_BaseModel/spellings_exact_basemodel/routers/pets.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/spellings/pydantic_v2_BaseModel/spellings_basemodel/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/spellings/pydantic_v2_BaseModel/spellings_basemodel/routers/days.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/spellings/pydantic_v2_BaseModel/spellings_basemodel/routers/fields.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/spellings/pydantic_v2_BaseModel/spellings_basemodel/routers/pets.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/strict/pydantic_v2_BaseModel/strict_basemodel/application.py
  • tests/data/expected/main/generation_platform/fastapi/servers/packages/strict/pydantic_v2_BaseModel/strict_basemodel/routers/default.py
  • tests/data/expected/main/generation_platform/generate/line-length/application.py
  • tests/data/expected/main/input_model/inherited_overrides/ClassVarAliasChild_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/RepeatedChild_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/RepeatedGrandChild_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/RepeatedPairChild_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/SharedAliasChild_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/UniqueChild_builtin.py
  • tests/data/expected/main/jsonschema/builtin_boolean_wrapping/guards_120.py
  • tests/data/expected/main/jsonschema/builtin_boolean_wrapping/guards_88.py
  • tests/data/expected/main/jsonschema/inline_allof_validators/core_builtin.py
  • tests/data/expected/main/jsonschema/jsonschema_allof_array_enum_items_in_sets.py
  • tests/data/expected/main/jsonschema/main_jsonschema/module_import_named_like_builtin_package[pydantic-v2-schema-validators]/app/__init__.py
  • tests/data/expected/main/jsonschema/main_jsonschema/prefix_items_unique_items[schema-validators-default].py
  • tests/data/expected/main/jsonschema/main_jsonschema/prefix_items_unique_items[schema-validators].py
  • tests/data/expected/main/jsonschema/main_jsonschema/schema_validators_with_the_builtin_template_directory_by_another_path.py
  • tests/data/expected/main/jsonschema/main_jsonschema/unique_items_root_alias_preserves_validation[--use-root-model-type-alias].py
  • tests/data/expected/main/jsonschema/main_jsonschema/unique_items_root_alias_preserves_validation[--use-type-alias].py
  • tests/data/expected/main/jsonschema/mapping_alias_module_split/first.py
  • tests/data/expected/main/jsonschema/mapping_alias_module_split/second.py
  • tests/data/expected/main/jsonschema/mapping_schema_validators_builtin.py
  • tests/data/expected/main/jsonschema/object_maps/schema_validators[pattern_checks].py
  • tests/data/expected/main/jsonschema/object_maps/schema_validators[pattern_value_constraints].py
  • tests/data/expected/main/jsonschema/object_maps/schema_validators_target_pydantic_version[type_aliases].py
  • tests/data/expected/main/jsonschema/object_maps/schema_validators_without_single_dict[pattern_checks].py
  • tests/data/expected/main/jsonschema/object_maps/schema_validators_without_single_dict[pattern_value_constraints].py
  • tests/data/expected/main/jsonschema/pydantic_accepted_forms/verbose_pattern_properties_select_the_python_engine_alike.py
  • tests/data/expected/main/jsonschema/schema_validators_presence/schema_validators_conditional_presence.py
  • tests/data/expected/main/jsonschema/schema_validators_presence/schema_validators_conditional_presence_empty_schema.py
  • tests/data/expected/main/jsonschema/schema_validators_presence/schema_validators_not_mixed_rules.py
  • tests/data/expected/main/jsonschema/schema_validators_presence/schema_validators_presence_allof.py
  • tests/data/expected/main/jsonschema/schema_validators_presence/schema_validators_presence_else.py
  • tests/data/expected/main/jsonschema/schema_validators_presence/schema_validators_presence_metadata.py
  • tests/data/expected/main/jsonschema/schema_validators_presence/schema_validators_presence_mixed_const.py
  • tests/data/expected/main/jsonschema/schema_validators_presence/schema_validators_presence_true.py
  • tests/data/expected/main/jsonschema/schema_validators_presence/schema_validators_typed_enum.py
  • tests/data/expected/main/jsonschema/schema_validators_property_count_cross_module/external_core_conditional_child.py
  • tests/data/expected/main/jsonschema/schema_validators_property_count_cross_module/external_core_pattern_child.py
  • tests/data/expected/main/jsonschema/schema_validators_property_count_cross_module/external_core_required_child.py
  • tests/data/expected/main/jsonschema/schema_validators_property_count_cross_module/external_core_unique_child.py
  • tests/data/expected/main/jsonschema/schema_validators_property_count_cross_module/external_core_unique_parent.py
  • tests/data/expected/main/jsonschema/schema_validators_runtime_root_cross_module/a.py
  • tests/data/expected/main/jsonschema/string_literal_text/regex_surrogate_engine_of_schema_validator_adapters.py
  • tests/data/expected/main/jsonschema/unique_items_additional_aliases.py
  • tests/data/expected/main/jsonschema/unique_items_additional_aliases_serialization.py
  • tests/data/expected/main/jsonschema/unique_items_allof_mapping.py
  • tests/data/expected/main/jsonschema/unique_items_allof_mapping/main_jsonschema_unique_items_allof_mapping_type_alias.py
  • tests/data/expected/main/jsonschema/unique_items_const_draft6.py
  • tests/data/expected/main/jsonschema/unique_items_draft7_additional_items.py
  • tests/data/expected/main/jsonschema/unique_items_frozen_set/main_jsonschema_unique_items_frozen_set.py
  • tests/data/expected/main/jsonschema/unique_items_generic_container_mapping.py
  • tests/data/expected/main/jsonschema/unique_items_inline_paths.py
  • tests/data/expected/main/jsonschema/unique_items_mapping_collision.py
  • tests/data/expected/main/jsonschema/unique_items_prefix_items_2020.py
  • tests/data/expected/main/jsonschema/unique_items_prefix_items_draft7.py
  • tests/data/expected/main/jsonschema/unique_items_property_alias.py
  • tests/data/expected/main/jsonschema/unique_items_property_alias_population.py
  • tests/data/expected/main/jsonschema/unique_items_property_alias_serialization.py
  • tests/data/expected/main/jsonschema/unique_items_property_alias_serialization_alias_generator.py
  • tests/data/expected/main/jsonschema/unique_items_schema_validators.py
  • tests/data/expected/main/jsonschema/unique_items_union_const_root.py
  • tests/data/expected/main/jsonschema/unique_items_union_enum_root.py
  • tests/data/expected/main/jsonschema/unique_items_union_mapping_shapes.py
  • tests/data/expected/main/jsonschema/unique_items_union_mapping_shapes/main_jsonschema_unique_items_union_ref_mapping_root_type_alias[collapse-root-models].py
  • tests/data/expected/main/jsonschema/unique_items_union_mapping_shapes/main_jsonschema_unique_items_union_ref_mapping_root_type_alias[type-alias-type].py
  • tests/data/expected/main/jsonschema/unique_items_union_ref_mapping.py
  • tests/data/expected/main/jsonschema/unique_items_union_ref_mapping_root.py
  • tests/data/expected/main/jsonschema/unique_items_union_ref_sibling_2020.py
  • tests/data/expected/main/jsonschema/unique_items_variant_additional.py
  • tests/data/expected/main/jsonschema/unique_items_variant_ownership.py
  • tests/data/expected/main/jsonschema/unique_items_variant_root_alias_use_root_model_type_alias.py
  • tests/data/expected/main/jsonschema/unique_items_variant_root_alias_use_type_alias.py
  • tests/data/expected/main/jsonschema/unknown_pattern_annotations/custom_model.py
  • tests/data/expected/main/jsonschema/unknown_pattern_annotations/custom_parser.py
  • tests/data/expected/main/openapi/main_openapi/read_schema_version_per_document[per-document].py
  • tests/main/jsonschema/test_main_jsonschema.refs
  • tests/test_format.py
  • tests/test_input_model.refs
Files with no reviewable changes: 10

  • tests/data/expected/main/jsonschema/inline_allof_validators/core_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/RepeatedGrandChild_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/SharedAliasChild_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/RepeatedChild_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/UniqueChild_builtin.py
  • tests/data/expected/main/generation_platform/client/packages/pets/pydantic_v2_BaseModel/client/types/pets/_operations.py
  • tests/data/expected/main/jsonschema/mapping_schema_validators_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/ClassVarAliasChild_builtin.py
  • tests/data/expected/main/input_model/inherited_overrides/RepeatedPairChild_builtin.py
  • tests/data/expected/main/generation_platform/client/packages/templates/pydantic_v2_BaseModel/client/types/pets/_operations.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@koxudaxi
Koudai Aono (koxudaxi) marked this pull request as ready for review November 10, 2026 02:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T02:51:22.110682Z 9b026dd Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b026dd003

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

@github-actions

Copy link
Copy Markdown
Contributor

@codspeed

codspeed Bot commented Nov 10, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 50.53%

2 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 53 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

❌ 53 regressed benchmarks
⏩ 98 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_perf_client_calls[sync] 18.4 ms 44.5 ms -58.74%
❌ test_perf_client_calls[async] 20.5 ms 48.8 ms -58%
❌ test_perf_load_pyproject_config[mapping-multiple] 111.6 µs 264.5 µs -57.79%
❌ test_perf_target_render[client-large] 8.7 s 20.1 s -56.68%
❌ test_perf_load_pyproject_config[config-multiple] 113.6 µs 260.6 µs -56.39%
❌ test_perf_load_pyproject_config[config-None] 106.4 µs 241.5 µs -55.94%
❌ test_perf_load_pyproject_config[mapping-None] 106.3 µs 240 µs -55.7%
❌ test_perf_simple_msgspec_unset_field_rendering 275.3 ms 603.9 ms -54.42%
❌ test_perf_large_models_pydantic_v2 2 s 4.2 s -53.72%
❌ test_perf_pydantic_field_name_resolution 1.2 ms 2.7 ms -53.7%
❌ test_perf_duplicate_names 566.4 ms 1,220.8 ms -53.6%
❌ test_perf_mapped_reference_users 453.5 ms 971.5 ms -53.32%
❌ test_perf_unique_items_runtime_scalar_validation 1.5 ms 3.1 ms -53.32%
❌ test_perf_target_render[fastapi-small] 17.9 ms 37.9 ms -52.84%
❌ test_perf_target_render[fastapi-large] 5.4 s 11.4 s -52.8%
❌ test_perf_kubernetes_style_pydantic_v2 1.5 s 3.1 s -52.68%
❌ test_perf_scalar_root_collapsed_builtin 112.8 ms 236.9 ms -52.38%
❌ test_perf_unique_items_nested_model_validation 1.5 ms 3.2 ms -52.13%
❌ test_perf_complex_refs 1.2 s 2.6 s -52%
❌ test_perf_all_options_enabled 3.4 s 7.1 s -51.97%
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing bfmt-5 (9b026dd) with bfmt-4 (0c1816b)

Open in CodSpeed

Footnotes

  1. 98 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@github-actions

Copy link
Copy Markdown
Contributor

🎉 Released in 0.93.0

This PR is now available in the latest release. See the release notes for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Builtin formatter leaves long statements in function bodies on one line

1 participant