Skip to content

Refactor functions with #[allow(clippy::too_many_lines)] that have distinct sub-problems #1406

@milkyskies

Description

@milkyskies

These functions got #[allow(clippy::too_many_lines)] or #[allow(clippy::cognitive_complexity)] in #1405 but are genuinely refactorable — they have orthogonal sub-problems or distinct phases, not just a single large enum match.

Functions to refactor

Function File Why
generate_probe interop/tsgo/probe_gen.rs:97 754 lines — 4 distinct phases: import collection, type decl emission, const probes, call probes
check_all checker.rs:696 Sequential registration passes (imports, types, JSX hints, items) each self-contained
Checker::new checker.rs:319 15+ field inits + global registry setup could be extracted
check_call checker/expr.rs:848 stdlib arg checking, unify loop, and trait dispatch are separate concerns
check_construct checker/expr.rs:1513 Field collection, validation, required-field check, spread handling — 4 concerns
check_pipe_right checker/expr.rs:1959 stdlib / for-block / trait / fallback dispatch branches
resolve_member_type checker/expr.rs:2721 Narrowing, tuple, record, foreign — separate lookup paths
check_import checker/imports.rs:9 Default import, specifier loop, trait import are independent
check_function checker/items.rs:481 Param validation, return type wrapping, scope setup
check_trait_impl checker/traits.rs:122 self/param count/signature/return — 4 orthogonal checks
register_type_decl checker/type_registration.rs:7 Naming, field population, spread flattening
resolve_from_source resolve.rs:463 Transitive imports, type map, for-block exports, flattening — 4 passes
emit_mock_for_type codegen/typescript/parse_mock.rs:167 Repeated mock gen patterns extractable
emit_mock_for_typedef codegen/typescript/parse_mock.rs:278 Union variant + record entry handling
emit_pipe codegen/typescript/pipes.rs:160 stdlib / trait / for-block / normal dispatch
emit_import codegen/typescript/statement.rs:36 Default + specifier loop extractable
handle_completion floe-lsp/completions.rs:32 Independent context-detection branches
handle_hover floe-lsp/hover.rs:13 Pipe / symbol / member / type-map branches
collect_items floe-lsp/index.rs:134 Import / const / fn / type / for-block collection
lower_template_literal lower.rs:108 Escape handling, brace tracking, string parsing
enhance_object_destructure_probes interop/tsgo.rs:427 Import mapping, collection, enhancement — 3 passes
cmd_test floe-cli/main.rs:364 File discovery, detection, typecheck, codegen, execution phases

Goal

After each refactor, remove the #[allow] attribute. The lint stays — only the suppression goes away.

Tests

  • cargo clippy --workspace must pass with zero errors after removing the allows
  • cargo test --workspace must pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions