Public report of pola-rs/polars, published 14 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 14 November 2026, 05:28 UTC · Survey ID cd_a3415d2bdcbf4169bb37453e1fc0030e

pola-rs/polars

Measured 14 November 2026, 05:26 UTC, at code version 5c36cdd

CAI score 66out of 100 Adequate
CriticalWeakAdequateStrongExemplary
No change since the last survey

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A very large codebase: 625,739 lines of product code in 43 projects, tests not counted · Estimated rebuild effort: about 7.2 person-years · Weakest lens: Performance, 60

Findings by how serious they are

187 critical 3776 serious 162 minor

26 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 05:26 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that implements it, and today the Canine Code Analyzer is the only one that does.

The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

47of 47 dimensions measured by tools.
4071of 4125 findings point to an exact file and line, so you can open each one in the code. The other 54 concern the repository as a whole, such as missing documentation.
47dimensions across 7 lenses, read from 625,739 lines of product code in 43 projects.
Chapters

Executive summary

pola-rs/polars falls short of our standard for production, held back most by its Performance lens, the way the code guards its speed and its use of resources. It scores 66 out of 100 and is rated Adequate, and 154 of its 187 critical findings are security problems.

Performance, at 60, is the weakest lens and counts most in the score. The best first step is removing the blocking calls, worth about 6 points. Recording design decisions comes next, worth about 2 points. Raising Performance to 70 would lift the score to about 70.

119 pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Thirteen pipeline steps install packages that can change without warning, and thirty-two sets of files in separate parts keep changing together, which points to hidden dependencies. Pinning each tool to an exact version, pinning what the pipeline installs and making the hidden dependencies explicit would close these risks. Limiting each secret to its own step would fix the seven secrets exposed to more of the pipeline than needed, and the seven pipeline steps that run downloads without checking them need each download checked against a known checksum first. The part of the code nobody has worked on for a long time needs someone to learn and document it before anyone changes it.

The product code is 625,739 lines, about €1,000,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Performance 60 · counts for 46%Maturity 68 · counts for 25%Security and Compliance 70 · counts for 14%Production Readiness 72 · counts for 8%Code Health 81 · counts for 4%Architecture 93 · counts for 2%Event Sourcing 100 · counts for 1%

If Performance rose from 60 to 70, the lowest score rated Strong, the score would rise from 66 to about 70.

Code composition: what the lines of code are
Product code 72%Tests 28%
New since the last survey: 1212 findings

These 1212 critical or serious findings weren't in the previous survey, on 26 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec_inner (cyclomatic 70) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs
  • Cyclomatic Complexity · AExpr::to_field_impl_inner (cyclomatic 65) crates/polars-plan/src/plans/aexpr/schema.rs
  • Cyclomatic Complexity · SelectionWalker::walk_rec (cyclomatic 58) crates/polars-plan/src/plans/optimizer/projection_pushdown/field_pruning.rs
  • Cyclomatic Complexity · polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl_inner (cyclomatic 58) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_to_ir.rs
  • Cyclomatic Complexity · polars_sql::subquery_pull_up::try_move (cyclomatic 58) crates/polars-sql/src/subquery_pull_up.rs
  • Cyclomatic Complexity · SQLContext::group_by_in_derived_table (cyclomatic 47) crates/polars-sql/src/subquery_group_by.rs
  • Cyclomatic Complexity · polars_sql::sql_expr::parse_extract_date_part (cyclomatic 46) crates/polars-sql/src/sql_expr.rs
  • Cyclomatic Complexity · SQLContext::lateral_join (cyclomatic 42) crates/polars-sql/src/lateral.rs
  • Cyclomatic Complexity · polars_plan::plans::python::pyarrow::to_pa (cyclomatic 40) crates/polars-plan/src/plans/python/pyarrow.rs
  • Cyclomatic Complexity · EquiJoinNode::update_state (cyclomatic 34) crates/polars-stream/src/nodes/joins/equi_join/mod.rs
  • Cyclomatic Complexity · _partition_evolution.spec_change (cyclomatic 33) py-polars/src/polars/io/iceberg/_partition_evolution.py
  • Cyclomatic Complexity · context._alter_catalog_table (cyclomatic 32) py-polars/src/polars/sql/context.py
  • Cyclomatic Complexity · polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by_with_key_ranges (cyclomatic 31) crates/polars-stream/src/physical_plan/lower_group_by.rs
  • Cyclomatic Complexity · DeltaSinkState._commit (cyclomatic 31) py-polars/src/polars/io/delta/_sink.py
  • Cyclomatic Complexity · SampleState::try_transition_to_build (cyclomatic 29) crates/polars-stream/src/nodes/joins/equi_join/mod.rs
  • Cyclomatic Complexity · SQLContext::join_inputs (cyclomatic 28) REDACTED
  • Cyclomatic Complexity · polars_plan::plans::python::pyarrow::aexpr_to_pyarrow_impl (cyclomatic 27) crates/polars-plan/src/plans/python/pyarrow.rs
  • Cyclomatic Complexity · SQLContext::try_decorrelate_in_subquery (cyclomatic 27) crates/polars-sql/src/subquery.rs
  • Cyclomatic Complexity · polars_sql::subquery_pull_up::prepare (cyclomatic 27) crates/polars-sql/src/subquery_pull_up.rs
  • Cyclomatic Complexity · SinkState::spawn (cyclomatic 27) crates/polars-stream/src/nodes/group_by/sink.rs
  • Cyclomatic Complexity · Shared::run (cyclomatic 27) crates/polars-stream/src/nodes/joins/equi_join/flush.rs
  • Cyclomatic Complexity · polars_plan::plans::stats::value_range::column_value_range (cyclomatic 26) crates/polars-plan/src/plans/stats/value_range.rs
  • Cyclomatic Complexity · ProbePartitions::partition_and_probe (cyclomatic 26) crates/polars-stream/src/nodes/joins/equi_join/probe.rs
  • Cyclomatic Complexity · LeafRows::collect_run (cyclomatic 24) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs
  • Cyclomatic Complexity · PipelineBudget::acquire (cyclomatic 23) crates/polars-stream/src/nodes/io_sources/shared/pipeline_budget.rs
  • Cyclomatic Complexity · polars_plan::plans::optimizer::simplify_expr::arity::simplify_year_comparison (cyclomatic 21) crates/polars-plan/src/plans/optimizer/simplify_expr/arity.rs
  • Cyclomatic Complexity · polars_plan::plans::optimizer::aggregate_from_statistics::aggregate_from_statistics (cyclomatic 20) crates/polars-plan/src/plans/optimizer/aggregate_from_statistics.rs
  • Cyclomatic Complexity · polars_plan::plans::optimizer::predicate_pushdown::join::predicate_pruning::try_rewrite_outer_equi_join (cyclomatic 20) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs
  • Cyclomatic Complexity · PySQLContext::catalog_statement (cyclomatic 20) crates/polars-python/src/sql.rs
  • Cyclomatic Complexity · _partition_evolution._validate (cyclomatic 20) py-polars/src/polars/io/iceberg/_partition_evolution.py
  • Cyclomatic Complexity · polars_plan::plans::optimizer::window_top_one::find_window (cyclomatic 19) crates/polars-plan/src/plans/optimizer/window_top_one.rs
  • Cyclomatic Complexity · SQLExprVisitor::visit_like (cyclomatic 19) crates/polars-sql/src/sql_expr.rs
  • Cyclomatic Complexity · polars_sql::catalog::hint_unsupported_part (cyclomatic 19) crates/polars-sql/src/catalog.rs
  • Cyclomatic Complexity · polars_sql::join_keys::sql_join_key_pair (cyclomatic 19) crates/polars-sql/src/join_keys.rs
  • Cyclomatic Complexity · context._insert_catalog_table (cyclomatic 19) py-polars/src/polars/sql/context.py
  • Cyclomatic Complexity · context._assignable (cyclomatic 19) py-polars/src/polars/sql/context.py
  • Cyclomatic Complexity · KneeController::step (cyclomatic 18) crates/polars-io/src/cloud/concurrency/knee.rs
  • Cyclomatic Complexity · LineIndexer::index_lines (cyclomatic 18) crates/polars-io/src/csv/read/field_index.rs
  • Cyclomatic Complexity · polars_plan::plans::optimizer::join_pushthrough::pushdown_candidate (cyclomatic 18) crates/polars-plan/src/plans/optimizer/join_pushthrough.rs
  • Cyclomatic Complexity · polars_plan::plans::optimizer::projection_pushdown::field_pruning::recompute_schema (cyclomatic 18) crates/polars-plan/src/plans/optimizer/projection_pushdown/field_pruning.rs
  • Cyclomatic Complexity · SQLContext::merge_plan (cyclomatic 18) REDACTED
  • Cyclomatic Complexity · SQLContext::rewrite_exists (cyclomatic 18) crates/polars-sql/src/subquery.rs
  • Cyclomatic Complexity · SQLContext::outer_select_item (cyclomatic 18) crates/polars-sql/src/subquery_outer_select.rs
  • Cyclomatic Complexity · polars_sql::context::merge_source_columns (cyclomatic 18) REDACTED
  • Cyclomatic Complexity · _partition_evolution.partition_source (cyclomatic 18) py-polars/src/polars/io/iceberg/_partition_evolution.py
  • Cyclomatic Complexity · polars_compute::horizontal_concat_list::horizontal_concat_list_unchecked (cyclomatic 17) crates/polars-compute/src/horizontal_concat_list/mod.rs
  • Cyclomatic Complexity · polars_core::chunked_array::ops::search_sorted::search_sorted_slice (cyclomatic 17) crates/polars-core/src/chunked_array/ops/search_sorted.rs
  • Cyclomatic Complexity · Ramp::round (cyclomatic 17) crates/polars-io/src/cloud/concurrency/knee.rs
  • Cyclomatic Complexity · polars_plan::plans::optimizer::aggregate_from_statistics::statistic_values (cyclomatic 17) crates/polars-plan/src/plans/optimizer/aggregate_from_statistics.rs
  • Cyclomatic Complexity · polars_sql::catalog::partition_field (cyclomatic 17) crates/polars-sql/src/catalog.rs
  • Cyclomatic Complexity · ProjectionBuilder::build_projection (cyclomatic 17) crates/polars-stream/src/nodes/io_sources/multi_scan/components/projection/builder.rs
  • Cyclomatic Complexity · DataFrame.write_delta (cyclomatic 17) py-polars/src/polars/dataframe/frame.py
  • Cyclomatic Complexity · DeltaSinkState._attach_resolved_sink (cyclomatic 17) py-polars/src/polars/io/delta/_sink.py
  • Cyclomatic Complexity · _sink._check_writable (cyclomatic 17) py-polars/src/polars/io/delta/_sink.py
  • Cyclomatic Complexity · LazyFrame.sink_delta (cyclomatic 17) py-polars/src/polars/lazyframe/frame.py
  • Cyclomatic Complexity · polars_python::io::delta_stats::has_min_max (cyclomatic 16) crates/polars-python/src/io/delta_stats.rs
  • Cyclomatic Complexity · FlushState::new (cyclomatic 16) crates/polars-stream/src/nodes/joins/equi_join/flush.rs
  • Cyclomatic Complexity · _sink._delta_dtype (cyclomatic 16) py-polars/src/polars/io/delta/_sink.py
  • Cognitive Complexity · ProbePartitions::partition_and_probe (cognitive 87) crates/polars-stream/src/nodes/joins/equi_join/probe.rs
  • Cognitive Complexity · SinkState::spawn (cognitive 86) crates/polars-stream/src/nodes/group_by/sink.rs
  • Cognitive Complexity · SelectionWalker::walk_rec (cognitive 83) crates/polars-plan/src/plans/optimizer/projection_pushdown/field_pruning.rs
  • Cognitive Complexity · polars_sql::subquery_pull_up::try_move (cognitive 79) crates/polars-sql/src/subquery_pull_up.rs
  • Cognitive Complexity · polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec_inner (cognitive 66) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs
  • Cognitive Complexity · SQLContext::group_by_in_derived_table (cognitive 63) crates/polars-sql/src/subquery_group_by.rs
  • Cognitive Complexity · Shared::run (cognitive 61) crates/polars-stream/src/nodes/joins/equi_join/flush.rs
  • Cognitive Complexity · EquiJoinNode::update_state (cognitive 57) crates/polars-stream/src/nodes/joins/equi_join/mod.rs
  • Cognitive Complexity · AExpr::to_field_impl_inner (cognitive 56) crates/polars-plan/src/plans/aexpr/schema.rs
  • Cognitive Complexity · polars_plan::plans::optimizer::window_top_one::find_window (cognitive 50) crates/polars-plan/src/plans/optimizer/window_top_one.rs
  • Cognitive Complexity · polars_plan::plans::python::pyarrow::to_pa (cognitive 49) crates/polars-plan/src/plans/python/pyarrow.rs
  • Cognitive Complexity · DeltaSinkState._commit (cognitive 49) py-polars/src/polars/io/delta/_sink.py
  • Cognitive Complexity · _partition_evolution.spec_change (cognitive 49) py-polars/src/polars/io/iceberg/_partition_evolution.py
  • Cognitive Complexity · polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by_with_key_ranges (cognitive 48) crates/polars-stream/src/physical_plan/lower_group_by.rs
  • Cognitive Complexity · SQLContext::join_inputs (cognitive 46) REDACTED
  • Cognitive Complexity · LineIndexer::index_lines (cognitive 45) crates/polars-io/src/csv/read/field_index.rs
  • Cognitive Complexity · SQLContext::lateral_join (cognitive 45) crates/polars-sql/src/lateral.rs
  • Cognitive Complexity · SampleState::try_transition_to_build (cognitive 45) crates/polars-stream/src/nodes/joins/equi_join/mod.rs
  • Cognitive Complexity · polars_sql::subquery_pull_up::prepare (cognitive 38) crates/polars-sql/src/subquery_pull_up.rs
  • Cognitive Complexity · _partition_evolution._validate (cognitive 38) py-polars/src/polars/io/iceberg/_partition_evolution.py
  • Cognitive Complexity · context._alter_catalog_table (cognitive 38) py-polars/src/polars/sql/context.py
  • Cognitive Complexity · polars_plan::plans::optimizer::aggregate_from_statistics::aggregate_from_statistics (cognitive 35) crates/polars-plan/src/plans/optimizer/aggregate_from_statistics.rs
  • Cognitive Complexity · LeafRows::collect_run (cognitive 34) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs
  • Cognitive Complexity · polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl_inner (cognitive 34) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_to_ir.rs
  • Cognitive Complexity · polars_plan::plans::stats::value_range::column_value_range (cognitive 34) crates/polars-plan/src/plans/stats/value_range.rs
  • Cognitive Complexity · SQLContext::try_decorrelate_in_subquery (cognitive 32) crates/polars-sql/src/subquery.rs
  • Cognitive Complexity · PipelineBudget::acquire (cognitive 31) crates/polars-stream/src/nodes/io_sources/shared/pipeline_budget.rs
  • Cognitive Complexity · SQLContext::rewrite_exists (cognitive 30) crates/polars-sql/src/subquery.rs
  • Cognitive Complexity · polars_plan::plans::optimizer::predicate_pushdown::join::predicate_pruning::try_rewrite_outer_equi_join (cognitive 29) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs
  • Cognitive Complexity · polars_plan::plans::python::pyarrow::aexpr_to_pyarrow_impl (cognitive 29) crates/polars-plan/src/plans/python/pyarrow.rs
  • Cognitive Complexity · polars_sql::context::merge_source_columns (cognitive 29) REDACTED
  • Cognitive Complexity · DeltaSinkState._add_actions (cognitive 29) py-polars/src/polars/io/delta/_sink.py
  • Cognitive Complexity · SQLContext::merge_plan (cognitive 27) REDACTED
  • Cognitive Complexity · _partition_evolution.partition_source (cognitive 27) py-polars/src/polars/io/iceberg/_partition_evolution.py
  • Cognitive Complexity · IcebergSinkState._commit_create (cognitive 26) py-polars/src/polars/io/iceberg/_sink.py
  • Cognitive Complexity · polars_parquet::arrow::read::deserialize::nested_utils::collect_value (cognitive 25) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs
  • Cognitive Complexity · SelectionWalker::walk_as_struct (cognitive 25) crates/polars-plan/src/plans/optimizer/projection_pushdown/field_pruning.rs
  • Cognitive Complexity · polars_sql::time_travel::extract_table_versions (cognitive 25) crates/polars-sql/src/time_travel.rs
  • Cognitive Complexity · polars_stream::nodes::io_sources::parquet::projection::resolve_arrow_field_projections (cognitive 25) crates/polars-stream/src/nodes/io_sources/parquet/projection.rs
  • Cognitive Complexity · _sink._check_writable (cognitive 25) py-polars/src/polars/io/delta/_sink.py
  • Cognitive Complexity · _sink._added_conflicting_deletes (cognitive 25) py-polars/src/polars/io/iceberg/_sink.py
  • Cognitive Complexity · polars_core::chunked_array::ops::search_sorted::search_sorted_slice (cognitive 24) crates/polars-core/src/chunked_array/ops/search_sorted.rs

We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 376 findings

These 376 critical or serious findings were in the previous survey, on 26 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec (cyclomatic 70) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs
  • Cyclomatic Complexity · AExpr::to_field_impl (cyclomatic 65) crates/polars-plan/src/plans/aexpr/schema.rs
  • Cyclomatic Complexity · polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl (cyclomatic 58) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_to_ir.rs
  • Cyclomatic Complexity · polars_plan::plans::python::pyarrow::predicate_to_pa (cyclomatic 40) crates/polars-plan/src/plans/python/pyarrow.rs
  • Cyclomatic Complexity · EquiJoinNode::update_state (cyclomatic 33) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Cyclomatic Complexity · polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by (cyclomatic 31) crates/polars-stream/src/physical_plan/lower_group_by.rs
  • Cyclomatic Complexity · polars_parquet::arrow::read::deserialize::nested_utils::decode_nested (cyclomatic 29) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs
  • Cyclomatic Complexity · SampleState::try_transition_to_build (cyclomatic 28) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Cyclomatic Complexity · ProbeState::partition_and_probe (cyclomatic 27) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Cyclomatic Complexity · polars_plan::plans::python::pyarrow::aexpr_to_pyarrow (cyclomatic 24) crates/polars-plan/src/plans/python/pyarrow.rs
  • Cyclomatic Complexity · GroupBySink::spawn (cyclomatic 23) crates/polars-stream/src/nodes/group_by/sink.rs
  • Cyclomatic Complexity · AdaptiveRateController::settle_lazy_tick (cyclomatic 18) crates/polars-io/src/cloud/http_rate_limit.rs
  • Cyclomatic Complexity · ListNameSpaceImpl::lst_concat (cyclomatic 18) crates/polars-ops/src/chunked_array/list/namespace.rs
  • Cyclomatic Complexity · polars_ops::series::ops::strings::str_format (cyclomatic 17) crates/polars-ops/src/series/ops/strings.rs
  • Cyclomatic Complexity · polars_ops::frame::join::merge_join::match_keys_impl (cyclomatic 16) crates/polars-ops/src/frame/join/merge_join.rs
  • Cognitive Complexity · ProbeState::partition_and_probe (cognitive 96) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Cognitive Complexity · GroupBySink::spawn (cognitive 70) crates/polars-stream/src/nodes/group_by/sink.rs
  • Cognitive Complexity · polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec (cognitive 66) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs
  • Cognitive Complexity · EquiJoinNode::update_state (cognitive 60) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Cognitive Complexity · AExpr::to_field_impl (cognitive 56) crates/polars-plan/src/plans/aexpr/schema.rs
  • Cognitive Complexity · polars_plan::plans::python::pyarrow::predicate_to_pa (cognitive 49) crates/polars-plan/src/plans/python/pyarrow.rs
  • Cognitive Complexity · polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by (cognitive 48) crates/polars-stream/src/physical_plan/lower_group_by.rs
  • Cognitive Complexity · ListNameSpaceImpl::lst_concat (cognitive 40) crates/polars-ops/src/chunked_array/list/namespace.rs
  • Cognitive Complexity · SampleState::try_transition_to_build (cognitive 36) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Cognitive Complexity · polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl (cognitive 34) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_to_ir.rs
  • Cognitive Complexity · Duration::add_inline (cognitive 25) crates/polars-defs/src/time/duration.rs
  • Cognitive Complexity · polars_plan::plans::python::pyarrow::aexpr_to_pyarrow (cognitive 25) crates/polars-plan/src/plans/python/pyarrow.rs
  • Cognitive Complexity · polars_plan::plans::aexpr::schema::get_arithmetic_field (cognitive 24) crates/polars-plan/src/plans/aexpr/schema.rs
  • Cognitive Complexity · SQLContext::execute_delete_from_table (cognitive 22) REDACTED
  • Cognitive Complexity · polars_stream::nodes::joins::equi_join::compute_payload_selector (cognitive 22) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Cognitive Complexity · BuildState::finalize_unordered (cognitive 20) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Cognitive Complexity · HashKeys::from_df (cognitive 18) crates/polars-expr/src/hash_keys.rs
  • Cognitive Complexity · polars_ops::chunked_array::hist::compute_hist (cognitive 18) crates/polars-ops/src/chunked_array/hist.rs
  • Cognitive Complexity · BuildState::finalize_ordered (cognitive 18) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Cognitive Complexity · ChunkedArray::agg_var (cognitive 17) crates/polars-core/src/frame/group_by/aggregations/mod.rs
  • Cognitive Complexity · ChunkedArray::agg_std (cognitive 17) crates/polars-core/src/frame/group_by/aggregations/mod.rs
  • Cognitive Complexity · Flush::next_step (cognitive 17) crates/polars-stream/src/nodes/sort/flush.rs
  • Cognitive Complexity · BinViewDecoder::extend_filtered_with_state (cognitive 16) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs
  • Cognitive Complexity · EquiJoinNode::new (cognitive 16) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Cognitive Complexity · IcebergTableWrap.get (cognitive 16) py-polars/src/polars/io/iceberg/_dataset.py
  • God Classes · FunctionTooLong: polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs
  • God Classes · FunctionTooLong: polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_to_ir.rs
  • God Classes · MethodTooLong: AExpr.to_field_impl crates/polars-plan/src/plans/aexpr/schema.rs
  • God Classes · FunctionTooLong: polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by crates/polars-stream/src/physical_plan/lower_group_by.rs
  • God Classes · FileTooLong: joins/equi_join.rs crates/polars-stream/src/nodes/joins/equi_join.rs
  • God Classes · MethodTooLong: ProbeState.partition_and_probe crates/polars-stream/src/nodes/joins/equi_join.rs
  • God Classes · FunctionTooLong: polars_plan::plans::python::pyarrow::predicate_to_pa crates/polars-plan/src/plans/python/pyarrow.rs
  • God Classes · MethodTooLong: GroupBySink.spawn crates/polars-stream/src/nodes/group_by/sink.rs
  • God Classes · FunctionTooLong: polars_stream::physical_plan::lower_group_by::build_group_by_stream crates/polars-stream/src/physical_plan/lower_group_by.rs
  • God Classes · FileTooLong: list/namespace.rs crates/polars-ops/src/chunked_array/list/namespace.rs
  • God Classes · MethodTooLong: EquiJoinNode.update_state crates/polars-stream/src/nodes/joins/equi_join.rs
  • God Classes · MethodTooLong: EquiJoinNode.new crates/polars-stream/src/nodes/joins/equi_join.rs
  • God Classes · ClassTooLong: ListNameSpaceImpl crates/polars-ops/src/chunked_array/list/namespace.rs
  • Code Duplication · Near-duplicate member family (3 members, 49 shared lines) crates/polars-plan/src/plans/aexpr/traverse.rs
  • Code Duplication · Near-duplicate member family (3 members, 24 shared lines) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs
  • Code Duplication · Near-duplicate member family (3 members, 12 shared lines) docs/source/src/rust/user-guide/concepts/data-types-and-structures.rs
  • Code Duplication · Near-duplicate member pair (280 shared lines) crates/polars-plan/src/dsl/function_expr/mod.rs
  • Code Duplication · Near-duplicate member pair (213 shared lines) crates/polars-plan/src/dsl/function_expr/mod.rs
  • Code Duplication · Near-duplicate member pair (61 shared lines) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Code Duplication · Near-duplicate member pair (59 shared lines) crates/polars-ops/src/chunked_array/list/sets.rs
  • Code Duplication · Near-duplicate member pair (54 shared lines) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Code Duplication · Near-duplicate member pair (36 shared lines) crates/polars-mem-engine/src/executors/group_by_dynamic.rs
  • Code Duplication · Near-duplicate member pair (35 shared lines) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Code Duplication · Near-duplicate member pair (33 shared lines) crates/polars-ops/src/series/ops/ewm.rs
  • Code Duplication · Near-duplicate member pair (29 shared lines) crates/polars-ops/src/series/ops/clip.rs
  • Code Duplication · Near-duplicate member pair (27 shared lines) crates/polars-core/src/frame/group_by/aggregations/mod.rs
  • Code Duplication · Near-duplicate member pair (25 shared lines) crates/polars-ops/src/chunked_array/strings/find_many.rs
  • Code Duplication · Near-duplicate member pair (19 shared lines) crates/polars-ops/src/chunked_array/list/dispersion.rs
  • Code Duplication · Edited copy of a member (10 corresponding lines) crates/polars-expr/src/reduce/cov.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/polars-core/src/frame/group_by/aggregations/mod.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) py-polars/src/polars/io/csv/functions.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/polars-core/src/frame/group_by/aggregations/mod.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-core/src/frame/group_by/aggregations/mod.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-ops/src/chunked_array/array/dispersion.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-ops/src/series/ops/log.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-parquet/src/arrow/write/binary/nested.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-sql/src/subquery.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) py-polars/src/polars/expr/list.py
  • Code Duplication · Duplicated block (43 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs
  • Code Duplication · Duplicated block (32–35 lines × 2) crates/polars-io/src/cloud/concurrency/admission.rs
  • Code Duplication · Duplicated block (29 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs
  • Code Duplication · Duplicated block (26 lines × 2) crates/polars-expr/src/reduce/convert.rs
  • Code Duplication · Duplicated block (26 lines × 2) crates/polars-parquet/src/arrow/write/binary/nested.rs
  • Code Duplication · Duplicated block (26 lines × 2) crates/polars-stream/src/nodes/io_sources/ipc/mod.rs
  • Code Duplication · Duplicated block (26 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Code Duplication · Duplicated block (26 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Code Duplication · Duplicated block (25–26 lines × 2) docs/source/src/rust/user-guide/concepts/expressions.rs
  • Code Duplication · Duplicated block (25 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs
  • Code Duplication · Duplicated block (23–24 lines × 2) crates/polars-parquet/src/arrow/write/binary/basic.rs
  • Code Duplication · Duplicated block (23 lines × 2) crates/polars-core/src/series/arithmetic/fixed_size_list.rs
  • Code Duplication · Duplicated block (23 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/ipc/mod.rs
  • Code Duplication · Duplicated block (23 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Code Duplication · Duplicated block (23 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs
  • Code Duplication · Duplicated block (23 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs
  • Code Duplication · Duplicated block (22 lines × 2) crates/polars-parquet/src/arrow/write/pages.rs
  • Code Duplication · Duplicated block (20 lines × 2) crates/polars-io/src/cloud/options.rs
  • Code Duplication · Duplicated block (17–19 lines × 2) crates/polars-core/src/frame/column/scalar.rs
  • Code Duplication · Duplicated block (19 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs
  • Code Duplication · Duplicated block (19 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs
Rebuild cost: about €1,000,000 · Estimate
Cost to rebuild€350,000 to €1,700,000, for 5,788 to 18,362 hours of work, about 7.2 person-years for 4 to 14 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.9 at a score of 66. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeVery large: 625,739 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Rust: `.await` the future instead of `block_on` (on a Tokio runtime thread it panics outright) and use `tokio::time::sleep(..).await` instead of `std::thread::sleep`; where synchronous code must run, move it to `tokio::task::spawn_blocking` or `block_in_place`.
Raises the score by about 6 points · Medium effort · Async & latency hygiene
2
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with dsl-schema.rs.
Raises the score by about 2 points · Low effort · ADR Quality
3
Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with parquet_macros.rs.
Raises the score by about 1 point · Low effort · Knowledge Freshness

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €1,000,000 to build again, about 7.2 person-years of work. Its weakest lens is Performance, at 60 (Adequate). Performance is about whether the code is written and measured with speed in mind. Because the weakest lens counts most in the score, work on Performance also moves the score most.
Based on: the rebuild estimate · the Performance grade · how much each lens counts
What to do: Start with the Performance actions in Top priorities.
If you do one thing first · First action
Rust: `.await` the future instead of `block_on` (on a Tokio runtime thread it panics outright) and use `tokio::time::sleep(..).await` instead of `std::thread::sleep`; where synchronous code must run, move it to `tokio::task::spawn_blocking` or `block_in_place`. Of all the actions in this report, it raises the score most for the work it takes: about 6 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.1 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 11% on every change. The history of the code shows how much it changes: about 346,675 lines over the last 90 days, which is about 1,405,960 lines a year. At that pace, the extra work comes to an estimated 168.2 to 1009.4 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.

arch polars (Cargo) polars (Cargo) polars-arrow polars-arrow polars (Cargo)->polars-arrow polars-buffer polars-buffer polars (Cargo)->polars-buffer polars-compute polars-compute polars (Cargo)->polars-compute polars-core polars-core polars (Cargo)->polars-core polars-defs polars-defs polars (Cargo)->polars-defs polars-error polars-error polars (Cargo)->polars-error polars-expr polars-expr polars (Cargo)->polars-expr polars-io polars-io polars (Cargo)->polars-io polars-lazy polars-lazy polars (Cargo)->polars-lazy polars-ops polars-ops polars (Cargo)->polars-ops polars-parquet polars-parquet polars (Cargo)->polars-parquet polars-plan polars-plan polars (Cargo)->polars-plan polars-time polars-time polars (Cargo)->polars-time polars-utils polars-utils polars (Cargo)->polars-utils polars-arrow->polars-buffer polars-arrow->polars-error polars-arrow->polars-utils polars-buffer->polars-utils polars-compute->polars-arrow polars-compute->polars-buffer polars-compute->polars-error polars-compute->polars-utils polars-config polars-config polars-config->polars-error polars-core->polars-arrow polars-core->polars-buffer polars-core->polars-compute polars-core->polars-config polars-core->polars-error polars-core->polars-utils polars-defs->polars-arrow polars-defs->polars-compute polars-defs->polars-core polars-defs->polars-error polars-defs->polars-utils polars-expr->polars-arrow polars-expr->polars-buffer polars-expr->polars-compute polars-expr->polars-core polars-expr->polars-defs polars-expr->polars-io polars-json polars-json polars-expr->polars-json polars-expr->polars-ops polars-expr->polars-plan polars-expr->polars-time polars-expr->polars-utils polars-io->polars-arrow polars-io->polars-buffer polars-io->polars-compute polars-io->polars-config polars-io->polars-core polars-io->polars-error polars-io->polars-json polars-io->polars-parquet polars-io->polars-utils polars-json->polars-arrow polars-json->polars-compute polars-json->polars-error polars-json->polars-utils polars-lazy->polars-arrow polars-lazy->polars-buffer polars-lazy->polars-compute polars-lazy->polars-config polars-lazy->polars-core polars-lazy->polars-defs polars-lazy->polars-expr polars-lazy->polars-io polars-lazy->polars-json polars-mem-engine polars-mem-engine polars-lazy->polars-mem-engine polars-lazy->polars-ops polars-lazy->polars-plan polars-stream polars-stream polars-lazy->polars-stream polars-lazy->polars-time polars-lazy->polars-utils polars-mem-engine->polars-arrow polars-mem-engine->polars-buffer polars-mem-engine->polars-config polars-mem-engine->polars-core polars-mem-engine->polars-defs polars-mem-engine->polars-error polars-mem-engine->polars-expr polars-mem-engine->polars-io polars-mem-engine->polars-json polars-mem-engine->polars-ops polars-mem-engine->polars-plan polars-mem-engine->polars-time polars-mem-engine->polars-utils polars-ops->polars-arrow polars-ops->polars-buffer polars-ops->polars-compute polars-ops->polars-core polars-ops->polars-defs polars-ops->polars-error polars-ops->polars-json polars-ops->polars-utils polars-parquet->polars-arrow polars-parquet->polars-buffer polars-parquet->polars-compute polars-parquet->polars-config polars-parquet->polars-error polars-parquet->polars-utils polars-plan->polars-arrow polars-plan->polars-buffer polars-plan->polars-compute polars-plan->polars-config polars-plan->polars-core polars-plan->polars-defs polars-plan->polars-error polars-plan->polars-io polars-plan->polars-json polars-plan->polars-parquet polars-plan->polars-utils polars-python polars-python polars-python->polars (Cargo) polars-python->polars-arrow polars-python->polars-buffer polars-python->polars-compute polars-python->polars-config polars-python->polars-core polars-python->polars-defs polars-python->polars-error polars-python->polars-expr polars-python->polars-io polars-python->polars-lazy polars-python->polars-mem-engine polars-python->polars-ops polars-python->polars-parquet polars-python->polars-plan polars-python->polars-stream polars-python->polars-time polars-python->polars-utils polars-stream->polars-arrow polars-stream->polars-buffer polars-stream->polars-compute polars-stream->polars-config polars-stream->polars-core polars-stream->polars-defs polars-stream->polars-error polars-stream->polars-expr polars-stream->polars-io polars-stream->polars-json polars-stream->polars-mem-engine polars-stream->polars-ops polars-stream->polars-parquet polars-stream->polars-plan polars-stream->polars-time polars-stream->polars-utils polars-time->polars-arrow polars-time->polars-compute polars-time->polars-core polars-time->polars-defs polars-time->polars-error polars-time->polars-ops polars-time->polars-utils polars-utils->polars-config polars-utils->polars-error __more__ +23 more projects

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

1978 modules, with 6036 dependencies between them. 36 loops run through 212 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 1938 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 polars_async.executor.metrics2 polars_async.primitives.distributor_channel3 polars_buffer.buffer4 polars_core.chunked_array.ops.sort.options5 polars_core.frame.group_by.position6 polars_io.cloud.options7 polars_utils.arena8 polars_utils.pl_str9 py-polars.src.polars.dataframe.frame10 py-polars.src.polars.expr.expr11 polars_arrow.bitmap.mutable12 polars_arrow.datatypes13 polars_async.executor14 polars_schema.schema15 polars_arrow.bitmap.immutable16 polars_arrow.scalar17 polars_compute.rolling18 polars_core.datatypes.dtype19 polars_plan.plans.ir20 polars_arrow.array21 polars_arrow.bitmap.builder22 polars_core.datatypes.any_value23 polars_arrow.array.binary24 polars_arrow.array.primitive25 polars_core.frame.dataframe26 polars_arrow.array.boolean27 polars_core.frame.column28 polars_defs.join29 polars_expr.state.execution_state30 polars_stream.morsel31 polars_core.series32 polars_plan.dsl.expr33 polars_stream.execute34 polars_stream.nodes.io_sources.parquet.statistics35 polars_core.chunked_array36 polars_plan.plans.expr_ir37 polars_stream.nodes38 polars_expr.hash_keys39 polars_plan.plans.options40 polars_lazy.frame
1 polars_async.executor.metrics
2 polars_async.primitives.distributor_channel
3 polars_buffer.buffer
4 polars_core.chunked_array.ops.sort.options
5 polars_core.frame.group_by.position
6 polars_io.cloud.options
7 polars_utils.arena
8 polars_utils.pl_str
9 py-polars.src.polars.dataframe.frame
10 py-polars.src.polars.expr.expr
11 polars_arrow.bitmap.mutable1
12 polars_arrow.datatypes1
13 polars_async.executor32
14 polars_schema.schema1
15 polars_arrow.bitmap.immutable11
16 polars_arrow.scalar1
17 polars_compute.rolling1
18 polars_core.datatypes.dtype1111
19 polars_plan.plans.ir181
20 polars_arrow.array131
21 polars_arrow.bitmap.builder12
22 polars_core.datatypes.any_value1
23 polars_arrow.array.binary11113
24 polars_arrow.array.primitive12112
25 polars_core.frame.dataframe111121111
26 polars_arrow.array.boolean11121
27 polars_core.frame.column2111121121
28 polars_defs.join21
29 polars_expr.state.execution_state12
30 polars_stream.morsel1
31 polars_core.series11111121111
32 polars_plan.dsl.expr2112121
33 polars_stream.execute111
34 polars_stream.nodes.io_sources.parquet.statistics11131
35 polars_core.chunked_array2112131112
36 polars_plan.plans.expr_ir32111
37 polars_stream.nodes21
38 polars_expr.hash_keys12113111
39 polars_plan.plans.options111
40 polars_lazy.frame11114212731
Uses a module listed above itPart of a loopThe module itself
1 polars_async.executor.metrics2 polars_async.primitives.distributor_channel3 polars_buffer.buffer4 polars_core.chunked_array.ops.sort.options5 polars_core.frame.group_by.position6 polars_io.cloud.options7 polars_utils.arena8 polars_utils.pl_str9 py-polars.src.polars.dataframe.frame10 py-polars.src.polars.expr.expr11 polars_arrow.bitmap.mutable12 polars_arrow.datatypes13 polars_async.executor14 polars_schema.schema15 polars_arrow.bitmap.immutable16 polars_arrow.scalar17 polars_compute.rolling18 polars_core.datatypes.dtype19 polars_plan.plans.ir20 polars_arrow.array21 polars_arrow.bitmap.builder22 polars_core.datatypes.any_value23 polars_arrow.array.binary24 polars_arrow.array.primitive25 polars_core.frame.dataframe26 polars_arrow.array.boolean27 polars_core.frame.column28 polars_defs.join29 polars_expr.state.execution_state30 polars_stream.morsel31 polars_core.series32 polars_plan.dsl.expr33 polars_stream.execute34 polars_stream.nodes.io_sources.parquet.statistics35 polars_core.chunked_array36 polars_plan.plans.expr_ir37 polars_stream.nodes38 polars_expr.hash_keys39 polars_plan.plans.options40 polars_lazy.framepolars_async.executor.metrics1polars_async.primitives.distributor_channel2polars_buffer.buffer3polars_core.chunked_array.ops.sort.options4polars_core.frame.group_by.position5polars_io.cloud.options6polars_utils.arena7polars_utils.pl_str8py-polars.src.polars.dataframe.frame9py-polars.src.polars.expr.expr10polars_arrow.bitmap.mutable11polars_arrow.datatypes12polars_async.executor13polars_schema.schema14polars_arrow.bitmap.immutable15polars_arrow.scalar16polars_compute.rolling17polars_core.datatypes.dtype18polars_plan.plans.ir19polars_arrow.array20polars_arrow.bitmap.builder21polars_core.datatypes.any_value22polars_arrow.array.binary23polars_arrow.array.primitive24polars_core.frame.dataframe25polars_arrow.array.boolean26polars_core.frame.column27polars_defs.join28polars_expr.state.execution_state29polars_stream.morsel30polars_core.series31polars_plan.dsl.expr32polars_stream.execute33polars_stream.nodes.io_sources.parquet.statistics34polars_core.chunked_array35polars_plan.plans.expr_ir36polars_stream.nodes37polars_expr.hash_keys38polars_plan.plans.options39polars_lazy.frame40113211111111118113112111113121121111211111112121111211212112111111121111211212111111131211213111232111211211311111111114212731+1938 more modules (most-connected shown)

At a glance — Code Health · 81% · Adequate · gated by D2 ·

At a glance — Architecture · 93% · Exemplary ·

At a glance — Maturity · 68% · Adequate · gated by M2 ·

At a glance — Readiness · 72% · Strong ·

At a glance — Security · 70% · Checked 5 of 11 · gated by D29 ·

At a glance — Event Sourcing · 100% · Exemplary ·

At a glance — Performance · 60% · Adequate ·

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A05:2025 — Injection161High / Critical
A03:2025 — Software Supply Chain Failures26Medium

Roadmap

Top priorities: Rust: `.await` the future instead of `block_on` (on a Tokio runtime thread it panics outright) and use `tokio::time::sleep(..).await` instead of `std::thread::sleep`; where synchronous code must run, move it to `tokio::task::spawn_blocking` or `block_in_place`; Resolve the 1 No ADRs found finding(s) in ADR Quality — start with dsl-schema.rs; Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Rust: `.await` the future instead of `block_on` (on a Tokio runtime thread it panics outright) and use `tokio::time::sleep(..).await` instead of `std::thread::sleep`; where synchronous code must run, move it to `tokio::task::spawn_blocking` or `block_in_place`.+5.7 ptsMediumAsync & latency hygiene
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with dsl-schema.rs.+2.2 ptsLowADR Quality
Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with parquet_macros.rs.+1.0 ptsLowKnowledge Freshness
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.+2.0 ptsMediumArchitecture documentation
Resolve the 7 Off-boarding risk finding(s) in Bus Factor.+0.5 ptsLowBus Factor
Resolve the 153 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (28), functions.rs (3), any_value.rs (3).+0.9 ptsHighChurn × Complexity Hotspots
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.+0.8 ptsMediumDocumentation (README)
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.+0.8 ptsMediumObservability

File quality

Per-file score 0–10 — a quality signature. Of 946 files carrying findings, judged against the Production bar: 2% slop · 66% mixed · 32% near-clean.

FileScoreBandWorst signal
REDACTED0.0SlopStatic Analysis (SAST): High: REDACTED
crates/polars-core/src/chunked_array/array/iterator.rs1.5SlopChange Coupling: Boundary-crossing change coupling: iterator.rs ↔ array.py
crates/polars-stream/src/physical_plan/lower_ir.rs1.9SlopChange Coupling: Boundary-crossing change coupling: lower_ir.rs ↔ partition.py
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.5SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.0SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.0SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.0SlopStatic Analysis (SAST): High: REDACTED
crates/polars-io/src/csv/read/streaming.rs3.2SlopChange Coupling: Boundary-crossing change coupling: streaming.rs ↔ functions.py
crates/polars-plan/src/dsl/function_expr/strings.rs3.6SlopChange Coupling: Boundary-crossing change coupling: strings.rs ↔ string.py
crates/polars-lazy/src/scan/csv.rs4.0SlopChange Coupling: Boundary-crossing change coupling: csv.rs ↔ _options.py

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 187

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 3776

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 162

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 26

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 47 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.

Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.

What we checked — 47 dimensions across the health lenses
D1D2D3D4D5D6D12D13D14D15D16D17D19D20D26D28D29D30D34D35D36D37D43D44AX10AX3AX4AX9ES1ES2M1M2M3M4P1P10P2P3P4P6PF3X1X21X27X28X29X30

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 4071 of 4125 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic

Every finding is locatable in findings.md. Run 01a1d885-9212-7ac8-bcf9-18c5acf50d42.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the Rust half could not be measured — the Cargo suite in repository root did not build, so it was never run. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo — a Codecov configuration (.github/codecov.yml) and a coverage step in CI (`cargo llvm-cov`) shows coverage is measured in your own CI.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs, .py) and this repository declares a Python test suite (py-polars, 440 test files), but it was not re-run: its dependency install outgrew the 6 GB scratch ceiling (6.612 GB measured) and was stopped; its suite was not run. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Python pyproject.toml/requirements.txt (pip/uv/Poetry), but the licence verdict published here was taken over its crate dependencies. Nothing was read about its Python dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
  • C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Python, Rust is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Python, Rust is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P8 Schema migrations — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The schema may be created by a runner, a deploy script or a config file outside what this check reads, so an absence here is our blind spot rather than a missing migration strategy. The card abstains instead of scoring. You can widen what we reach: if the schema is created and evolved by a tool this check does not name, naming it lets us teach the detector to read it.
  • S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 21 further occurrence(s) are not listed individually; the score already reflects all 61.
  • X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X17 Uncapped recursion over a caller-supplied document — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X19 Unrestored process-global state — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X23 Unguarded diagnostic materialisation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X25 Inert configuration knob — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X29 Per-element action decided by a fixed element — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Python, Rust is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

Repo exclusion declarations: 3 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.

Limitations & what we did not check

We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity4.5 / 10Weak✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

Maturity: Documented → Verified → Prevented · effective 4.5 / 10 · rule-coverage 100% · ceiling Prevented

418 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions at 424. A further 119 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being PolarsSQLFunctions::try_from_sql at 156 — they are counted neither in the figure above nor in this dimension's score. 47 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: crates/polars-plan/src/plans/aexpr/determinism.rs (polars_plan::plans::aexpr::determinism::is_inherently_nondeterministic_fn at 94), pyo3-polars/pyo3-polars/src/types.rs (PyDataType::extract at 63), crates/polars-config/src/lib.rs (Config::apply_env_var at 51), crates/polars-expr/src/dispatch/temporal.rs (polars_expr::dispatch::temporal::temporal_func_to_udf at 50), crates/polars-expr/src/dispatch/strings.rs (polars_expr::dispatch::strings::function_expr_to_udf at 48), and 42 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions (cyclomatic 424) · ×70crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:16
SQLContext::execute_select_block (cyclomatic 65) · ×17REDACTED:3575
polars_stream::physical_plan::lower_ir::lower_ir_inner (cyclomatic 156) · ×16crates/polars-stream/src/physical_plan/lower_ir.rs:279
polars_parquet::arrow::read::deserialize::simple::page_iter_to_array (cyclomatic 51) · ×15crates/polars-parquet/src/arrow/read/deserialize/simple.rs:31
polars_ops::series::ops::unique::unique_counts (cyclomatic 41) · ×14crates/polars-ops/src/series/ops/unique.rs:32

+ 198 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 5 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions (cyclomatic 424), polars_python::lazyframe::visitor::expr_nodes::into_py (cyclomatic 421), polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl (cyclomatic 369). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 5 together lifts Cyclomatic Complexity from 4.5 to about 5.1/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity3.1 / 10Weak✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: Documented → Verified → Prevented · effective 3.1 / 10 · rule-coverage 100% · ceiling Prevented

709 method(s) exceeded the cognitive complexity threshold of 15; the worst was ProjectionPushdownVisitor::pushdown at 525.

polars_plan::plans::conversion::dsl_to_ir::to_alp_impl (cognitive 240) · ×76crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:194
polars_ops::chunked_array::gather::chunked::take_opt_chunked_unchecked_binview (cognitive 74) · ×44crates/polars-ops/src/chunked_array/gather/chunked.rs:685
polars_stream::physical_plan::lower_ir::lower_ir_inner (cognitive 262) · ×36crates/polars-stream/src/physical_plan/lower_ir.rs:279
polars_parquet::arrow::read::deserialize::utils::unspecialized_decode (cognitive 53) · ×30crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:122
SQLContext::execute_select_block (cognitive 114) · ×29REDACTED:3575

+ 331 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 3 bodies over 240 down to 240 or less in Cognitive Complexity — start with ProjectionPushdownVisitor::pushdown (cognitive 525), WindowExpr::evaluate_on_groups_impl (cognitive 273), polars_stream::physical_plan::lower_ir::lower_ir_inner (cognitive 262). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 3 together lifts Cognitive Complexity from 3.2 to about 4.2/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes7.7 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 7.7 / 10 · rule-coverage 100% · ceiling Prevented

478 god class(es) detected.

FileTooLong: REDACTED · ×162REDACTED
MethodTooLong: ProjectionPushdownVisitor.pushdown · ×130crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:235
FunctionTooLong: polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx · ×116crates/polars-stream/src/physical_plan/lower_expr.rs:556
TooManyMethods: PyExpr · ×38crates/polars-python/src/expr/mod.rs:44
ClassTooLong: SQLContext · ×27REDACTED:316

+ 2 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 162 FileTooLong finding(s) in God Classes — start with mod.rs (34), functions.rs (3), any_value.rs (3). — One of this dimension's main actionable groups (162 warning-level).
  2. Resolve the 130 MethodTooLong finding(s) in God Classes — start with mod.rs (29), REDACTED (10), builder.rs (4). — One of this dimension's main actionable groups (130 warning-level).
  3. Resolve the 116 FunctionTooLong finding(s) in God Classes — start with mod.rs (12), lower_group_by.rs (5), scans.rs (5). — One of this dimension's main actionable groups (116 warning-level).

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication7.0 / 10Strong✓ Tool-verified

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

Maturity: Documented → Verified → Prevented · effective 7.0 / 10 · rule-coverage 100% · ceiling Verified

928 duplicated block group(s) detected. 7.4 % of the production lines (46,259 of 625,739) are in a reported copy. A further 635 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.

Duplicated block (5 lines × 2) · ×67crates/polars-compute/src/moment.rs:653
Duplicated block (11 lines × 2) · ×64crates/polars-compute/src/rolling/moment.rs:324
Duplicated block (9 lines × 2) · ×63crates/polars-compute/src/min_max/simd.rs:40
Duplicated block (7 lines × 2) · ×60crates/polars-compute/src/approx_quantile.rs:841
Duplicated block (8 lines × 2) · ×59crates/polars-compute/src/arithmetic/mod.rs:197

+ 323 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 67 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with distinct.rs (7), supertype.rs (4), mod.rs (4). — One of this dimension's main actionable groups (67 warning-level).
  2. Resolve the 64 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with mod.rs (14), ewm.rs (3), fixed_size_list.rs (2). — One of this dimension's main actionable groups (64 warning-level).
  3. Resolve the 63 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with mod.rs (18), builder.rs (2), options.rs (2). — One of this dimension's main actionable groups (63 warning-level).

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling8.6 / 10Strong✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 8.6 / 10 · rule-coverage 100% · ceiling Prevented

43 production modules (Cargo+Python), 0 dependency cycle(s), 3 unstable depended-on module(s). Read from the build's own module declarations; 4 module(s) off the main sequence, with abstractness counted on 32 of the 43 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: polars-descriptions · ×4
Unstable project polars-python
Unstable project polars-sql
Unstable project polars-stream

What to do

  1. Resolve the 4 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (4 warning-level).
  2. Resolve the 1 Unstable project polars-python finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Unstable project polars-sql finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.

D6 · Cohesion (LCOM4)9.7 / 10Stronggated by 23 serious findings✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 9.7 / 10 · rule-coverage 100% · ceiling Verified

23 of 810 classes have LCOM4 above 3.

Low cohesion: ChunkedArray (LCOM4 46) · ×23crates/polars-core/src/chunked_array/mod.rs:140

What to do

  1. Resolve the 23 Low cohesion finding(s) in Cohesion (LCOM4) — start with mod.rs (4), options.rs, dataframe.rs. — One of this dimension's main actionable groups (23 warning-level).

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.

D12 · Dependency Hygiene8.4 8.2 / 10Strong✓ Tool-verified

What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.

Maturity: Documented → Verified → Prevented · effective 8.2 / 10 · rule-coverage 98% · ceiling Verified

31 outdated, 0 yanked direct Cargo dependencies. 119 of 122 direct crates were graded against crates.io (0 not published there, 3 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.

Outdated: arboard · ×31

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · Secret Scanning10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 528 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. A further 3 crate(s) in the closure resolve from git, a path or a private registry and publish no licence this pass can read; they are outside this verdict. This repository publishes itself under MIT, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares a Python pyproject.toml/requirements.txt (pip/uv/Poetry), and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots8.6 / 10Strong✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: Documented → Verified → Prevented · effective 8.6 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs (31×424=13144); crates/polars-python/src/lazyframe/visitor/expr_nodes.rs (29×421=12209); crates/polars-sql/src/functions.rs (38×236=8968) Repeated repair below the complexity floor: crates/polars-expr/src/expressions/sortby.rs (5 of 8 changes were fixes); crates/polars-ops/src/series/ops/log.rs (4 of 7 changes were fixes); crates/polars-sql/src/group_context.rs (4 of 6 changes were fixes)

Hotspot: crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs · ×153crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:16
Repeated repair: crates/polars-expr/src/expressions/sortby.rs · ×9crates/polars-expr/src/expressions/sortby.rs:292

What to do

  1. Resolve the 153 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (28), functions.rs (3), any_value.rs (3). — One of this dimension's main actionable groups (153 warning-level).
  2. Resolve the 9 Repeated repair finding(s) in Churn × Complexity Hotspots — start with sortby.rs, log.rs, group_context.rs. — One of this dimension's main actionable groups (9 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor9.3 / 10Exemplary✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: Documented → Verified → Prevented · effective 9.3 / 10 · rule-coverage 100% · ceiling Documented

109 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is crates/polars-core/src/chunked_array/logical/map.rs. Counted over 1573 of the 2290 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1 · ×7
Further sole-owners (lower concentration)

✓ On the Gold path — maintain.

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt9.9 / 10Stronggated by 353 serious findings✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Prevented

353 deducted task-comment markers across 625739 LoC (0.1/KLoC) → score 9.9. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoComment · ×349pyo3-polars/pyo3-polars/src/lib.rs:17
HackComment · ×3crates/polars-stream/src/physical_plan/lower_expr.rs:3102
XxxCommentcrates/polars-python/src/file.rs:397

What to do

  1. Resolve the 349 TodoComment finding(s) in Explicit Debt — start with mod.rs (40), scans.rs (6), REDACTED (6). — One of this dimension's main actionable groups (349 warning-level).
  2. Resolve the 3 HackComment finding(s) in Explicit Debt — start with lower_expr.rs, tree_format.rs, single_keys.rs. — One of this dimension's main actionable groups (3 warning-level).
  3. Resolve the 1 XxxComment finding(s) in Explicit Debt — start with file.rs. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 1 documentation facets pass in full. 123 document(s) read across 1 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs foundcrates/polars-plan/src/bin/dsl-schema.rs:1

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with dsl-schema.rs. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.

D26 · Project Cohesion4.9 / 10Weak✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic.

Maturity: Documented → Verified → Prevented · effective 4.9 / 10 · rule-coverage 100% · ceiling Documented

11 of 43 build units (Cargo, Python) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)0.0 / 10Critical✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

161 finding(s): 0 critical, 154 high, 5 medium, 2 low. 119 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 10 file(s) — `crates/polars-buffer/src/storage.rs` (line 141), `crates/polars-compute/src/approx_quantile.rs` (line 427, line 569, line 601, …), `crates/polars-core/src/chunked_array/mod.rs` (line 1019), `crates/polars-io/src/cloud/object_store_setup.rs` (line 147, line 155, lines 156–157), `crates/polars-plan/src/plans/optimizer/expand_datasets.rs` (line 1014, lines 1015–1016), … (+5 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 3 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 10 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 13 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (6), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (13 issue-level).
  2. Resolve the 6 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (6 issue-level).
  3. No action in Static Analysis (SAST) — all 119 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (119 issue-level, 0 of them charged here).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities9.2 / 10Stronggated by 4 serious findings✓ Tool-verified

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 9.2 / 10 · rule-coverage 100% · ceiling Documented

6 finding(s): 0 critical, 0 high, 4 medium, 0 low.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 2 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).
  2. Resolve the 2 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 1 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness9.6 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

63 of 1573 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/polars-parquet/src/parquet/handwritten_thrift/parquet_macros.rs. Counted over 1573 of the 2290 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledgecrates/polars-parquet/src/parquet/handwritten_thrift/parquet_macros.rs:1
Orphaned file · ×62py-polars/src/polars/_utils/getitem.py:1
Further orphaned files (smaller)

What to do

  1. Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with parquet_macros.rs. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 62 Orphaned file finding(s) in Knowledge Freshness — start with binary.rs (4), linear_space.rs (2), datetime.rs (2). — One of this dimension's main actionable groups (62 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling9.5 / 10Adequategated by 32 critical findings✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

Maturity: Documented → Verified → Prevented · effective 9.5 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: lib.rs↔sql.rs 100%; array.rs↔array.rs 93%; mod.rs↔array.py 91%

Boundary-crossing change coupling: mod.rs ↔ array.py · ×32crates/polars-ops/src/chunked_array/array/mod.rs:1
Change coupling: lib.rs ↔ sql.rs · ×32crates/polars-sql/src/lib.rs:1
Change-coupling hub: array.rs → iterator.rs, mod.rs, array.rs, array.rs · ×4crates/polars-python/src/expr/array.rs

What to do

  1. Resolve the 32 Boundary-crossing change coupling finding(s) in Change Coupling — start with array.rs (5), list.rs (3), string.rs (3). — One of this dimension's main actionable groups (32 issue-level).
  2. Resolve the 32 Change coupling finding(s) in Change Coupling — start with mod.rs (6), lib.rs (2), list.rs (2). — One of this dimension's main actionable groups (32 warning-level).
  3. Resolve the 4 Change-coupling hub finding(s) in Change Coupling — start with array.rs, strings.rs, determinism.rs. — One of this dimension's main actionable groups (4 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing5.0 / 10Adequate✓ Tool-verified

What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.

Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.

Maturity: Documented → Verified → Prevented · effective 5.0 / 10 · rule-coverage 100% · ceiling Documented

2/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 3 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 11 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (11 warning-level).
  2. Resolve the 3 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.

Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 0 platform declaration(s) and 1 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AX10 · Code composition10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

ES1 · Fold determinism10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.

Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.

ES2 · Immutable events10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.

Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.

M1 · Documentation (README)8.1 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
M2 · Architecture documentation2.0 / 10Critical✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.

Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P10 · Library API & versioning10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

  • 1 public type in `polars_compute.arithmetic` is marked as implementation by its own namespace, folder or name: `PrimitiveArithmeticKernelImpl` (crates/polars-compute/src/arithmetic/mod.rs:90, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/polars-compute/src/arithmetic/mod.rs:90
  • 1 public type in `polars_compute.cast` is marked as implementation by its own namespace, folder or name: `CastOptionsImpl` (crates/polars-compute/src/cast/mod.rs:37, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/polars-compute/src/cast/mod.rs:37
  • 1 public type in `polars_core.datatypes.extension` is marked as implementation by its own namespace, folder or name: `ExtensionTypeImpl` (crates/polars-core/src/datatypes/extension/mod.rs:26, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/polars-core/src/datatypes/extension/mod.rs:26
  • 1 public type in `polars_core.series.implementations.null` is marked as implementation by its own namespace, folder or name: `NullChunked` (crates/polars-core/src/series/implementations/null.rs:19, `implementations`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/polars-core/src/series/implementations/null.rs:19
  • 1 public type in `polars_ops.chunked_array.list.namespace` is marked as implementation by its own namespace, folder or name: `ListNameSpaceImpl` (crates/polars-ops/src/chunked_array/list/namespace.rs:53, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/polars-ops/src/chunked_array/list/namespace.rs:53
  • 1 public type in `polars_ops.chunked_array.strings.json_path` is marked as implementation by its own namespace, folder or name: `Utf8JsonPathImpl` (crates/polars-ops/src/chunked_array/strings/json_path.rs:42, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/polars-ops/src/chunked_array/strings/json_path.rs:42
  • 1 public type in `polars_ops.chunked_array.strings.namespace` is marked as implementation by its own namespace, folder or name: `StringNameSpaceImpl` (crates/polars-ops/src/chunked_array/strings/namespace.rs:333, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/polars-ops/src/chunked_array/strings/namespace.rs:333
  • 1 public type in `polars_plan.traversal.tree_traversal` is marked as implementation by its own namespace, folder or name: `TreeTraversalImpl` (crates/polars-plan/src/traversal/tree_traversal.rs:57, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — crates/polars-plan/src/traversal/tree_traversal.rs:57

What to do

  • Hide `polars_compute.arithmetic` (`PrimitiveArithmeticKernelImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `polars_compute.cast` (`CastOptionsImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `polars_core.datatypes.extension` (`ExtensionTypeImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `polars_core.series.implementations.null` (`NullChunked`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `polars_ops.chunked_array.list.namespace` (`ListNameSpaceImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `polars_ops.chunked_array.strings.json_path` (`Utf8JsonPathImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `polars_ops.chunked_array.strings.namespace` (`StringNameSpaceImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `polars_plan.traversal.tree_traversal` (`TreeTraversalImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
P2 · Observability4.5 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • Only 1/6 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/polars-cli`, `crates/polars-plan`, `docs/source`, `docs/source/src/rust`, `py-polars`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling7.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

What to do

  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback7.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

PF3 · Async & latency hygiene6.0 / 10Adequate✓ Tool-verified

Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

  • `csv_file_info` is async and calls block_on — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs. — crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1268

What to do

  • Rust: `.await` the future instead of `block_on` (on a Tokio runtime thread it panics outright) and use `tokio::time::sleep(..).await` instead of `std::thread::sleep`; where synchronous code must run, move it to `tokio::task::spawn_blocking` or `block_in_place`.
X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

X21 · Side-effecting pattern guard8.0 / 10Strong✓ Tool-verified

Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.

Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.

  • The `if` guard on line 374 (`(Scan { sources, file_info, hive_parts, output_schema, mut unified_scan_args, predicate, predicate_file_skip_applied, scan_type, maintain_order, }, Some(state),) if predicate.is_none() && match &*scan_type { [cfg(feature = " ")] FileScanIR::Parquet { .. } => true, [cfg(feature = " ")] FileScanIR::Ipc { .. } => true, [cfg(feature = " ")] FileScanIR::Csv { .. } => true, [cfg(feature = " ")] FileScanIR::NDJson { .. } => true, [cfg(feature = " ")] FileScanIR::PythonDataset { .. } => true, [cfg(feature = " ")] FileScanIR::Lines { .. } => true, FileScanIR::ExpandedPaths { .. } => false, FileScanIR::ExternalReaderBuilder { .. } => true, FileScanIR::Anonymous { .. } => state.offset == 0, } =>`) changes `feature` with `feature = …` while the `match` is deciding whether that arm applies. Rust tests a guard during PATTERN MATCHING — after the arm's pattern has matched and before the arm is chosen, going on to the next arm when it is false — so the change lands whenever this arm is merely TESTED, whether or not it is then chosen, and never once an earlier arm has matched. And `&&` can skip it, so it does not happen at all whenever what decides first already answers the guard. The accounting therefore depends on evaluation order and on how many arms the subject was tested against, not on any statement a reader can point at: a counter kept this way misses exactly the path the deciding operand rules out, so it cannot reach a limit it is checked against on that path. Move the change out of the guard — leave it reading only (`if feature + 1 >= limit`) and put the assignment in the arm's BODY, where it runs precisely when the arm is chosen, or hoist it above the `match` if it must happen for every subject. — crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:374

What to do

  • Each finding names the mutation inside the `case` label or `when` guard and the short-circuiting operator that decides whether it happens at all. Confirm from the two, then move the change out of the label: a JavaScript or PHP `case` expression, a PHP `match` arm's conditions, a Java `when` guard, a Kotlin `when` branch's conditions, a Ruby `when` clause or `in … if` guard, a Python `case … if` guard, a Dart `when` guard, a Rust `match` guard and a Scala `case … if` guard are evaluated while the switch is still MATCHING — on labels that are then not selected, and not at all once an earlier label has matched or an operand to its left has answered. Leave the label reading only and put the increment in the arm's BODY, where it runs exactly when the arm is chosen, or hoist it above the switch if it must happen on every subject.
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.

X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.

Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.

X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health81%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture93%ExemplarySolid.
Maturity68%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness72%StrongSolid.
Security70%Checked 5 of 11Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Event Sourcing100%ExemplaryStrongest area.
Performance60%AdequateLargest drag on the score — prioritise here.
Unscored — 3 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X6 Hand-rolled structured-format parsing — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 64 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AXB1 Runtime evidence locked — no reproducible boot — This repository has nothing the runtime tiers could boot or serve — no markup, no UI framework or web-server dependency, no UI component source, no native UI project and no API definition — nothing here is a surface to boot — so runtime a11y/egress/header evidence has no subject here. Not applicable: this is neither a gap in the scan nor a finding about your code.
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D10 Test Quality — ~240288 lines of test source are present (.rs, .py) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included — the .py suite was found but not re-run
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D21 Naming Consistency — D21 withholds its case and prefix conventions rows: 5 candidate(s) found and not reported.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .py, .rs, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — Rust suite
  • DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 305 value object(s); 1 domain event(s); its domain events are published by services or handlers — no domain entity raises one
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the Python, Rust source, so there is no service whose uptime a failing dependency could take down
  • P8 Schema migrations — SQLAlchemy is declared, but the schema-migration mechanism could not be identified. Our limit, not a verdict on this repository.
  • P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `#[bench]`, criterion's `bench_function`/`bench_with_input`, `#[divan::bench]` or `#[library_benchmark]` in any `.rs` file, or criterion, divan, iai or a `[[bench]]` target in a Cargo.toml, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • X12 Unreachable branch — X12 reached only 20% of this repository's production lines — rust (467,892 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X17 Uncapped recursion over a caller-supplied document — X17 reached only 20% of this repository's production lines — rust (467,892 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X18 Disposal-pattern correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X19 Unrestored process-global state — X19 reached only 20% of this repository's production lines — rust (467,892 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X2 Cancellation propagation — no C# was loaded; this repository's Python and Rust were read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation; a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — X23 reached only 20% of this repository's production lines — rust (467,892 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X24 Document value interpolated into markup unescaped — X24 reached only 20% of this repository's production lines — rust (467,892 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X25 Inert configuration knob — X25 reached only 20% of this repository's production lines — rust (467,892 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X3 Exception handling — X3 reached only 20% of this repository's production lines — rust (467,892 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Rust was read, and it logs through none: the `log` crate's macros take one finished message (as log4net does in C#; its `kv` values are an opt-in its backends mostly drop), `println!`/`eprintln!` are not loggers, or it makes no log call outside its tests and examples at all. Calls through `tracing` (`tracing::info!`, or `info!` imported from it) would be judged.
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 187 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 94 more in this group — see findings.md.
D35 · Change Coupling · Boundary-crossing change coupling · ×32
  • Boundary-crossing change coupling: mod.rs ↔ array.py crates/polars-ops/src/chunked_array/array/mod.rs:1 — `crates/polars-ops/src/chunked_array/array/mod.rs` (context crates) and `py-polars/src/polars/expr/array.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 91% of the time (10 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `d14231ad` feat: Support integer fixed-array dot products (#28829); `60cb846f` feat: Add native fixed-array dot (#28504); `0de37a89` feat: Introduce `arr.to_struct` (#14202) (at that commit the file was still `py-polars/polars/expr/array.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: array.rs ↔ array.py crates/polars-python/src/expr/array.rs:1 — `crates/polars-python/src/expr/array.rs` (context crates) and `py-polars/src/polars/expr/array.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 89% of the time (25 of the 28 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 25 shared commits counted here, the most recent 3 are `60cb846f` feat: Add native fixed-array dot (#28504); `ff62eb51` perf: Dispatch `{list,arr}.{unique,n_unique,reverse}` to group_by eng…; `aa6f6ec5` feat: Add `arr.eval` (#24472) — run `git show` on any of them.
  • Boundary-crossing change coupling: list.rs ↔ list.py crates/polars-python/src/expr/list.rs:1 — `crates/polars-python/src/expr/list.rs` (context crates) and `py-polars/src/polars/expr/list.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 85% of the time (23 of the 27 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 23 shared commits counted here, the most recent 3 are `3bba9f11` refactor: Re-work `shuffle` parameter for `sample()` (#27460); `ff62eb51` perf: Dispatch `{list,arr}.{unique,n_unique,reverse}` to group_by eng…; `fa9f3fe6` feat: Implemented `list.filter` (#22749) (at that commit the file was still `py-polars/polars/expr/list.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: array.rs ↔ array.py crates/polars-python/src/expr/array.rs:1 — `crates/polars-python/src/expr/array.rs` (context crates) and `py-polars/src/polars/series/array.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 82% of the time (23 of the 28 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 23 shared commits counted here, the most recent 3 are `60cb846f` feat: Add native fixed-array dot (#28504); `aa6f6ec5` feat: Add `arr.eval` (#24472); `fec73de7` feat: Add `arr.slice`, `arr.head` and `arr.tail` methods to `arr` nam… (at that commit the file was still `py-polars/polars/series/array.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: array.rs ↔ array.py crates/polars-plan/src/dsl/function_expr/array.rs:1 — `crates/polars-plan/src/dsl/function_expr/array.rs` (context crates) and `py-polars/src/polars/expr/array.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 81% of the time (22 of the 27 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 22 shared commits counted here, the most recent 3 are `60cb846f` feat: Add native fixed-array dot (#28504); `ff62eb51` perf: Dispatch `{list,arr}.{unique,n_unique,reverse}` to group_by eng…; `566d3886` feat: Implement mean function in `arr` namespace (#23486) (at that commit the file was still `py-polars/polars/expr/array.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: list.rs ↔ list.py crates/polars-python/src/expr/list.rs:1 — `crates/polars-python/src/expr/list.rs` (context crates) and `py-polars/src/polars/series/list.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 81% of the time (22 of the 27 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 22 shared commits counted here, the most recent 3 are `3bba9f11` refactor: Re-work `shuffle` parameter for `sample()` (#27460); `fa9f3fe6` feat: Implemented `list.filter` (#22749) (at that commit the file was still `py-polars/polars/series/list.py`); `47e6c9bb` feat: Add `nulls_equal` flag to `list/arr.contains` (#22773) (at that commit the file was still `py-polars/polars/series/list.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: array.rs ↔ array.py crates/polars-plan/src/dsl/array.rs:1 — `crates/polars-plan/src/dsl/array.rs` (context crates) and `py-polars/src/polars/expr/array.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 81% of the time (26 of the 32 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 26 shared commits counted here, the most recent 3 are `d14231ad` feat: Support integer fixed-array dot products (#28829); `60cb846f` feat: Add native fixed-array dot (#28504); `7cb1174e` docs: Document that arg_extremum functions return any index on ties (… — run `git show` on any of them.
  • Boundary-crossing change coupling: string.rs ↔ string.py crates/polars-python/src/expr/string.rs:1 — `crates/polars-python/src/expr/string.rs` (context crates) and `py-polars/src/polars/expr/string.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 78% of the time (40 of the 51 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 40 shared commits counted here, the most recent 3 are `16b69e77` feat: Support regex in `str.split` (#26060); `3e2413c0` feat: Add leftmost option to `str.replace_many / str.find_many / str.…; `b6687128` feat: Add dtype to str.to_integer() (#22239) (at that commit the file was still `py-polars/polars/expr/string.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: meta.rs ↔ meta.py crates/polars-python/src/expr/meta.rs:1 — `crates/polars-python/src/expr/meta.rs` (context crates) and `py-polars/src/polars/expr/meta.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 78% of the time (14 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `49dff65a` feat: Add `schema` parameter to `Expr.meta` properties (#30613); `5de4805c` feat: Add more expression properties to `meta` namespace (#28091); `1af179ab` refactor: Add schema parameters to `expr.meta` (#22906) (at that commit the file was still `py-polars/polars/expr/meta.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: array.rs ↔ array.py crates/polars-plan/src/dsl/function_expr/array.rs:1 — `crates/polars-plan/src/dsl/function_expr/array.rs` (context crates) and `py-polars/src/polars/series/array.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 74% of the time (20 of the 27 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 20 shared commits counted here, the most recent 3 are `60cb846f` feat: Add native fixed-array dot (#28504); `fec73de7` feat: Add `arr.slice`, `arr.head` and `arr.tail` methods to `arr` nam… (at that commit the file was still `py-polars/polars/series/array.py`); `47e6c9bb` feat: Add `nulls_equal` flag to `list/arr.contains` (#22773) (at that commit the file was still `py-polars/polars/series/array.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: dt.rs ↔ datetime.py crates/polars-plan/src/dsl/dt.rs:1 — `crates/polars-plan/src/dsl/dt.rs` (context crates) and `py-polars/src/polars/series/datetime.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 71% of the time (17 of the 24 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 17 shared commits counted here, the most recent 3 are `9e7b2c92` chore: Remove a couple of deprecated methods (#28700); `f380d60b` feat: Support Expr for holidays in business day calculations (#26193); `785ea307` feat: Add support to output `dt.total_{}()` duration values as fracti… (at that commit the file was still `py-polars/polars/series/datetime.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: dt.rs ↔ datetime.py crates/polars-plan/src/dsl/dt.rs:1 — `crates/polars-plan/src/dsl/dt.rs` (context crates) and `py-polars/src/polars/expr/datetime.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 71% of the time (17 of the 24 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 17 shared commits counted here, the most recent 3 are `9e7b2c92` chore: Remove a couple of deprecated methods (#28700); `f380d60b` feat: Support Expr for holidays in business day calculations (#26193); `785ea307` feat: Add support to output `dt.total_{}()` duration values as fracti… (at that commit the file was still `py-polars/polars/expr/datetime.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: string.rs ↔ string.py crates/polars-python/src/expr/string.rs:1 — `crates/polars-python/src/expr/string.rs` (context crates) and `py-polars/src/polars/series/string.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 71% of the time (36 of the 51 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 36 shared commits counted here, the most recent 3 are `3e2413c0` feat: Add leftmost option to `str.replace_many / str.find_many / str.…; `b6687128` feat: Add dtype to str.to_integer() (#22239) (at that commit the file was still `py-polars/polars/series/string.py`); `db5c866e` feat: Allow expression input for `length` parameter in `pad_start`, `… (at that commit the file was still `py-polars/polars/series/string.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: binary.rs ↔ binary.py crates/polars-plan/src/dsl/binary.rs:1 — `crates/polars-plan/src/dsl/binary.rs` (context crates) and `py-polars/src/polars/expr/binary.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `35b2edf2` feat: Add get() to retrieve a byte from binary data (#26454); `7919df6b` feat(rust,python): Add `bin.slice()`, `bin.head()`, and `bin.tail()` …; `50e44a29` refactor: Rename from_buffer()/FromBuffer to reinterpret()/Reinterpre… (at that commit the file was still `py-polars/polars/expr/binary.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: binary.rs ↔ binary.py crates/polars-plan/src/dsl/function_expr/binary.rs:1 — `crates/polars-plan/src/dsl/function_expr/binary.rs` (context crates) and `py-polars/src/polars/expr/binary.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `35b2edf2` feat: Add get() to retrieve a byte from binary data (#26454); `7919df6b` feat(rust,python): Add `bin.slice()`, `bin.head()`, and `bin.tail()` …; `5d429ea8` feat: Reinterpret binary data to fixed size numerical array (#22840) (at that commit the file was still `py-polars/polars/expr/binary.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: string.rs ↔ string.py crates/polars-plan/src/dsl/string.rs:1 — `crates/polars-plan/src/dsl/string.rs` (context crates) and `py-polars/src/polars/expr/string.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 66% of the time (37 of the 56 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 37 shared commits counted here, the most recent 3 are `16b69e77` feat: Support regex in `str.split` (#26060); `3e2413c0` feat: Add leftmost option to `str.replace_many / str.find_many / str.…; `b6687128` feat: Add dtype to str.to_integer() (#22239) (at that commit the file was still `py-polars/polars/expr/string.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: sink.rs ↔ partition.py crates/polars-python/src/lazyframe/sink.rs:1 — `crates/polars-python/src/lazyframe/sink.rs` (context crates) and `py-polars/src/polars/io/partition.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `2273b001` refactor: Update partitioned sink IR (#25524); `22f9dc5f` refactor: Simplify sink parameter passing from Python (#25302); `5993d953` feat: Add per partition sort and finish callback to sinks (#22789) (at that commit the file was still `py-polars/polars/io/partition.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: expand_datasets.rs ↔ _options.py crates/polars-plan/src/plans/optimizer/expand_datasets.rs:1 — `crates/polars-plan/src/plans/optimizer/expand_datasets.rs` (context crates) and `py-polars/src/polars/io/scan_options/_options.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `bdbf3bf2` feat: Answer min, max and counts over an Iceberg scan from manifest s…; `eb8db318` fix: Load Delta partition values from the log in `scan_delta` (#30052); `fe841f95` perf: Prepare Parquet scans for row-group splitting in Polars Cloud (… — run `git show` on any of them.
  • Boundary-crossing change coupling: boolean.rs ↔ expr.py crates/polars-plan/src/dsl/function_expr/boolean.rs:1 — `crates/polars-plan/src/dsl/function_expr/boolean.rs` (context crates) and `py-polars/src/polars/expr/expr.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 56% of the time (10 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `9472f7d9` feat: Add `Expr.is_sorted` (#26708); `447664f9` feat: Add Rust backend for Expr.has_nulls (#27590); `40278608` feat: Add `is_close` method (#23273) (at that commit the file was still `py-polars/polars/expr/expr.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: strings.rs ↔ string.py crates/polars-plan/src/dsl/function_expr/strings.rs:1 — `crates/polars-plan/src/dsl/function_expr/strings.rs` (context crates) and `py-polars/src/polars/expr/string.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 55% of the time (43 of the 78 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 43 shared commits counted here, the most recent 3 are `16b69e77` feat: Support regex in `str.split` (#26060); `3e2413c0` feat: Add leftmost option to `str.replace_many / str.find_many / str.…; `b6687128` feat: Add dtype to str.to_integer() (#22239) (at that commit the file was still `py-polars/polars/expr/string.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: streaming.rs ↔ functions.py crates/polars-io/src/csv/read/streaming.rs:1 — `crates/polars-io/src/csv/read/streaming.rs` (context crates) and `py-polars/src/polars/io/csv/functions.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `98d2afff` feat(python!): Dispatch read_csv to scan_csv (#28413); `3a780c26` feat!: Respect file column order when schema is given for `scan_csv()…; `c6e05d16` fix: Resolve CSV column names overwrite in DSL->IR conversion (#28383) — run `git show` on any of them.
  • Boundary-crossing change coupling: rolling.rs ↔ expr.py crates/polars-plan/src/dsl/function_expr/rolling.rs:1 — `crates/polars-plan/src/dsl/function_expr/rolling.rs` (context crates) and `py-polars/src/polars/expr/expr.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `ef1275f7` feat: Make `rolling_map` serializable (#23848) (at that commit the file was still `py-polars/polars/expr/expr.py`); `35808295` feat: Add `rolling_kurtosis` (#22335) (at that commit the file was still `py-polars/polars/expr/expr.py`); `beebada8` perf: Dedicated `rolling_skew` kernel (#22333) (at that commit the file was still `py-polars/polars/expr/expr.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: lower_ir.rs ↔ partition.py crates/polars-stream/src/physical_plan/lower_ir.rs:1 — `crates/polars-stream/src/physical_plan/lower_ir.rs` (context crates) and `py-polars/src/polars/io/partition.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `2273b001` refactor: Update partitioned sink IR (#25524); `5993d953` feat: Add per partition sort and finish callback to sinks (#22789) (at that commit the file was still `py-polars/polars/io/partition.py`); `ebe03be7` feat: Allow sinking to abstract python `io` and `fs` classes (#21987) (at that commit the file was still `py-polars/polars/io/partition.py`) — run `git show` on any of them.
  • Boundary-crossing change coupling: list.rs ↔ list.py crates/polars-plan/src/dsl/list.rs:1 — `crates/polars-plan/src/dsl/list.rs` (context crates) and `py-polars/src/polars/expr/list.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 52% of the time (21 of the 40 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 21 shared commits counted here, the most recent 3 are `7cb1174e` docs: Document that arg_extremum functions return any index on ties (…; `3bba9f11` refactor: Re-work `shuffle` parameter for `sample()` (#27460); `ff62eb51` perf: Dispatch `{list,arr}.{unique,n_unique,reverse}` to group_by eng… — run `git show` on any of them.
  • Boundary-crossing change coupling: boolean.rs ↔ series.py crates/polars-plan/src/dsl/function_expr/boolean.rs:1 — `crates/polars-plan/src/dsl/function_expr/boolean.rs` (context crates) and `py-polars/src/polars/series/series.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 50% of the time (9 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `40278608` feat: Add `is_close` method (#23273) (at that commit the file was still `py-polars/polars/series/series.py`); `4e4d259d` feat: Add 'nulls_equal' parameter to `is_in` (#21426) (at that commit the file was still `py-polars/polars/series/series.py`); `7b6f9275` feat: add integer negation (#14049) (at that commit the file was still `py-polars/polars/series/series.py`) — run `git show` on any of them.
  • + 7 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×1
  • Orphaned knowledge crates/polars-parquet/src/parquet/handwritten_thrift/parquet_macros.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Serious — 3776 finding(s)
D17 · Explicit Debt · TodoComment · ×349
  • TodoComment pyo3-polars/pyo3-polars/src/lib.rs:17 — //! todo!() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/streaming/test_streaming_unique.py:46 — # TODO: Re-enable this check when this issue is fixed: https://github.com/pola-rs/polars/issues/10466
  • TodoComment py-polars/tests/unit/sql/test_literals.py:149 — # TODO: negative intervals — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/sql/test_strings.py:18 — # TODO: Do not rely on I/O for these tests — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/series/test_series.py:1474 — # TODO: do we want this to work? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/series/test_series.py:2392 — # TODO: time arithmetic support? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/test_rolling.py:69 — # TODO: This test requires the environment variable to be set prior to starting — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/test_rolling.py:94 — # TODO: This test requires the environment variable to be set prior to starting — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/test_rolling.py:77 — # assert pl.thread_pool_size() == 1 # pending resolution, see TODO — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/test_rolling.py:102 — # assert pl.thread_pool_size() == 1 # pending resolution, see TODO — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/namespaces/string/test_string.py:2330 — # TODO: There should be a `columns=` parameter to this. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/io/test_json.py:837 — # TODO: There should be a `columns=` parameter to this. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/namespaces/array/test_array.py:636 — # TODO: there is a bug in list.slice that does not allow negative values for head — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/arithmetic/test_array.py:267 — # TODO: We get an error on non-lists with this: — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/arithmetic/test_list.py:272 — # TODO: We get an error on non-lists with this: — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/arithmetic/test_list.py:483 — # TODO: Make the error type consistently a ShapeError — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/arithmetic/test_list.py:512 — # TODO(_): Ideally this always raises InvalidOperationError. The TypeError — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/operations/aggregation/test_aggregations.py:1580 — # TODO: Remove this exception when #24509 is resolved
  • TodoComment py-polars/tests/unit/operations/aggregation/test_aggregations.py:1660 — # TODO: polars/#24936
  • TodoComment py-polars/tests/unit/operations/aggregation/test_aggregations.py:1696 — # TODO: polars/#24936
  • TodoComment py-polars/tests/unit/lazyframe/test_schema.py:151 — # TODO: Add more (bitwise) operators once their types are resolved correctly — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/io/test_delta.py:978 — # TODO: uncomment dtype when fixed — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/io/test_delta_deletion_vector.py:280 — # TODO: expand logic and test case to cover tight_bounds=True; this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/io/test_delta_deletion_vector.py:629 — # TODO: known issue: no message is printed when the resulting df is empty — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment py-polars/tests/unit/io/test_multiscan.py:376 — # (pl.scan_parquet, pl.DataFrame.write_parquet, "parquet"), # TODO: _ — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 324 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×162
  • FileTooLong: REDACTED REDACTED — FileTooLong — 6497 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 72% of them inside a single declaration: SQLContext (5 blocks, 316-6986), declaring 83 free functions. The bar is 500 significant lines; this is 5997 over it, 12.99× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: series/series.py py-polars/src/polars/series/series.py — FileTooLong — 5250 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4750 over it, 10.50× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: dataframe/frame.py py-polars/src/polars/dataframe/frame.py — FileTooLong — 4493 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3993 over it, 8.99× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: lazyframe/frame.py py-polars/src/polars/lazyframe/frame.py — FileTooLong — 3467 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2967 over it, 6.93× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/subquery.rs crates/polars-sql/src/subquery.rs — FileTooLong — 3320 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 53 free functions. The bar is 500 significant lines; this is 2820 over it, 6.64× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: physical_plan/lower_expr.rs crates/polars-stream/src/physical_plan/lower_expr.rs — FileTooLong — 2438 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1938 over it, 4.88× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: polars/selectors.py py-polars/src/polars/selectors.py — FileTooLong — 2258 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1758 over it, 4.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/functions.rs crates/polars-sql/src/functions.rs — FileTooLong — 2027 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 65% of them inside a single declaration: SQLFunctionVisitor (2 blocks, 46-3369). The bar is 500 significant lines; this is 1527 over it, 4.05× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/sql_expr.rs crates/polars-sql/src/sql_expr.rs — FileTooLong — 1898 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 63% of them inside a single declaration: SQLExprVisitor (2 blocks, 187-2162), declaring 49 free functions. The bar is 500 significant lines; this is 1398 over it, 3.80× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: visitor/expr_nodes.rs crates/polars-python/src/lazyframe/visitor/expr_nodes.rs — FileTooLong — 1874 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1374 over it, 3.75× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: projection_pushdown/mod.rs crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs — FileTooLong — 1853 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 83% of them inside a single declaration: ProjectionPushdownVisitor (3 blocks, 143-2554). The bar is 500 significant lines; this is 1353 over it, 3.71× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: sql/context.py py-polars/src/polars/sql/context.py — FileTooLong — 1814 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1314 over it, 3.63× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: physical_plan/lower_ir.rs crates/polars-stream/src/physical_plan/lower_ir.rs — FileTooLong — 1788 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1288 over it, 3.58× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: physical_plan/to_graph.rs crates/polars-stream/src/physical_plan/to_graph.rs — FileTooLong — 1649 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1149 over it, 3.30× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: conversion/mod.rs crates/polars-python/src/conversion/mod.rs — FileTooLong — 1538 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 82% of them inside a single declaration: Wrap (68 blocks, 73-2284). The bar is 500 significant lines; this is 1038 over it, 3.08× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: dsl_to_ir/scans.rs crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs — FileTooLong — 1503 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1003 over it, 3.01× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: iceberg/_sink.py py-polars/src/polars/io/iceberg/_sink.py — FileTooLong — 1441 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 941 over it, 2.88× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: dsl_to_ir/mod.rs crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs — FileTooLong — 1406 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 906 over it, 2.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: datatypes/dtype.rs crates/polars-core/src/datatypes/dtype.rs — FileTooLong — 1392 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 83% of them inside a single declaration: DataType (9 blocks, 90-2029). The bar is 500 significant lines; this is 892 over it, 2.78× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: lazyframe/general.rs crates/polars-python/src/lazyframe/general.rs — FileTooLong — 1390 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 91% of them inside a single declaration: PyLazyFrame (92-1724). The bar is 500 significant lines; this is 890 over it, 2.78× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: physical_plan/lower_group_by.rs crates/polars-stream/src/physical_plan/lower_group_by.rs — FileTooLong — 1352 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 852 over it, 2.70× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: frame/mod.rs crates/polars-lazy/src/frame/mod.rs — FileTooLong — 1324 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 74% of them inside a single declaration: LazyFrame (5 blocks, 77-2002). The bar is 500 significant lines; this is 824 over it, 2.65× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: function_expr/mod.rs crates/polars-plan/src/plans/aexpr/function_expr/mod.rs — FileTooLong — 1313 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 89% of them inside a single declaration: IRFunctionExpr (5 blocks, 113-1555). The bar is 500 significant lines; this is 813 over it, 2.63× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: frame/mod.rs crates/polars-core/src/frame/mod.rs — FileTooLong — 1280 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 86% of them inside a single declaration: DataFrame (90-2665). The bar is 500 significant lines; this is 780 over it, 2.56× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: type_coercion/mod.rs crates/polars-plan/src/plans/conversion/type_coercion/mod.rs — FileTooLong — 1247 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 72% of them inside a single declaration: TypeCoercionRule (2 blocks, 40-1321). The bar is 500 significant lines; this is 747 over it, 2.49× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • + 137 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×153
  • Hotspot: crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:16 — crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 424 in polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions at line 16. 6 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-python/src/lazyframe/visitor/expr_nodes.rs crates/polars-python/src/lazyframe/visitor/expr_nodes.rs:860 — crates/polars-python/src/lazyframe/visitor/expr_nodes.rs changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 421 in polars_python::lazyframe::visitor::expr_nodes::into_py at line 860. 5 of those changes were fix/bug commits, and the other 24 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-python/src/lazyframe/visitor/expr_nodes.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-sql/src/functions.rs crates/polars-sql/src/functions.rs:1442 — crates/polars-sql/src/functions.rs changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 236 in SQLFunctionVisitor::visit_function at line 1442. 17 of those changes were fix/bug commits, and the other 21 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-sql/src/functions.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-plan/src/plans/conversion/ir_to_dsl.rs crates/polars-plan/src/plans/conversion/ir_to_dsl.rs:340 — crates/polars-plan/src/plans/conversion/ir_to_dsl.rs changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 369 in polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl at line 340. 3 of those changes were fix/bug commits, and the other 21 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/conversion/ir_to_dsl.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-stream/src/physical_plan/lower_ir.rs crates/polars-stream/src/physical_plan/lower_ir.rs:279 — crates/polars-stream/src/physical_plan/lower_ir.rs changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 156 in polars_stream::physical_plan::lower_ir::lower_ir_inner at line 279. 1 of those changes was a fix/bug commit, and the other 43 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-stream/src/physical_plan/lower_ir.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:3575 — REDACTED changed 100 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 65 in SQLContext::execute_select_block at line 3575. 39 of those changes were fix/bug commits, and the other 61 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-plan/src/plans/aexpr/function_expr/schema.rs crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:9 — crates/polars-plan/src/plans/aexpr/function_expr/schema.rs changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 197 in IRFunctionExpr::get_field at line 9. 13 of those changes were fix/bug commits, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/aexpr/function_expr/schema.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:235 — crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 266 in ProjectionPushdownVisitor::pushdown at line 235. 8 of those changes were fix/bug commits, and the other 15 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-stream/src/physical_plan/lower_expr.rs crates/polars-stream/src/physical_plan/lower_expr.rs:556 — crates/polars-stream/src/physical_plan/lower_expr.rs changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 115 in polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx at line 556. 6 of those changes were fix/bug commits, and the other 34 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-stream/src/physical_plan/lower_expr.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:194 — crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 139 in polars_plan::plans::conversion::dsl_to_ir::to_alp_impl at line 194. 5 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-sql/src/sql_expr.rs crates/polars-sql/src/sql_expr.rs:1123 — crates/polars-sql/src/sql_expr.rs changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in SQLExprVisitor::visit_binary_op at line 1123. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-sql/src/sql_expr.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-stream/src/physical_plan/to_graph.rs crates/polars-stream/src/physical_plan/to_graph.rs:137 — crates/polars-stream/src/physical_plan/to_graph.rs changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in polars_stream::physical_plan::to_graph::to_graph_rec at line 137. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-stream/src/physical_plan/to_graph.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-stream/src/physical_plan/fmt.rs crates/polars-stream/src/physical_plan/fmt.rs:181 — crates/polars-stream/src/physical_plan/fmt.rs changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 127 in polars_stream::physical_plan::fmt::visualize_plan_rec at line 181. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-stream/src/physical_plan/fmt.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-expr/src/dispatch/mod.rs crates/polars-expr/src/dispatch/mod.rs:147 — crates/polars-expr/src/dispatch/mod.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 144 in polars_expr::dispatch::function_expr_to_udf at line 147. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-expr/src/dispatch/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-plan/src/plans/aexpr/function_expr/mod.rs crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:877 — crates/polars-plan/src/plans/aexpr/function_expr/mod.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 128 in IRFunctionExpr::fmt_name at line 877. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/aexpr/function_expr/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-plan/src/plans/conversion/type_coercion/mod.rs crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:133 — crates/polars-plan/src/plans/conversion/type_coercion/mod.rs changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 124 in TypeCoercionRule::optimize_expr at line 133. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/conversion/type_coercion/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-compute/src/cast/mod.rs crates/polars-compute/src/cast/mod.rs:400 — crates/polars-compute/src/cast/mod.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 317 in polars_compute::cast::cast at line 400. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-compute/src/cast/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-sql/src/subquery.rs crates/polars-sql/src/subquery.rs:1253 — crates/polars-sql/src/subquery.rs changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in SQLContext::try_attach_join_membership at line 1253. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-sql/src/subquery.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-plan/src/dsl/function_expr/mod.rs crates/polars-plan/src/dsl/function_expr/mod.rs:856 — crates/polars-plan/src/dsl/function_expr/mod.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 129 in FunctionExpr::fmt at line 856. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/dsl/function_expr/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-stream/src/physical_plan/to_description.rs crates/polars-stream/src/physical_plan/to_description.rs:67 — crates/polars-stream/src/physical_plan/to_description.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 81 in polars_stream::physical_plan::to_description::phys_props at line 67. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-stream/src/physical_plan/to_description.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-core/src/utils/supertype.rs crates/polars-core/src/utils/supertype.rs:149 — crates/polars-core/src/utils/supertype.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 179 in polars_core::utils::supertype::get_supertype_with_options at line 149. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-core/src/utils/supertype.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-plan/src/plans/aexpr/schema.rs crates/polars-plan/src/plans/aexpr/schema.rs:52 — crates/polars-plan/src/plans/aexpr/schema.rs changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 65 in AExpr::to_field_impl_inner at line 52. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/aexpr/schema.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-stream/src/physical_plan/mod.rs crates/polars-stream/src/physical_plan/mod.rs:662 — crates/polars-stream/src/physical_plan/mod.rs changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 58 in polars_stream::physical_plan::_visit_nodes_impl at line 662. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-stream/src/physical_plan/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs:124 — crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 118 in SimplifyIRNodeOrder::simplify_ir_node_orders at line 124. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: py-polars/src/polars/io/iceberg/_dataset.py py-polars/src/polars/io/iceberg/_dataset.py:410 — py-polars/src/polars/io/iceberg/_dataset.py changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 88 in IcebergScanResolver._to_dataset_scan_impl at line 410. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- py-polars/src/polars/io/iceberg/_dataset.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 128 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×130
  • MethodTooLong: ProjectionPushdownVisitor.pushdown crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:235 — MethodTooLong — pushdown runs 1483 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1383 over it, 14.83× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TypeCoercionRule.optimize_expr crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:133 — MethodTooLong — optimize_expr runs 881 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 781 over it, 8.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SlicePushDown.pushdown crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:225 — MethodTooLong — pushdown runs 581 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 481 over it, 5.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SQLFunctionVisitor.visit_function crates/polars-sql/src/functions.rs:1442 — MethodTooLong — visit_function runs 529 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 429 over it, 5.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: IRFunctionExpr.get_field crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:9 — MethodTooLong — get_field runs 520 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 420 over it, 5.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SQLContext.execute_select_block REDACTED:3575 — MethodTooLong — execute_select_block runs 400 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 300 over it, 4.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ExprOrderSimplifier.rec crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:156 — MethodTooLong — rec runs 398 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 298 over it, 3.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: IR.is_ir_equal_shallow crates/polars-plan/src/plans/ir/equality.rs:26 — MethodTooLong — is_ir_equal_shallow runs 394 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 294 over it, 3.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PredicatePushDown.push_down crates/polars-plan/src/plans/optimizer/predicate_pushdown/mod.rs:254 — MethodTooLong — push_down runs 390 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 290 over it, 3.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: IpcFileReader.begin_read crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:205 — MethodTooLong — begin_read runs 378 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 278 over it, 3.78× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SelectionWalker.walk_rec crates/polars-plan/src/plans/optimizer/projection_pushdown/field_pruning.rs:190 — MethodTooLong — walk_rec runs 368 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 268 over it, 3.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SimplifyIRNodeOrder.simplify_ir_node_orders crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs:124 — MethodTooLong — simplify_ir_node_orders runs 342 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 242 over it, 3.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SQLContext.process_group_by REDACTED:6271 — MethodTooLong — process_group_by runs 329 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 229 over it, 3.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: IRFunctionExpr.hash crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:483 — MethodTooLong — hash runs 328 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 228 over it, 3.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: FunctionExpr.hash crates/polars-plan/src/dsl/function_expr/mod.rs:499 — MethodTooLong — hash runs 323 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 223 over it, 3.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Series._try_from_arrow_unchecked_with_md crates/polars-core/src/series/from.rs:201 — MethodTooLong — _try_from_arrow_unchecked_with_md runs 314 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 214 over it, 3.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SimplifyExprRule.optimize_expr crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:763 — MethodTooLong — optimize_expr runs 306 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 206 over it, 3.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AExpr.to_field_impl_inner crates/polars-plan/src/plans/aexpr/schema.rs:52 — MethodTooLong — to_field_impl_inner runs 287 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 187 over it, 2.87× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SQLContext.lateral_join crates/polars-sql/src/lateral.rs:385 — MethodTooLong — lateral_join runs 280 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 180 over it, 2.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: NDJsonFileReader.begin_read crates/polars-stream/src/nodes/io_sources/ndjson/mod.rs:90 — MethodTooLong — begin_read runs 280 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 180 over it, 2.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ExprIRDisplay.fmt crates/polars-plan/src/plans/ir/format.rs:478 — MethodTooLong — fmt runs 276 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 176 over it, 2.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: IRDotDisplay._format crates/polars-plan/src/plans/ir/dot.rs:76 — MethodTooLong — _format runs 271 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 171 over it, 2.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: IRFunctionExpr.function_options crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1245 — MethodTooLong — function_options runs 266 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 166 over it, 2.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: DataFrameJoinOps._join_impl crates/polars-ops/src/frame/join/mod.rs:132 — MethodTooLong — _join_impl runs 265 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 165 over it, 2.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ColumnSelectorBuilder.attach_transforms crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/builder.rs:50 — MethodTooLong — attach_transforms runs 263 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 163 over it, 2.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 105 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×116
  • FunctionTooLong: polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx crates/polars-stream/src/physical_plan/lower_expr.rs:556 — FunctionTooLong — polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx runs 1681 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1581 over it, 16.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_stream::physical_plan::to_graph::to_graph_rec crates/polars-stream/src/physical_plan/to_graph.rs:137 — FunctionTooLong — polars_stream::physical_plan::to_graph::to_graph_rec runs 1540 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1440 over it, 15.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_stream::physical_plan::lower_ir::lower_ir_inner crates/polars-stream/src/physical_plan/lower_ir.rs:279 — FunctionTooLong — polars_stream::physical_plan::lower_ir::lower_ir_inner runs 1415 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1315 over it, 14.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:16 — FunctionTooLong — polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions runs 1216 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1116 over it, 12.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_python::lazyframe::visitor::expr_nodes::into_py crates/polars-python/src/lazyframe/visitor/expr_nodes.rs:860 — FunctionTooLong — polars_python::lazyframe::visitor::expr_nodes::into_py runs 1209 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1109 over it, 12.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_plan::plans::conversion::dsl_to_ir::to_alp_impl crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:194 — FunctionTooLong — polars_plan::plans::conversion::dsl_to_ir::to_alp_impl runs 1103 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1003 over it, 11.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl crates/polars-plan/src/plans/conversion/ir_to_dsl.rs:340 — FunctionTooLong — polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl runs 882 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 782 over it, 8.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_stream::physical_plan::to_description::phys_props crates/polars-stream/src/physical_plan/to_description.rs:67 — FunctionTooLong — polars_stream::physical_plan::to_description::phys_props runs 770 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 670 over it, 7.70× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_stream::physical_plan::fmt::visualize_plan_rec crates/polars-stream/src/physical_plan/fmt.rs:181 — FunctionTooLong — polars_stream::physical_plan::fmt::visualize_plan_rec runs 691 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 591 over it, 6.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec_inner crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:275 — FunctionTooLong — polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec_inner runs 592 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 492 over it, 5.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_compute::cast::cast crates/polars-compute/src/cast/mod.rs:400 — FunctionTooLong — polars_compute::cast::cast runs 556 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 456 over it, 5.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_parquet::arrow::read::deserialize::simple::page_iter_to_array crates/polars-parquet/src/arrow/read/deserialize/simple.rs:31 — FunctionTooLong — polars_parquet::arrow::read::deserialize::simple::page_iter_to_array runs 492 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 392 over it, 4.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_plan::plans::optimizer::predicate_pushdown::join::predicate_pruning::try_rewrite_join_type crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:624 — FunctionTooLong — polars_plan::plans::optimizer::predicate_pushdown::join::predicate_pruning::try_rewrite_join_type runs 446 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 346 over it, 4.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_expr::dispatch::function_expr_to_udf crates/polars-expr/src/dispatch/mod.rs:147 — FunctionTooLong — polars_expr::dispatch::function_expr_to_udf runs 405 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 305 over it, 4.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_python::lazyframe::visitor::nodes::into_py crates/polars-python/src/lazyframe/visitor/nodes.rs:538 — FunctionTooLong — polars_python::lazyframe::visitor::nodes::into_py runs 403 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 303 over it, 4.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_expr::planner::create_physical_expr_inner crates/polars-expr/src/planner.rs:248 — FunctionTooLong — polars_expr::planner::create_physical_expr_inner runs 398 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 298 over it, 3.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl_inner crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_to_ir.rs:124 — FunctionTooLong — polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl_inner runs 396 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 296 over it, 3.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_plan::plans::to_description::ir_props crates/polars-plan/src/plans/to_description.rs:62 — FunctionTooLong — polars_plan::plans::to_description::ir_props runs 395 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 295 over it, 3.95× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_plan::plans::optimizer::predicate_pushdown::join::process_join crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/mod.rs:16 — FunctionTooLong — polars_plan::plans::optimizer::predicate_pushdown::join::process_join runs 384 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 284 over it, 3.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_plan::plans::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec crates/polars-plan/src/plans/aexpr/predicates/skip_batches.rs:336 — FunctionTooLong — polars_plan::plans::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec runs 378 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 278 over it, 3.78× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_stream::physical_plan::lower_group_by::try_lower_elementwise_scalar_agg_expr crates/polars-stream/src/physical_plan/lower_group_by.rs:263 — FunctionTooLong — polars_stream::physical_plan::lower_group_by::try_lower_elementwise_scalar_agg_expr runs 357 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 257 over it, 3.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_parquet::arrow::write::array_to_page_simple crates/polars-parquet/src/arrow/write/mod.rs:364 — FunctionTooLong — polars_parquet::arrow::write::array_to_page_simple runs 353 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 253 over it, 3.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_core::utils::supertype::get_supertype_with_options crates/polars-core/src/utils/supertype.rs:149 — FunctionTooLong — polars_core::utils::supertype::get_supertype_with_options runs 350 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 250 over it, 3.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_python::c_api::_polars_runtime crates/polars-python/src/c_api/mod.rs:115 — FunctionTooLong — polars_python::c_api::_polars_runtime runs 339 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 239 over it, 3.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: polars_plan::plans::optimizer::sortedness::is_sorted_rec crates/polars-plan/src/plans/optimizer/sortedness.rs:200 — FunctionTooLong — polars_plan::plans::optimizer::sortedness::is_sorted_rec runs 338 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 238 over it, 3.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 91 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_plan · ×76
  • polars_plan::plans::conversion::dsl_to_ir::to_alp_impl (cognitive 240) crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:194 — polars_plan::plans::conversion::dsl_to_ir::to_alp_impl has cognitive complexity 240 (threshold 15). Drivers by points: if/else 58 (139 pts), match/switch 16 (45 pts), loops 14 (38 pts), boolean chains 18 (nesting depth added 134). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_plan::plans::optimizer::predicate_pushdown::join::predicate_pruning::try_rewrite_join_type (cognitive 174) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:624 — polars_plan::plans::optimizer::predicate_pushdown::join::predicate_pruning::try_rewrite_join_type has cognitive complexity 174 (threshold 15). Drivers by points: if/else 54 (117 pts), match/switch 9 (25 pts), loops 8 (22 pts), boolean chains 10 (nesting depth added 93). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::cse::cache_states::set_cache_states (cognitive 166) crates/polars-plan/src/plans/optimizer/cse/cache_states.rs:139 — polars_plan::plans::optimizer::cse::cache_states::set_cache_states has cognitive complexity 166 (threshold 15). Drivers by points: if/else 26 (91 pts), loops 13 (50 pts), match/switch 5 (21 pts), boolean chains 4 (nesting depth added 118). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions (cognitive 154) crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:16 — polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions has cognitive complexity 154 (threshold 15). Drivers by points: match/switch 32 (68 pts), if/else 28 (65 pts), loops 6 (19 pts), boolean chains 2 (nesting depth added 86). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec (cognitive 141) crates/polars-plan/src/plans/aexpr/predicates/skip_batches.rs:336 — polars_plan::plans::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec has cognitive complexity 141 (threshold 15). Drivers by points: if/else 32 (96 pts), match/switch 11 (34 pts), loops 2 (6 pts), boolean chains 5 (nesting depth added 91). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::predicate_pushdown::join::process_join (cognitive 90) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/mod.rs:16 — polars_plan::plans::optimizer::predicate_pushdown::join::process_join has cognitive complexity 90 (threshold 15). Drivers by points: if/else 26 (49 pts), match/switch 13 (21 pts), boolean chains 13, loops 5 (7 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::sortedness::is_sorted_rec (cognitive 84) crates/polars-plan/src/plans/optimizer/sortedness.rs:200 — polars_plan::plans::optimizer::sortedness::is_sorted_rec has cognitive complexity 84 (threshold 15). Drivers by points: if/else 23 (43 pts), match/switch 13 (28 pts), loops 4 (10 pts), boolean chains 3 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::predicate_pushdown::utils::pushdown_eligibility (cognitive 75) crates/polars-plan/src/plans/optimizer/predicate_pushdown/utils.rs:357 — polars_plan::plans::optimizer::predicate_pushdown::utils::pushdown_eligibility has cognitive complexity 75 (threshold 15). Drivers by points: if/else 29 (52 pts), loops 7 (13 pts), boolean chains 7, match/switch 2 (3 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::conversion::dsl_to_ir::join::resolve_join (cognitive 72) crates/polars-plan/src/plans/conversion/dsl_to_ir/join.rs:55 — polars_plan::plans::conversion::dsl_to_ir::join::resolve_join has cognitive complexity 72 (threshold 15). Drivers by points: if/else 28 (45 pts), loops 6 (13 pts), match/switch 5 (9 pts), boolean chains 5 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::simplify_expr::simplify_functions::optimize_functions (cognitive 70) crates/polars-plan/src/plans/optimizer/simplify_expr/simplify_functions.rs:3 — polars_plan::plans::optimizer::simplify_expr::simplify_functions::optimize_functions has cognitive complexity 70 (threshold 15). Drivers by points: match/switch 17 (44 pts), if/else 12 (23 pts), loops 1 (3 pts) (nesting depth added 40). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec_inner (cognitive 66) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:275 — polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec_inner has cognitive complexity 66 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 9 (24 pts), match/switch 3 (6 pts), boolean chains 4 (nesting depth added 37). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_plan::plans::optimizer::call_dsl_resolvers::call_dsl_resolvers (cognitive 65) crates/polars-plan/src/plans/optimizer/call_dsl_resolvers.rs:30 — polars_plan::plans::optimizer::call_dsl_resolvers::call_dsl_resolvers has cognitive complexity 65 (threshold 15). Drivers by points: if/else 23 (60 pts), loops 1 (2 pts), match/switch 2, boolean chains 1 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • polars_plan::plans::conversion::dsl_to_ir::scans::csv_file_info (cognitive 64) crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1268 — polars_plan::plans::conversion::dsl_to_ir::scans::csv_file_info has cognitive complexity 64 (threshold 15). Drivers by points: if/else 21 (33 pts), match/switch 7 (17 pts), boolean chains 8, loops 2 (6 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::optimize (cognitive 64) crates/polars-plan/src/plans/optimizer/mod.rs:115 — polars_plan::plans::optimizer::optimize has cognitive complexity 64 (threshold 15). Drivers by points: if/else 34 (47 pts), boolean chains 9, match/switch 2 (5 pts), loops 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::cluster_with_columns::optimize (cognitive 62) crates/polars-plan/src/plans/optimizer/cluster_with_columns.rs:20 — polars_plan::plans::optimizer::cluster_with_columns::optimize has cognitive complexity 62 (threshold 15). Drivers by points: if/else 19 (46 pts), loops 6 (12 pts), boolean chains 4 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::hive::hive_partitions_from_paths (cognitive 56) crates/polars-plan/src/plans/hive.rs:93 — polars_plan::plans::hive::hive_partitions_from_paths has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (37 pts), loops 6 (15 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::predicate_pushdown::hive::rewrite_hive (cognitive 56) crates/polars-plan/src/plans/optimizer/predicate_pushdown/hive.rs:58 — polars_plan::plans::optimizer::predicate_pushdown::hive::rewrite_hive has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (41 pts), loops 4 (11 pts), boolean chains 3, match/switch 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::ir::format::write_ir_non_recursive (cognitive 54) crates/polars-plan/src/plans/ir/format.rs:908 — polars_plan::plans::ir::format::write_ir_non_recursive has cognitive complexity 54 (threshold 15). Drivers by points: if/else 20 (48 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 30). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_plan::plans::conversion::dsl_to_ir::scans::parquet_column_stats (cognitive 52) crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:632 — polars_plan::plans::conversion::dsl_to_ir::scans::parquet_column_stats has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (28 pts), match/switch 5 (12 pts), boolean chains 8, loops 3 (4 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::slice_pushdown_expr::aexpr_slice_pushdown_top (cognitive 52) crates/polars-plan/src/plans/optimizer/slice_pushdown_expr.rs:351 — polars_plan::plans::optimizer::slice_pushdown_expr::aexpr_slice_pushdown_top has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (39 pts), match/switch 4 (7 pts), boolean chains 4, loops 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::join_runtime_filter::scan_origins (cognitive 51) crates/polars-plan/src/plans/optimizer/join_runtime_filter.rs:358 — polars_plan::plans::optimizer::join_runtime_filter::scan_origins has cognitive complexity 51 (threshold 15). Drivers by points: if/else 7 (28 pts), match/switch 4 (15 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::optimizer::window_top_one::find_window (cognitive 50) crates/polars-plan/src/plans/optimizer/window_top_one.rs:160 — polars_plan::plans::optimizer::window_top_one::find_window has cognitive complexity 50 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 5 (17 pts), match/switch 4 (13 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_plan::plans::python::pyarrow::to_pa (cognitive 49) crates/polars-plan/src/plans/python/pyarrow.rs:222 — polars_plan::plans::python::pyarrow::to_pa has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (32 pts), match/switch 7 (15 pts), boolean chains 2 (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl (cognitive 46) crates/polars-plan/src/plans/conversion/ir_to_dsl.rs:340 — polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl has cognitive complexity 46 (threshold 15). Drivers by points: match/switch 23 (46 pts) (nesting depth added 23). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_plan::plans::optimizer::extract_window::extract_from_projection (cognitive 45) crates/polars-plan/src/plans/optimizer/extract_window.rs:527 — polars_plan::plans::optimizer::extract_window::extract_from_projection has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (24 pts), loops 5 (9 pts), match/switch 5 (8 pts), boolean chains 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 51 more in this group — see findings.md.
D1 · Cyclomatic Complexity · polars_plan · ×70
  • polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions (cyclomatic 424) crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:16 — polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions has cyclomatic complexity 424 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl (cyclomatic 369) crates/polars-plan/src/plans/conversion/ir_to_dsl.rs:340 — polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl has cyclomatic complexity 369 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::conversion::dsl_to_ir::to_alp_impl (cyclomatic 139) crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:194 — polars_plan::plans::conversion::dsl_to_ir::to_alp_impl has cyclomatic complexity 139 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_plan::plans::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec (cyclomatic 80) crates/polars-plan/src/plans/aexpr/predicates/skip_batches.rs:336 — polars_plan::plans::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_plan::plans::optimizer::predicate_pushdown::join::predicate_pruning::try_rewrite_join_type (cyclomatic 78) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:624 — polars_plan::plans::optimizer::predicate_pushdown::join::predicate_pruning::try_rewrite_join_type has cyclomatic complexity 78 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_plan::plans::optimizer::sortedness::is_sorted_rec (cyclomatic 78) crates/polars-plan/src/plans/optimizer/sortedness.rs:200 — polars_plan::plans::optimizer::sortedness::is_sorted_rec has cyclomatic complexity 78 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec_inner (cyclomatic 70) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:275 — polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec_inner has cyclomatic complexity 70 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • polars_plan::plans::optimizer::predicate_pushdown::join::process_join (cyclomatic 65) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/mod.rs:16 — polars_plan::plans::optimizer::predicate_pushdown::join::process_join has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_plan::plans::optimizer::simplify_expr::simplify_functions::optimize_functions (cyclomatic 61) crates/polars-plan/src/plans/optimizer/simplify_expr/simplify_functions.rs:3 — polars_plan::plans::optimizer::simplify_expr::simplify_functions::optimize_functions has cyclomatic complexity 61 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl_inner (cyclomatic 58) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_to_ir.rs:124 — polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl_inner has cyclomatic complexity 58 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::aexpr::schema::get_arithmetic_field (cyclomatic 49) crates/polars-plan/src/plans/aexpr/schema.rs:596 — polars_plan::plans::aexpr::schema::get_arithmetic_field has cyclomatic complexity 49 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::optimizer::cse::cache_states::set_cache_states (cyclomatic 48) crates/polars-plan/src/plans/optimizer/cse/cache_states.rs:139 — polars_plan::plans::optimizer::cse::cache_states::set_cache_states has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_plan::plans::ir::format::write_ir_non_recursive (cyclomatic 47) crates/polars-plan/src/plans/ir/format.rs:908 — polars_plan::plans::ir::format::write_ir_non_recursive has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_plan::plans::optimizer::optimize (cyclomatic 47) crates/polars-plan/src/plans/optimizer/mod.rs:115 — polars_plan::plans::optimizer::optimize has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_plan::plans::aexpr::schema::get_truediv_dtype (cyclomatic 46) crates/polars-plan/src/plans/aexpr/schema.rs:882 — polars_plan::plans::aexpr::schema::get_truediv_dtype has cyclomatic complexity 46 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::conversion::type_coercion::binary::coerce_comparison_literal (cyclomatic 44) crates/polars-plan/src/plans/conversion/type_coercion/binary.rs:543 — polars_plan::plans::conversion::type_coercion::binary::coerce_comparison_literal has cyclomatic complexity 44 (threshold 15). Of this number, 38 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::conversion::dsl_to_ir::join::resolve_join (cyclomatic 41) crates/polars-plan/src/plans/conversion/dsl_to_ir/join.rs:55 — polars_plan::plans::conversion::dsl_to_ir::join::resolve_join has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_plan::plans::optimizer::predicate_pushdown::utils::pushdown_eligibility (cyclomatic 41) crates/polars-plan/src/plans/optimizer/predicate_pushdown/utils.rs:357 — polars_plan::plans::optimizer::predicate_pushdown::utils::pushdown_eligibility has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_plan::plans::python::pyarrow::to_pa (cyclomatic 40) crates/polars-plan/src/plans/python/pyarrow.rs:222 — polars_plan::plans::python::pyarrow::to_pa has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::to_description::ir_props (cyclomatic 40) crates/polars-plan/src/plans/to_description.rs:62 — polars_plan::plans::to_description::ir_props has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::conversion::ir_to_dsl::node_to_expr (cyclomatic 39) crates/polars-plan/src/plans/conversion/ir_to_dsl.rs:7 — polars_plan::plans::conversion::ir_to_dsl::node_to_expr has cyclomatic complexity 39 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::aexpr::predicates::column_expr::is_between (cyclomatic 38) crates/polars-plan/src/plans/aexpr/predicates/column_expr.rs:307 — polars_plan::plans::aexpr::predicates::column_expr::is_between has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • polars_plan::plans::conversion::type_coercion::can_cast_to_lossless (cyclomatic 38) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1596 — polars_plan::plans::conversion::type_coercion::can_cast_to_lossless has cyclomatic complexity 38 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::stats::node::node_stats_with_cache (cyclomatic 37) crates/polars-plan/src/plans/stats/node.rs:178 — polars_plan::plans::stats::node::node_stats_with_cache has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_plan::plans::aexpr::predicates::column_expr::specialize (cyclomatic 36) crates/polars-plan/src/plans/aexpr/predicates/column_expr.rs:102 — polars_plan::plans::aexpr::predicates::column_expr::specialize has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • + 45 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×67
  • Duplicated block (5 lines × 2) crates/polars-compute/src/moment.rs:653 — crates/polars-compute/src/moment.rs:653-657 | crates/polars-compute/src/moment.rs:676-680 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/moment.rs:653` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-compute/src/unique/distinct.rs:492 — crates/polars-compute/src/unique/distinct.rs:492-496 | crates/polars-compute/src/unique/distinct.rs:632-636 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/unique/distinct.rs:492` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-compute/src/unique/distinct.rs:570 — crates/polars-compute/src/unique/distinct.rs:570-575 | crates/polars-compute/src/unique/distinct.rs:742-746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/unique/distinct.rs:570` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-compute/src/unique/distinct.rs:614 — crates/polars-compute/src/unique/distinct.rs:614-618 | crates/polars-compute/src/unique/distinct.rs:772-776 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/unique/distinct.rs:614` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-compute/src/unique/distinct.rs:663 — crates/polars-compute/src/unique/distinct.rs:663-667 | crates/polars-compute/src/unique/distinct.rs:805-809 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/unique/distinct.rs:663` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-compute/src/unique/distinct.rs:696 — crates/polars-compute/src/unique/distinct.rs:696-700 | crates/polars-compute/src/unique/distinct.rs:789-793 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/unique/distinct.rs:696` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-compute/src/unique/distinct.rs:774 — crates/polars-compute/src/unique/distinct.rs:774-778 | crates/polars-compute/src/unique/distinct.rs:807-811 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/unique/distinct.rs:774` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) crates/polars-core/src/utils/supertype.rs:338 — crates/polars-core/src/utils/supertype.rs:338-342 | crates/polars-core/src/utils/supertype.rs:344-348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-core/src/utils/supertype.rs:344` calls `Some` and `crates/polars-core/src/utils/supertype.rs:350` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) crates/polars-core/src/utils/supertype.rs:375 — crates/polars-core/src/utils/supertype.rs:375-379 | crates/polars-core/src/utils/supertype.rs:383-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/polars-expr/src/dispatch/groups_dispatch.rs:84 — crates/polars-expr/src/dispatch/groups_dispatch.rs:84-88 | crates/polars-expr/src/dispatch/groups_dispatch.rs:141-145 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/groups_dispatch.rs:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-expr/src/hot_groups/single_key.rs:153 — crates/polars-expr/src/hot_groups/single_key.rs:153-157 | crates/polars-expr/src/hot_groups/single_key.rs:164-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/hot_groups/single_key.rs:153` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-expr/src/hot_groups/single_key.rs:157` calls `push_g`, `insert_key`, `insert_null` and `crates/polars-expr/src/hot_groups/single_key.rs:169` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) crates/polars-expr/src/reduce/mod.rs:487 — crates/polars-expr/src/reduce/mod.rs:487-491 | crates/polars-expr/src/reduce/mod.rs:497-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/polars-mem-engine/src/executors/hconcat.rs:25 — crates/polars-mem-engine/src/executors/hconcat.rs:25-29 | crates/polars-mem-engine/src/executors/union.rs:43-47 — before extracting anything, compare `crates/polars-mem-engine/src/executors/hconcat.rs` and `crates/polars-mem-engine/src/executors/union.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-mem-engine/src/executors/hconcat.rs:25` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-ops/src/chunked_array/binary/slice.rs:173 — crates/polars-ops/src/chunked_array/binary/slice.rs:173-177 | crates/polars-ops/src/chunked_array/binary/slice.rs:197-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/binary/slice.rs:173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-ops/src/chunked_array/gather/chunked.rs:159 — crates/polars-ops/src/chunked_array/gather/chunked.rs:159-163 | crates/polars-ops/src/chunked_array/gather/chunked.rs:259-263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/gather/chunked.rs:159` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-ops/src/chunked_array/list/dispersion.rs:38 — crates/polars-ops/src/chunked_array/list/dispersion.rs:38-42 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:256-260 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/dispersion.rs:38` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-ops/src/chunked_array/strings/escape_regex.rs:9 — crates/polars-ops/src/chunked_array/strings/escape_regex.rs:9-13 | crates/polars-ops/src/chunked_array/strings/normalize.rs:9-13 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/strings/escape_regex.rs:9` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-ops/src/chunked_array/strings/substring.rs:308 — crates/polars-ops/src/chunked_array/strings/substring.rs:308-312 | crates/polars-ops/src/chunked_array/strings/substring.rs:335-339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/strings/substring.rs:308` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-ops/src/frame/join/hash_join/single_keys_inner.rs:63 — crates/polars-ops/src/frame/join/hash_join/single_keys_inner.rs:63-68 | crates/polars-ops/src/frame/join/hash_join/single_keys_left.rs:131-135 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_inner.rs:63` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-ops/src/series/ops/abs.rs:19 — crates/polars-ops/src/series/ops/abs.rs:19-23 | crates/polars-ops/src/series/ops/negate.rs:16-20 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/abs.rs:19` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/mod.rs:46 — crates/polars-parquet/src/arrow/read/deserialize/mod.rs:46-51 | crates/polars-parquet/src/arrow/read/deserialize/mod.rs:96-100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/mod.rs:46` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:507 — crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:507-511 | crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:726-730 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:507` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-plan/src/plans/conversion/dsl_to_ir/sql.rs:201 — crates/polars-plan/src/plans/conversion/dsl_to_ir/sql.rs:201-205 | crates/polars-plan/src/plans/conversion/type_coercion/membership.rs:294-299 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/dsl_to_ir/sql.rs:201` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-plan/src/plans/optimizer/predicate_pushdown/dynamic.rs:162 — crates/polars-plan/src/plans/optimizer/predicate_pushdown/dynamic.rs:162-166 | crates/polars-plan/src/plans/optimizer/predicate_pushdown/dynamic.rs:181-185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/predicate_pushdown/dynamic.rs:162` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/polars-python/src/cloud_server.rs:78 — crates/polars-python/src/cloud_server.rs:78-82 | crates/polars-python/src/lazyframe/general.rs:78-83 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-python/src/cloud_server.rs:78` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 42 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×64
  • Duplicated block (11 lines × 2) crates/polars-compute/src/rolling/moment.rs:324 — crates/polars-compute/src/rolling/moment.rs:324-334 | crates/polars-compute/src/rolling/sum.rs:185-195 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/rolling/moment.rs:324` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-core/src/chunked_array/comparison/categorical.rs:39 — crates/polars-core/src/chunked_array/comparison/categorical.rs:39-49 | crates/polars-core/src/chunked_array/comparison/categorical.rs:51-61 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) crates/polars-core/src/frame/mod.rs:1830 — crates/polars-core/src/frame/mod.rs:1830-1840 | crates/polars-core/src/frame/mod.rs:1900-1910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:369 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:369-379 | crates/polars-core/src/series/arithmetic/list.rs:358-368 — before extracting anything, compare `crates/polars-core/src/series/arithmetic/fixed_size_list.rs` and `crates/polars-core/src/series/arithmetic/list.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:448 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:448-458 | crates/polars-core/src/series/arithmetic/list.rs:485-495 — before extracting anything, compare `crates/polars-core/src/series/arithmetic/fixed_size_list.rs` and `crates/polars-core/src/series/arithmetic/list.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-core/src/series/arithmetic/list.rs:497` calls `match`, `is_none` and `crates/polars-core/src/series/arithmetic/fixed_size_list.rs:460` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) crates/polars-core/src/series/from.rs:742 — crates/polars-core/src/series/from.rs:742-752 | crates/polars-core/src/series/from.rs:771-781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/from.rs:742` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) crates/polars-core/src/utils/mod.rs:1019 — crates/polars-core/src/utils/mod.rs:1019-1029 | crates/polars-core/src/utils/mod.rs:1045-1055 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/polars-expr/src/expressions/aggregation.rs:198 — crates/polars-expr/src/expressions/aggregation.rs:198-208 | crates/polars-expr/src/expressions/aggregation.rs:211-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/aggregation.rs:198` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-expr/src/expressions/sortby.rs:193 — crates/polars-expr/src/expressions/sortby.rs:193-204 | crates/polars-expr/src/expressions/sortby.rs:211-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/sortby.rs:193` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-expr/src/reduce/implode.rs:245 — crates/polars-expr/src/reduce/implode.rs:245-255 | crates/polars-expr/src/reduce/unique.rs:531-541 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/implode.rs:245` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-io/src/cloud/credential_provider.rs:795 — crates/polars-io/src/cloud/credential_provider.rs:795-805 | crates/polars-io/src/cloud/credential_provider.rs:980-990 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/cloud/credential_provider.rs:795` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-io/src/csv/read/schema_inference.rs:106 — crates/polars-io/src/csv/read/schema_inference.rs:106-117 | crates/polars-io/src/csv/read/schema_inference.rs:175-185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/polars-io/src/predicates.rs:381 — crates/polars-io/src/predicates.rs:381-391 | crates/polars-plan/src/plans/aexpr/predicates/mod.rs:28-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) crates/polars-json/src/json/write/mod.rs:51 — crates/polars-json/src/json/write/mod.rs:51-61 | crates/polars-json/src/ndjson/write.rs:53-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/chunked_array/binary/slice.rs:143 — crates/polars-ops/src/chunked_array/binary/slice.rs:143-153 | crates/polars-ops/src/chunked_array/binary/slice.rs:156-166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/binary/slice.rs:143` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/frame/join/asof/groups.rs:311 — crates/polars-ops/src/frame/join/asof/groups.rs:311-321 | crates/polars-ops/src/frame/join/asof/groups.rs:343-353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/asof/groups.rs:311` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:242 — crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:242-252 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:367-377 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:242` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:19 — crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:19-29 | crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:103-113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:19` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/frame/join/iejoin/mod.rs:268 — crates/polars-ops/src/frame/join/iejoin/mod.rs:268-278 | crates/polars-ops/src/frame/join/iejoin/mod.rs:334-344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/iejoin/mod.rs:268` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/frame/join/merge_join.rs:301 — crates/polars-ops/src/frame/join/merge_join.rs:301-311 | crates/polars-ops/src/frame/join/merge_join.rs:312-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/series/ops/ewm.rs:74 — crates/polars-ops/src/series/ops/ewm.rs:74-84 | crates/polars-ops/src/series/ops/ewm.rs:124-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/ewm.rs:74` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/series/ops/ewm.rs:86 — crates/polars-ops/src/series/ops/ewm.rs:86-96 | crates/polars-ops/src/series/ops/ewm.rs:136-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/ewm.rs:86` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/series/ops/ewm.rs:98 — crates/polars-ops/src/series/ops/ewm.rs:98-108 | crates/polars-ops/src/series/ops/ewm.rs:148-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/ewm.rs:98` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/series/ops/is_first_distinct.rs:79 — crates/polars-ops/src/series/ops/is_first_distinct.rs:79-89 | crates/polars-ops/src/series/ops/is_last_distinct.rs:149-159 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/is_first_distinct.rs:79` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/series/ops/is_in/mod.rs:348 — crates/polars-ops/src/series/ops/is_in/mod.rs:348-358 | crates/polars-ops/src/series/ops/is_in/mod.rs:435-445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/is_in/mod.rs:348` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 39 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×63
  • Duplicated block (9 lines × 2) crates/polars-compute/src/min_max/simd.rs:40 — crates/polars-compute/src/min_max/simd.rs:40-48 | crates/polars-compute/src/min_max/simd.rs:92-100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/min_max/simd.rs:40` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-compute/src/moment.rs:351 — crates/polars-compute/src/moment.rs:351-359 | crates/polars-compute/src/moment.rs:494-502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/polars-core/src/chunked_array/cast.rs:620 — crates/polars-core/src/chunked_array/cast.rs:620-628 | crates/polars-core/src/chunked_array/cast.rs:645-653 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/polars-core/src/chunked_array/ops/arity.rs:258 — crates/polars-core/src/chunked_array/ops/arity.rs:258-266 | crates/polars-core/src/chunked_array/ops/arity.rs:335-343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/ops/arity.rs:258` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:46 — crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:46-54 | crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:111-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:46` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) crates/polars-core/src/frame/mod.rs:1279 — crates/polars-core/src/frame/mod.rs:1279-1287 | crates/polars-core/src/frame/mod.rs:1331-1339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/mod.rs:1279` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:520 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:520-528 | crates/polars-core/src/series/arithmetic/fixed_size_list.rs:570-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/fixed_size_list.rs:520` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-core/src/utils/mod.rs:939 — crates/polars-core/src/utils/mod.rs:939-947 | crates/polars-core/src/utils/mod.rs:995-1003 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/utils/mod.rs:939` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-expr/src/dispatch/range/datetime_range.rs:27 — crates/polars-expr/src/dispatch/range/datetime_range.rs:27-35 | crates/polars-expr/src/dispatch/range/datetime_range.rs:49-57 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/range/datetime_range.rs:27` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-expr/src/expressions/apply.rs:611 — crates/polars-expr/src/expressions/apply.rs:611-619 | crates/polars-expr/src/expressions/binary.rs:392-400 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) crates/polars-expr/src/expressions/group_iter.rs:95 — crates/polars-expr/src/expressions/group_iter.rs:95-103 | crates/polars-expr/src/expressions/group_iter.rs:125-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/group_iter.rs:95` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn iter_groups_lazy(&mut` in one and `super) fn par_iter_groups_lazy( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 2) crates/polars-expr/src/hot_groups/fixed_index_table.rs:132 — crates/polars-expr/src/hot_groups/fixed_index_table.rs:132-140 | crates/polars-expr/src/hot_groups/fixed_index_table.rs:143-151 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) crates/polars-expr/src/reduce/mod.rs:428 — crates/polars-expr/src/reduce/mod.rs:428-436 | crates/polars-expr/src/reduce/mod.rs:692-700 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/polars-io/src/csv/read/builder.rs:140 — crates/polars-io/src/csv/read/builder.rs:140-148 | crates/polars-io/src/csv/read/builder.rs:407-415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/builder.rs:140` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-json/src/json/write/serialize.rs:202 — crates/polars-json/src/json/write/serialize.rs:202-210 | crates/polars-json/src/json/write/serialize.rs:217-225 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) crates/polars-mem-engine/src/executors/group_by_dynamic.rs:74 — crates/polars-mem-engine/src/executors/group_by_dynamic.rs:74-82 | crates/polars-mem-engine/src/executors/group_by_rolling.rs:106-114 — before extracting anything, compare `crates/polars-mem-engine/src/executors/group_by_dynamic.rs` and `crates/polars-mem-engine/src/executors/group_by_rolling.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-mem-engine/src/executors/group_by_dynamic.rs:74` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-mem-engine/src/executors/scan/python_scan.rs:75 — crates/polars-mem-engine/src/executors/scan/python_scan.rs:75-83 | crates/polars-stream/src/physical_plan/to_graph.rs:1940-1948 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-mem-engine/src/executors/scan/python_scan.rs:75` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-ooc/src/memory_manager.rs:314 — crates/polars-ooc/src/memory_manager.rs:314-322 | crates/polars-ooc/src/memory_manager.rs:404-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ooc/src/memory_manager.rs:314` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) crates/polars-ops/src/chunked_array/gather/chunked.rs:872 — crates/polars-ops/src/chunked_array/gather/chunked.rs:872-880 | crates/polars-ops/src/chunked_array/gather/chunked.rs:921-929 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/gather/chunked.rs:872` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-ops/src/chunked_array/list/namespace.rs:448 — crates/polars-ops/src/chunked_array/list/namespace.rs:448-456 | crates/polars-ops/src/chunked_array/list/namespace.rs:522-530 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/namespace.rs:448` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-ops/src/chunked_array/strings/split.rs:181 — crates/polars-ops/src/chunked_array/strings/split.rs:181-189 | crates/polars-ops/src/chunked_array/strings/split.rs:325-335 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/strings/split.rs:181` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) crates/polars-ops/src/frame/join/iejoin/mod.rs:769 — crates/polars-ops/src/frame/join/iejoin/mod.rs:769-777 | crates/polars-ops/src/frame/join/iejoin/mod.rs:779-787 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/polars-ops/src/series/ops/concat_arr.rs:45 — crates/polars-ops/src/series/ops/concat_arr.rs:45-53 | crates/polars-ops/src/series/ops/concat_list.rs:39-47 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) crates/polars-ops/src/series/ops/is_in/mod.rs:365 — crates/polars-ops/src/series/ops/is_in/mod.rs:365-373 | crates/polars-ops/src/series/ops/is_in/mod.rs:452-460 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/is_in/mod.rs:365` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) crates/polars-ops/src/series/ops/is_in/mod.rs:385 — crates/polars-ops/src/series/ops/is_in/mod.rs:385-393 | crates/polars-ops/src/series/ops/is_in/mod.rs:472-480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/is_in/mod.rs:385` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 38 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×60
  • Duplicated block (7 lines × 2) crates/polars-compute/src/approx_quantile.rs:841 — crates/polars-compute/src/approx_quantile.rs:841-847 | crates/polars-compute/src/approx_quantile.rs:1386-1392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/approx_quantile.rs:841` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-compute/src/float_sum.rs:296 — crates/polars-compute/src/float_sum.rs:296-302 | crates/polars-compute/src/float_sum.rs:308-314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) crates/polars-compute/src/propagate_nulls.rs:89 — crates/polars-compute/src/propagate_nulls.rs:89-95 | crates/polars-compute/src/propagate_nulls.rs:178-184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/propagate_nulls.rs:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `arr` to `&dyn Array` in one and `&FixedSizeListArray` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) crates/polars-compute/src/sum.rs:55 — crates/polars-compute/src/sum.rs:55-61 | crates/polars-compute/src/sum.rs:70-76 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/polars-core/src/chunked_array/ops/arity.rs:586 — crates/polars-core/src/chunked_array/ops/arity.rs:586-592 | crates/polars-core/src/chunked_array/ops/arity.rs:671-677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1013 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1013-1019 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1086-1092 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:1013` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-core/src/frame/mod.rs:646 — crates/polars-core/src/frame/mod.rs:646-652 | crates/polars-core/src/frame/mod.rs:761-767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/mod.rs:646` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-core/src/series/from.rs:714 — crates/polars-core/src/series/from.rs:714-720 | crates/polars-core/src/series/from.rs:723-729 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/from.rs:714` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-core/src/utils/mod.rs:1105 — crates/polars-core/src/utils/mod.rs:1105-1111 | crates/polars-core/src/utils/mod.rs:1113-1119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) crates/polars-expr/src/dispatch/range/int_range.rs:48 — crates/polars-expr/src/dispatch/range/int_range.rs:48-57 | crates/polars-expr/src/dispatch/range/time_range.rs:50-56 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 2) crates/polars-expr/src/reduce/count.rs:114 — crates/polars-expr/src/reduce/count.rs:114-120 | crates/polars-expr/src/reduce/count.rs:246-252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/count.rs:114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-expr/src/reduce/count.rs:232 — crates/polars-expr/src/reduce/count.rs:232-238 | crates/polars-expr/src/reduce/has_nulls.rs:52-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/count.rs:232` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-expr/src/reduce/min_max_by.rs:629 — crates/polars-expr/src/reduce/min_max_by.rs:629-635 | crates/polars-expr/src/reduce/min_max_by.rs:683-689 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) crates/polars-io/src/csv/read/parser.rs:448 — crates/polars-io/src/csv/read/parser.rs:448-454 | crates/polars-io/src/csv/read/parser.rs:693-699 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/parser.rs:448` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-mem-engine/src/planner/lp.rs:437 — crates/polars-mem-engine/src/planner/lp.rs:437-443 | crates/polars-mem-engine/src/planner/lp.rs:448-456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-mem-engine/src/planner/lp.rs:448` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-ops/src/chunked_array/binary/slice.rs:114 — crates/polars-ops/src/chunked_array/binary/slice.rs:114-120 | crates/polars-ops/src/chunked_array/strings/substring.rs:244-250 — before extracting anything, compare `crates/polars-ops/src/chunked_array/binary/slice.rs` and `crates/polars-ops/src/chunked_array/strings/substring.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/binary/slice.rs:114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-ops/src/chunked_array/list/dispersion.rs:22 — crates/polars-ops/src/chunked_array/list/dispersion.rs:22-28 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:240-246 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/dispersion.rs:22` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-ops/src/chunked_array/list/dispersion.rs:30 — crates/polars-ops/src/chunked_array/list/dispersion.rs:30-36 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:248-254 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/dispersion.rs:30` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-ops/src/chunked_array/list/min_max.rs:68 — crates/polars-ops/src/chunked_array/list/min_max.rs:68-74 | crates/polars-ops/src/chunked_array/list/min_max.rs:186-192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/min_max.rs:68` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:155 — crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:155-161 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:168-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:155` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs:36 — crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs:36-42 | crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:47-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs:36` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/mod.rs:129 — crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/mod.rs:129-135 | crates/polars-parquet/src/arrow/read/deserialize/primitive/plain/mod.rs:181-187 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/mod.rs:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:903 — crates/polars-parquet/src/arrow/write/mod.rs:903-909 | crates/polars-parquet/src/arrow/write/mod.rs:1123-1129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:903` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) crates/polars-parquet/src/arrow/write/pages.rs:224 — crates/polars-parquet/src/arrow/write/pages.rs:224-230 | crates/polars-parquet/src/arrow/write/pages.rs:247-253 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/pages.rs:224` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) crates/polars-parquet/src/arrow/write/primitive/basic.rs:222 — crates/polars-parquet/src/arrow/write/primitive/basic.rs:222-228 | crates/polars-parquet/src/arrow/write/primitive/basic.rs:231-237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/primitive/basic.rs:222` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 35 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×59
  • Duplicated block (8 lines × 2) crates/polars-compute/src/arithmetic/mod.rs:197 — crates/polars-compute/src/arithmetic/mod.rs:197-204 | crates/polars-compute/src/cast/primitive_to.rs:126-133 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) crates/polars-compute/src/comparisons/array.rs:95 — crates/polars-compute/src/comparisons/array.rs:95-102 | crates/polars-compute/src/comparisons/array.rs:116-123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/comparisons/array.rs:95` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/polars-compute/src/moment.rs:142 — crates/polars-compute/src/moment.rs:142-149 | crates/polars-compute/src/moment.rs:210-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/polars-compute/src/rolling/no_nulls/rank.rs:66 — crates/polars-compute/src/rolling/no_nulls/rank.rs:66-73 | crates/polars-compute/src/rolling/nulls/rank.rs:60-67 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/rolling/no_nulls/rank.rs:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-compute/src/rolling/nulls/rank.rs:68` calls `get`, `unwrap` and `crates/polars-compute/src/rolling/no_nulls/rank.rs:74` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) crates/polars-compute/src/unique/primitive.rs:144 — crates/polars-compute/src/unique/primitive.rs:144-151 | crates/polars-compute/src/unique/primitive.rs:158-165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/unique/primitive.rs:144` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/polars-core/src/chunked_array/ops/chunkops.rs:143 — crates/polars-core/src/chunked_array/ops/chunkops.rs:143-150 | crates/polars-core/src/series/implementations/null.rs:62-69 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:415 — crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:415-422 | crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:473-480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:415` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1338 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1338-1345 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1383-1390 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:1338` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/polars-core/src/series/any_value.rs:369 — crates/polars-core/src/series/any_value.rs:369-376 | crates/polars-core/src/series/any_value.rs:384-391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/any_value.rs:369` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/polars-core/src/series/arithmetic/borrowed.rs:453 — crates/polars-core/src/series/arithmetic/borrowed.rs:453-460 | crates/polars-core/src/series/arithmetic/borrowed.rs:469-476 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/borrowed.rs:453` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:385 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:385-393 | crates/polars-core/src/series/arithmetic/list.rs:382-389 — before extracting anything, compare `crates/polars-core/src/series/arithmetic/fixed_size_list.rs` and `crates/polars-core/src/series/arithmetic/list.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/fixed_size_list.rs:385` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) crates/polars-expr/src/expressions/slice.rs:177 — crates/polars-expr/src/expressions/slice.rs:177-184 | crates/polars-expr/src/expressions/slice.rs:268-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/slice.rs:177` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-expr/src/expressions/slice.rs:263` calls `check_argument`, `cast`, `i64` and `crates/polars-expr/src/expressions/slice.rs:175` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) crates/polars-expr/src/hot_groups/binview.rs:135 — crates/polars-expr/src/hot_groups/binview.rs:135-142 | crates/polars-expr/src/hot_groups/single_key.rs:130-137 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) crates/polars-expr/src/idx_table/binview.rs:222 — crates/polars-expr/src/idx_table/binview.rs:222-229 | crates/polars-expr/src/idx_table/binview.rs:239-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/polars-expr/src/reduce/first_last.rs:33 — crates/polars-expr/src/reduce/first_last.rs:33-40 | crates/polars-expr/src/reduce/first_last_nonnull.rs:25-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/first_last.rs:33` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/polars-expr/src/reduce/implode.rs:92 — crates/polars-expr/src/reduce/implode.rs:92-99 | crates/polars-expr/src/reduce/implode.rs:162-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/polars-io/src/predicates.rs:445 — crates/polars-io/src/predicates.rs:445-452 | crates/polars-io/src/predicates.rs:459-466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/polars-ops/src/chunked_array/array/count.rs:11 — crates/polars-ops/src/chunked_array/array/count.rs:11-18 | crates/polars-ops/src/chunked_array/list/count.rs:45-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `ca` to `&ArrayChunked` in one and `&ListChunked` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) crates/polars-ops/src/chunked_array/top_k.rs:70 — crates/polars-ops/src/chunked_array/top_k.rs:70-77 | crates/polars-ops/src/chunked_array/top_k.rs:105-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `ca` to `&ChunkedArray<BooleanType>` in one and `&ChunkedArray<BinaryType>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) crates/polars-ops/src/frame/join/merge_sorted.rs:129 — crates/polars-ops/src/frame/join/merge_sorted.rs:129-136 | crates/polars-ops/src/frame/join/merge_sorted.rs:140-147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/merge_sorted.rs:129` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/polars-ops/src/series/ops/clip.rs:82 — crates/polars-ops/src/series/ops/clip.rs:82-89 | crates/polars-ops/src/series/ops/clip.rs:118-125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/clip.rs:82` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/polars-ops/src/series/ops/cum_agg.rs:407 — crates/polars-ops/src/series/ops/cum_agg.rs:407-414 | crates/polars-ops/src/series/ops/cum_agg.rs:455-462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/cum_agg.rs:407` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/polars-ops/src/series/ops/rle.rs:117 — crates/polars-ops/src/series/ops/rle.rs:117-124 | crates/polars-ops/src/series/ops/rle.rs:132-140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/rle.rs:117` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:45 — crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:45-52 | crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:95-102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:45` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:104` calls `verify_dict_indices` and `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:54` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) crates/polars-parquet/src/arrow/write/pages.rs:175 — crates/polars-parquet/src/arrow/write/pages.rs:175-182 | crates/polars-parquet/src/arrow/write/pages.rs:277-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/pages.rs:175` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 34 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×48
  • Duplicated block (6 lines × 2) crates/polars-compute/src/approx_quantile.rs:832 — crates/polars-compute/src/approx_quantile.rs:832-837 | crates/polars-compute/src/approx_quantile.rs:1378-1383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/approx_quantile.rs:832` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-compute/src/unique/distinct.rs:616 — crates/polars-compute/src/unique/distinct.rs:616-621 | crates/polars-compute/src/unique/distinct.rs:665-670 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/unique/distinct.rs:616` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) crates/polars-core/src/chunked_array/cast.rs:237 — crates/polars-core/src/chunked_array/cast.rs:237-242 | crates/polars-core/src/chunked_array/cast.rs:255-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/cast.rs:237` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) crates/polars-core/src/chunked_array/ops/float_sorted_arg_max.rs:16 — crates/polars-core/src/chunked_array/ops/float_sorted_arg_max.rs:16-21 | crates/polars-core/src/chunked_array/ops/float_sorted_arg_max.rs:37-42 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1311 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1311-1316 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1355-1360 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:1311` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-core/src/series/arithmetic/list.rs:744 — crates/polars-core/src/series/arithmetic/list.rs:744-749 | crates/polars-core/src/series/arithmetic/list.rs:795-800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/list.rs:744` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-core/src/utils/mod.rs:843 — crates/polars-core/src/utils/mod.rs:843-849 | crates/polars-core/src/utils/mod.rs:865-870 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/utils/mod.rs:843` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-expr/src/dispatch/horizontal.rs:107 — crates/polars-expr/src/dispatch/horizontal.rs:107-112 | crates/polars-expr/src/dispatch/horizontal.rs:152-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/horizontal.rs:107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-expr/src/expressions/slice.rs:180 — crates/polars-expr/src/expressions/slice.rs:180-185 | crates/polars-expr/src/expressions/slice.rs:223-228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/slice.rs:180` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-expr/src/reduce/min_max_by.rs:69 — crates/polars-expr/src/reduce/min_max_by.rs:69-74 | crates/polars-expr/src/reduce/min_max_by.rs:144-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/min_max_by.rs:69` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/chunked_array/binary/slice.rs:183 — crates/polars-ops/src/chunked_array/binary/slice.rs:183-188 | crates/polars-ops/src/chunked_array/strings/substring.rs:320-326 — before extracting anything, compare `crates/polars-ops/src/chunked_array/binary/slice.rs` and `crates/polars-ops/src/chunked_array/strings/substring.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/binary/slice.rs:183` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/chunked_array/binary/slice.rs:207 — crates/polars-ops/src/chunked_array/binary/slice.rs:207-212 | crates/polars-ops/src/chunked_array/strings/substring.rs:348-354 — before extracting anything, compare `crates/polars-ops/src/chunked_array/binary/slice.rs` and `crates/polars-ops/src/chunked_array/strings/substring.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/binary/slice.rs:207` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/frame/join/hash_join/single_keys_left.rs:64 — crates/polars-ops/src/frame/join/hash_join/single_keys_left.rs:64-69 | crates/polars-ops/src/frame/join/hash_join/single_keys_left.rs:80-85 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_left.rs:64` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/series/ops/business.rs:74 — crates/polars-ops/src/series/ops/business.rs:74-79 | crates/polars-ops/src/series/ops/business.rs:265-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/business.rs:74` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/series/ops/business.rs:226 — crates/polars-ops/src/series/ops/business.rs:226-231 | crates/polars-ops/src/series/ops/business.rs:394-399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/business.rs:226` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/series/ops/ewm_by.rs:139 — crates/polars-ops/src/series/ops/ewm_by.rs:139-144 | crates/polars-ops/src/series/ops/ewm_by.rs:164-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/ewm_by.rs:139` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/series/ops/rank.rs:130 — crates/polars-ops/src/series/ops/rank.rs:130-135 | crates/polars-ops/src/series/ops/rank.rs:140-145 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/rank.rs:130` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:839 — crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:839-844 | crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:859-864 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:2080 — crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:2080-2085 | crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:2093-2098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:2080` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/polars-plan/src/plans/functions/mod.rs:247 — crates/polars-plan/src/plans/functions/mod.rs:247-252 | crates/polars-plan/src/plans/functions/mod.rs:267-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/polars-plan/src/plans/ir/format.rs:310 — crates/polars-plan/src/plans/ir/format.rs:310-315 | crates/polars-plan/src/plans/ir/format.rs:367-372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/polars-python/src/functions/range.rs:119 — crates/polars-python/src/functions/range.rs:119-124 | crates/polars-python/src/functions/range.rs:148-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) REDACTED:915 — REDACTED:915-920 | REDACTED:982-987 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:915` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) REDACTED:2588 — REDACTED:2588-2593 | REDACTED:2607-2612 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) crates/polars-sql/src/functions.rs:2659 — crates/polars-sql/src/functions.rs:2659-2664 | crates/polars-sql/src/functions.rs:2672-2677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 23 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×47
  • Duplicated block (10 lines × 2) crates/polars-compute/src/rolling/min_by_max_by.rs:38 — crates/polars-compute/src/rolling/min_by_max_by.rs:38-47 | crates/polars-compute/src/rolling/min_by_max_by.rs:65-74 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/rolling/min_by_max_by.rs:38` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) crates/polars-core/src/chunked_array/comparison/categorical.rs:111 — crates/polars-core/src/chunked_array/comparison/categorical.rs:111-120 | crates/polars-core/src/chunked_array/comparison/categorical.rs:148-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/comparison/categorical.rs:111` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-core/src/chunked_array/comparison/mod.rs:723 — crates/polars-core/src/chunked_array/comparison/mod.rs:723-732 | crates/polars-core/src/chunked_array/comparison/mod.rs:957-966 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/comparison/mod.rs:723` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-core/src/chunked_array/object/iterator.rs:30 — crates/polars-core/src/chunked_array/object/iterator.rs:30-39 | crates/polars-core/src/chunked_array/object/iterator.rs:119-128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/object/iterator.rs:30` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-core/src/chunked_array/ops/rolling_window.rs:144 — crates/polars-core/src/chunked_array/ops/rolling_window.rs:144-153 | crates/polars-core/src/chunked_array/ops/rolling_window.rs:156-165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/ops/rolling_window.rs:144` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-core/src/series/any_value.rs:394 — crates/polars-core/src/series/any_value.rs:394-403 | crates/polars-core/src/series/any_value.rs:405-414 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) crates/polars-core/src/series/arithmetic/list.rs:622 — crates/polars-core/src/series/arithmetic/list.rs:622-631 | crates/polars-core/src/series/arithmetic/list.rs:721-730 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/list.rs:622` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-core/src/series/arithmetic/list.rs:618 — crates/polars-core/src/series/arithmetic/list.rs:618-627 | crates/polars-core/src/series/arithmetic/list.rs:761-770 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/list.rs:618` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) crates/polars-expr/src/dispatch/groups_dispatch.rs:908 — crates/polars-expr/src/dispatch/groups_dispatch.rs:908-917 | crates/polars-expr/src/dispatch/groups_dispatch.rs:965-974 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/groups_dispatch.rs:908` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-expr/src/expressions/apply.rs:682 — crates/polars-expr/src/expressions/apply.rs:682-691 | crates/polars-expr/src/expressions/structeval.rs:349-358 — before extracting anything, compare `crates/polars-expr/src/expressions/apply.rs` and `crates/polars-expr/src/expressions/structeval.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/apply.rs:682` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-expr/src/groups/single_key.rs:81 — crates/polars-expr/src/groups/single_key.rs:81-90 | crates/polars-expr/src/idx_table/single_key.rs:248-257 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/groups/single_key.rs:81` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-io/src/catalog/unity/schema.rs:289 — crates/polars-io/src/catalog/unity/schema.rs:289-298 | crates/polars-io/src/catalog/unity/schema.rs:429-438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/polars-mem-engine/src/scan_predicate/functions.rs:91 — crates/polars-mem-engine/src/scan_predicate/functions.rs:91-100 | crates/polars-mem-engine/src/scan_predicate/functions.rs:111-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/polars-ops/src/chunked_array/gather/chunked.rs:534 — crates/polars-ops/src/chunked_array/gather/chunked.rs:534-543 | crates/polars-ops/src/chunked_array/gather/chunked.rs:577-586 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/gather/chunked.rs:534` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-ops/src/chunked_array/gather/chunked.rs:551 — crates/polars-ops/src/chunked_array/gather/chunked.rs:551-560 | crates/polars-ops/src/chunked_array/gather/chunked.rs:590-599 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/gather/chunked.rs:551` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) crates/polars-ops/src/chunked_array/gather/chunked.rs:583 — crates/polars-ops/src/chunked_array/gather/chunked.rs:583-592 | crates/polars-ops/src/chunked_array/gather/chunked.rs:801-810 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/gather/chunked.rs:583` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-ops/src/chunked_array/gather/chunked.rs:765 — crates/polars-ops/src/chunked_array/gather/chunked.rs:765-774 | crates/polars-ops/src/chunked_array/gather/chunked.rs:812-821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/gather/chunked.rs:765` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-ops/src/chunked_array/list/sum_mean.rs:88 — crates/polars-ops/src/chunked_array/list/sum_mean.rs:88-97 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:108-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/sum_mean.rs:88` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) crates/polars-ops/src/series/ops/cut.rs:152 — crates/polars-ops/src/series/ops/cut.rs:152-161 | crates/polars-ops/src/series/ops/cut.rs:210-219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:153 — crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:153-162 | crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:255-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:153` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs:197 — crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs:197-206 | crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:267-276 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs:194` calls `fast_iter_u56` and `crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:265` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required.rs:31 — crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required.rs:31-40 | crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required_masked_dense.rs:42-51 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required.rs:31` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/nested.rs:31 — crates/polars-parquet/src/arrow/read/deserialize/nested.rs:31-40 | crates/polars-parquet/src/arrow/read/deserialize/nested.rs:137-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:683 — crates/polars-parquet/src/arrow/write/mod.rs:683-693 | crates/polars-parquet/src/arrow/write/mod.rs:750-759 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:683` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/polars-parquet/src/parquet/encoding/delta_bitpacked/decoder.rs:433 — crates/polars-parquet/src/parquet/encoding/delta_bitpacked/decoder.rs:433-443 | crates/polars-parquet/src/parquet/encoding/delta_bitpacked/decoder.rs:489-498 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/parquet/encoding/delta_bitpacked/decoder.rs:433` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • + 22 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_ops · ×44
  • polars_ops::chunked_array::gather::chunked::take_opt_chunked_unchecked_binview (cognitive 74) crates/polars-ops/src/chunked_array/gather/chunked.rs:685 — polars_ops::chunked_array::gather::chunked::take_opt_chunked_unchecked_binview has cognitive complexity 74 (threshold 15). Drivers by points: if/else 26 (55 pts), loops 6 (18 pts), boolean chains 1 (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • polars_ops::chunked_array::strings::split::split_to_struct (cognitive 52) crates/polars-ops/src/chunked_array/strings/split.rs:58 — polars_ops::chunked_array::strings::split::split_to_struct has cognitive complexity 52 (threshold 15). Drivers by points: loops 7 (29 pts), if/else 8 (13 pts), match/switch 3 (10 pts) (nesting depth added 34). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_ops::chunked_array::list::get::lst_get (cognitive 50) crates/polars-ops/src/chunked_array/list/get.rs:9 — polars_ops::chunked_array::list::get::lst_get has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (41 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 27). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_ops::frame::join::cross_join::fused_cross_filter (cognitive 48) crates/polars-ops/src/frame/join/cross_join.rs:139 — polars_ops::frame::join::cross_join::fused_cross_filter has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (32 pts), loops 5 (12 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • polars_ops::chunked_array::gather::chunked::take_chunked_unchecked_binview (cognitive 46) crates/polars-ops/src/chunked_array/gather/chunked.rs:480 — polars_ops::chunked_array::gather::chunked::take_chunked_unchecked_binview has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (28 pts), loops 6 (18 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_ops::frame::join::merge_join::gather_and_postprocess (cognitive 45) crates/polars-ops/src/frame/join/merge_join.rs:227 — polars_ops::frame::join::merge_join::gather_and_postprocess has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 6 (12 pts), match/switch 4 (6 pts), boolean chains 5 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_ops::series::ops::is_in::is_in_helper_list_ca (cognitive 36) crates/polars-ops/src/series/ops/is_in/mod.rs:335 — polars_ops::series::ops::is_in::is_in_helper_list_ca has cognitive complexity 36 (threshold 15). Drivers by points: loops 6 (22 pts), if/else 5 (9 pts), match/switch 2 (5 pts) (nesting depth added 23). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (polars_ops::series::ops::is_in::is_in_helper_array_ca) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_ops::series::ops::is_in::is_in_helper_array_ca (cognitive 36) crates/polars-ops/src/series/ops/is_in/mod.rs:423 — polars_ops::series::ops::is_in::is_in_helper_array_ca has cognitive complexity 36 (threshold 15). Drivers by points: loops 6 (22 pts), if/else 5 (9 pts), match/switch 2 (5 pts) (nesting depth added 23). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (polars_ops::series::ops::is_in::is_in_helper_list_ca) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_ops::chunked_array::strings::split::split_regex_helper (cognitive 32) crates/polars-ops/src/chunked_array/strings/split.rs:304 — polars_ops::chunked_array::strings::split::split_regex_helper has cognitive complexity 32 (threshold 15). Drivers by points: match/switch 6 (17 pts), if/else 6 (10 pts), loops 2 (5 pts) (nesting depth added 18). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_ops::frame::join::merge_join::match_keys_impl (cognitive 32) crates/polars-ops/src/frame/join/merge_join.rs:93 — polars_ops::frame::join::merge_join::match_keys_impl has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (4 pts), match/switch 1 (4 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_ops::series::ops::rank::rank (cognitive 32) crates/polars-ops/src/series/ops/rank.rs:29 — polars_ops::series::ops::rank::rank has cognitive complexity 32 (threshold 15). Drivers by points: loops 7 (20 pts), match/switch 6 (8 pts), if/else 4 (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_ops::series::ops::round::apply_float_rounding (cognitive 32) crates/polars-ops/src/series/ops/round.rs:70 — polars_ops::series::ops::round::apply_float_rounding has cognitive complexity 32 (threshold 15). Drivers by points: if/else 21 (32 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_ops::series::ops::strings::str_format (cognitive 32) crates/polars-ops/src/series/ops/strings.rs:17 — polars_ops::series::ops::strings::str_format has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 6 (14 pts), match/switch 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_ops::chunked_array::strings::concat::hor_str_concat (cognitive 29) crates/polars-ops/src/chunked_array/strings/concat.rs:59 — polars_ops::chunked_array::strings::concat::hor_str_concat has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 2 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_ops::chunked_array::strings::find_many::extract_many (cognitive 29) crates/polars-ops/src/chunked_array/strings/find_many.rs:159 — polars_ops::chunked_array::strings::find_many::extract_many has cognitive complexity 29 (threshold 15). Drivers by points: loops 5 (13 pts), match/switch 4 (11 pts), if/else 2 (5 pts) (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_ops::frame::join::iejoin::piecewise_merge_join_impl_t (cognitive 28) crates/polars-ops/src/frame/join/iejoin/mod.rs:112 — polars_ops::frame::join::iejoin::piecewise_merge_join_impl_t has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 3 (13 pts), if/else 4 (8 pts), loops 3 (7 pts) (nesting depth added 18). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_ops::chunked_array::gather::chunked::take_opt_chunked_unchecked_struct (cognitive 27) crates/polars-ops/src/chunked_array/gather/chunked.rs:886 — polars_ops::chunked_array::gather::chunked::take_opt_chunked_unchecked_struct has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (8 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_ops::frame::join::hash_join::single_keys::build_tables (cognitive 26) crates/polars-ops/src/frame/join/hash_join/single_keys.rs:16 — polars_ops::frame::join::hash_join::single_keys::build_tables has cognitive complexity 26 (threshold 15). Drivers by points: loops 8 (12 pts), if/else 4 (9 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_ops::chunked_array::strings::find_many::find_many (cognitive 25) crates/polars-ops/src/chunked_array/strings/find_many.rs:257 — polars_ops::chunked_array::strings::find_many::find_many has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 4 (11 pts), loops 4 (10 pts), if/else 2 (4 pts) (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_ops::chunked_array::strings::split::split_helper (cognitive 25) crates/polars-ops/src/chunked_array/strings/split.rs:156 — polars_ops::chunked_array::strings::split::split_helper has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 5 (11 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_ops::series::ops::binning::bins_from_rank_cuts_select (cognitive 24) crates/polars-ops/src/series/ops/binning.rs:106 — polars_ops::series::ops::binning::bins_from_rank_cuts_select has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 8 (10 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_ops::series::ops::index::convert_and_bound_idx_ca (cognitive 24) crates/polars-ops/src/series/ops/index.rs:21 — polars_ops::series::ops::index::convert_and_bound_idx_ca has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_ops::frame::join::hash_join::single_keys_outer::probe_outer (cognitive 23) crates/polars-ops/src/frame/join/hash_join/single_keys_outer.rs:98 — polars_ops::frame::join::hash_join::single_keys_outer::probe_outer has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 3 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_ops::series::ops::unique::unique_counts (cognitive 23) crates/polars-ops/src/series/ops/unique.rs:32 — polars_ops::series::ops::unique::unique_counts has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_ops::series::ops::various::is_sorted_impl (cognitive 23) crates/polars-ops/src/series/ops/various.rs:128 — polars_ops::series::ops::various::is_sorted_impl has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • + 19 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×41
  • Duplicated block (12 lines × 2) crates/polars-compute/src/gather/sublist/fixed_size_list.rs:51 — crates/polars-compute/src/gather/sublist/fixed_size_list.rs:51-62 | crates/polars-compute/src/gather/sublist/fixed_size_list.rs:70-81 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/gather/sublist/fixed_size_list.rs:51` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `index` to `i64` in one and `&PrimitiveArray<i64>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12 lines × 2) crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:208 — crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:208-219 | crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:278-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:208` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:391 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:391-402 | crates/polars-core/src/series/arithmetic/list.rs:405-416 — before extracting anything, compare `crates/polars-core/src/series/arithmetic/fixed_size_list.rs` and `crates/polars-core/src/series/arithmetic/list.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/fixed_size_list.rs:391` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-expr/src/expressions/apply.rs:309 — crates/polars-expr/src/expressions/apply.rs:309-320 | crates/polars-expr/src/expressions/structeval.rs:124-135 — before extracting anything, compare `crates/polars-expr/src/expressions/apply.rs` and `crates/polars-expr/src/expressions/structeval.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/apply.rs:309` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) crates/polars-expr/src/expressions/eval.rs:75 — crates/polars-expr/src/expressions/eval.rs:75-86 | crates/polars-expr/src/expressions/eval.rs:259-270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-expr/src/expressions/eval.rs:258` calls `empty_with_height` and `crates/polars-expr/src/expressions/eval.rs:74` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) crates/polars-expr/src/expressions/window.rs:73 — crates/polars-expr/src/expressions/window.rs:73-84 | crates/polars-expr/src/expressions/window.rs:105-116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/polars-expr/src/idx_table/row_encoded.rs:147 — crates/polars-expr/src/idx_table/row_encoded.rs:147-158 | crates/polars-expr/src/idx_table/row_encoded.rs:186-197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/idx_table/row_encoded.rs:147` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-expr/src/reduce/mod.rs:471 — crates/polars-expr/src/reduce/mod.rs:471-482 | crates/polars-expr/src/reduce/mod.rs:726-737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/mod.rs:471` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-expr/src/reduce/mod.rs:484` calls `has_nulls` and `crates/polars-expr/src/reduce/mod.rs:739` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) crates/polars-lazy/src/frame/mod.rs:1085 — crates/polars-lazy/src/frame/mod.rs:1085-1096 | crates/polars-lazy/src/frame/mod.rs:1131-1142 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-lazy/src/frame/mod.rs:1085` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) crates/polars-ops/src/chunked_array/array/get.rs:31 — crates/polars-ops/src/chunked_array/array/get.rs:31-42 | crates/polars-ops/src/chunked_array/array/get.rs:46-57 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/polars-ops/src/chunked_array/list/min_max.rs:17 — crates/polars-ops/src/chunked_array/list/min_max.rs:17-28 | crates/polars-ops/src/chunked_array/list/min_max.rs:128-139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/min_max.rs:17` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-ops/src/chunked_array/strings/extract.rs:82 — crates/polars-ops/src/chunked_array/strings/extract.rs:82-93 | crates/polars-ops/src/chunked_array/strings/extract.rs:106-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/strings/extract.rs:82` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-ops/src/chunked_array/strings/extract.rs:104` calls `compile_regex`, `capture_locations` and `crates/polars-ops/src/chunked_array/strings/extract.rs:81` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:42 — crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:42-53 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:60-71 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:42` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:606 — crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:606-617 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:739-750 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:606` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-parquet/src/arrow/write/binary/basic.rs:71 — crates/polars-parquet/src/arrow/write/binary/basic.rs:71-82 | crates/polars-parquet/src/arrow/write/boolean/basic.rs:67-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/binary/basic.rs:71` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-parquet/src/arrow/write/boolean/basic.rs:65` calls `validity` and `crates/polars-parquet/src/arrow/write/binary/basic.rs:69` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) crates/polars-plan/src/dsl/file_scan/mod.rs:1253 — crates/polars-plan/src/dsl/file_scan/mod.rs:1253-1264 | crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/builder.rs:343-354 — before extracting anything, compare `crates/polars-plan/src/dsl/file_scan/mod.rs` and `crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/builder.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/file_scan/mod.rs:1253` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs:358 — crates/polars-plan/src/plans/aexpr/traverse.rs:358-369 | crates/polars-plan/src/plans/aexpr/traverse.rs:470-481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/traverse.rs:358` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:679 — crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:679-690 | crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:713-724 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:679` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) crates/polars-plan/src/plans/ir/dot.rs:274 — crates/polars-plan/src/plans/ir/dot.rs:274-285 | crates/polars-stream/src/physical_plan/fmt.rs:631-642 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/ir/dot.rs:274` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-plan/src/plans/to_description.rs:473 — crates/polars-plan/src/plans/to_description.rs:473-484 | crates/polars-stream/src/physical_plan/to_description.rs:973-984 — before extracting anything, compare `crates/polars-plan/src/plans/to_description.rs` and `crates/polars-stream/src/physical_plan/to_description.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/to_description.rs:473` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-stream/src/nodes/dynamic_group_by.rs:423 — crates/polars-stream/src/nodes/dynamic_group_by.rs:423-434 | crates/polars-stream/src/nodes/rolling_group_by.rs:342-353 — before extracting anything, compare `crates/polars-stream/src/nodes/dynamic_group_by.rs` and `crates/polars-stream/src/nodes/rolling_group_by.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/dynamic_group_by.rs:423` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-stream/src/nodes/io_sources/ipc/metadata.rs:79 — crates/polars-stream/src/nodes/io_sources/ipc/metadata.rs:79-90 | crates/polars-stream/src/nodes/io_sources/parquet/metadata_utils.rs:94-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/ipc/metadata.rs:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-stream/src/physical_plan/fmt.rs:788 — crates/polars-stream/src/physical_plan/fmt.rs:788-799 | crates/polars-stream/src/physical_plan/fmt.rs:820-831 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/fmt.rs:788` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:781 — crates/polars-stream/src/physical_plan/lower_expr.rs:781-792 | crates/polars-stream/src/physical_plan/lower_expr.rs:2174-2185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:781` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/polars-time/src/windows/group_by.rs:672 — crates/polars-time/src/windows/group_by.rs:672-683 | crates/polars-time/src/windows/group_by.rs:692-703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-time/src/windows/group_by.rs:672` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 16 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×38
  • TooManyMethods: PyExpr crates/polars-python/src/expr/mod.rs:44 — TooManyMethods — 442 methods, declared across 15 files: expr/general.rs (190), expr/string.rs (55), expr/datetime.rs (43), expr/list.rs (31), +11 more file(s). The bar is 30 methods; this is 412 over it, 14.73× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PySeries crates/polars-python/src/series/mod.rs:30 — TooManyMethods — 372 methods, declared across 13 files: series/arithmetic.rs (119), series/comparison.rs (96), series/general.rs (75), series/construction.rs (36), +9 more file(s). The bar is 30 methods; this is 342 over it, 12.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Series py-polars/src/polars/series/series.py:200 — TooManyMethods — 317 methods. The bar is 30 methods; this is 287 over it, 10.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Expr crates/polars-plan/src/dsl/expr/mod.rs:67 — TooManyMethods — 259 methods, declared across 8 files: dsl/mod.rs (188), dsl/arithmetic.rs (23), expr/mod.rs (18), dsl/statistics.rs (12), +4 more file(s). The bar is 30 methods; this is 229 over it, 8.63× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Expr py-polars/src/polars/expr/expr.py:161 — TooManyMethods — 257 methods. The bar is 30 methods; this is 227 over it, 8.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DataFrame py-polars/src/polars/dataframe/frame.py:207 — TooManyMethods — 220 methods. The bar is 30 methods; this is 190 over it, 7.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Column crates/polars-core/src/frame/column/mod.rs:45 — TooManyMethods — 216 methods. The bar is 30 methods; this is 186 over it, 7.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SQLContext REDACTED:316 — TooManyMethods — 187 methods, declared across 6 files: REDACTED (148), src/subquery.rs (31), src/subquery_outer_select.rs (3), src/lateral.rs (2), +2 more file(s). The bar is 30 methods; this is 157 over it, 6.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Series crates/polars-core/src/series/mod.rs:151 — TooManyMethods — 183 methods, declared across 21 files: series/mod.rs (66), ops/downcast.rs (64), aggregations/dispatch.rs (14), series/from.rs (7), +17 more file(s). The bar is 30 methods; this is 153 over it, 6.10× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DataFrame crates/polars-core/src/frame/dataframe.rs:85 — TooManyMethods — 168 methods, declared across 16 files: frame/mod.rs (99), frame/dataframe.rs (33), row/dataframe.rs (7), frame/chunks.rs (4), +12 more file(s). The bar is 30 methods; this is 138 over it, 5.60× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ChunkedArray crates/polars-core/src/chunked_array/mod.rs:140 — TooManyMethods — 141 methods, declared across 21 files: chunked_array/mod.rs (55), ops/chunkops.rs (15), chunked_array/from.rs (14), aggregations/mod.rs (13), +17 more file(s). The bar is 30 methods; this is 111 over it, 4.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LazyFrame py-polars/src/polars/lazyframe/frame.py:196 — TooManyMethods — 131 methods. The bar is 30 methods; this is 101 over it, 4.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LazyFrame crates/polars-lazy/src/frame/mod.rs:89 — TooManyMethods — 129 methods, declared across 9 files: frame/mod.rs (114), frame/cached_arenas.rs (4), scan/parquet.rs (3), src/dot.rs (2), +5 more file(s). The bar is 30 methods; this is 99 over it, 4.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DataType crates/polars-core/src/datatypes/dtype.rs:90 — TooManyMethods — 95 methods, declared across 3 files: datatypes/dtype.rs (88), datatypes/field.rs (5), ops/json_map.rs (2). The bar is 30 methods; this is 65 over it, 3.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PyDataFrame crates/polars-python/src/dataframe/mod.rs:20 — TooManyMethods — 91 methods, declared across 8 files: dataframe/general.rs (69), dataframe/io.rs (6), dataframe/export.rs (5), dataframe/serde.rs (4), +4 more file(s). The bar is 30 methods; this is 61 over it, 3.03× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PyLazyFrame crates/polars-python/src/lazyframe/mod.rs:23 — TooManyMethods — 89 methods, declared across 4 files: lazyframe/general.rs (83), lazyframe/serde.rs (4), lazyframe/exitable.rs (1), lazyframe/visit.rs (1). The bar is 30 methods; this is 59 over it, 2.97× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AExprBuilder crates/polars-plan/src/plans/aexpr/builder.rs:16 — TooManyMethods — 79 methods. The bar is 30 methods; this is 49 over it, 2.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SQLFunctionVisitor crates/polars-sql/src/functions.rs:46 — TooManyMethods — 66 methods, declared across 2 files: src/functions.rs (57), src/window_frames.rs (9). The bar is 30 methods; this is 36 over it, 2.20× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: StringNameSpace crates/polars-plan/src/dsl/string.rs:3 — TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Config crates/polars-config/src/lib.rs:259 — TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Schema crates/polars-schema/src/schema.rs:13 — TooManyMethods — 52 methods. The bar is 30 methods; this is 22 over it, 1.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ExprStringNameSpace py-polars/src/polars/expr/string.py:43 — TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: StringNameSpace py-polars/src/polars/series/string.py:36 — TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Duration crates/polars-defs/src/time/duration.rs:40 — TooManyMethods — 46 methods. The bar is 30 methods; this is 16 over it, 1.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DateLikeNameSpace crates/polars-plan/src/dsl/dt.rs:4 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 13 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_stream · ×36
  • polars_stream::physical_plan::lower_ir::lower_ir_inner (cognitive 262) crates/polars-stream/src/physical_plan/lower_ir.rs:279 — polars_stream::physical_plan::lower_ir::lower_ir_inner has cognitive complexity 262 (threshold 15). Drivers by points: if/else 78 (170 pts), match/switch 18 (47 pts), loops 8 (24 pts), boolean chains 21 (nesting depth added 137). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::physical_plan::to_graph::to_graph_rec (cognitive 135) crates/polars-stream/src/physical_plan/to_graph.rs:137 — polars_stream::physical_plan::to_graph::to_graph_rec has cognitive complexity 135 (threshold 15). Drivers by points: if/else 31 (75 pts), loops 12 (35 pts), match/switch 9 (21 pts), boolean chains 4 (nesting depth added 79). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::physical_plan::fmt::visualize_plan_rec (cognitive 127) crates/polars-stream/src/physical_plan/fmt.rs:181 — polars_stream::physical_plan::fmt::visualize_plan_rec has cognitive complexity 127 (threshold 15). Drivers by points: if/else 49 (91 pts), loops 8 (18 pts), match/switch 9 (18 pts) (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx (cognitive 123) crates/polars-stream/src/physical_plan/lower_expr.rs:556 — polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx has cognitive complexity 123 (threshold 15). Drivers by points: if/else 30 (70 pts), match/switch 12 (35 pts), loops 5 (15 pts), boolean chains 3 (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::physical_plan::_visit_nodes_impl (cognitive 113) crates/polars-stream/src/physical_plan/mod.rs:662 — polars_stream::physical_plan::_visit_nodes_impl has cognitive complexity 113 (threshold 15). Drivers by points: if/else 33 (101 pts), loops 4 (10 pts), match/switch 1 (2 pts) (nesting depth added 75). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::nodes::io_sources::multi_scan::pipeline::initialization::finish_initialize_multi_scan_pipeline (cognitive 53) crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/initialization.rs:99 — polars_stream::nodes::io_sources::multi_scan::pipeline::initialization::finish_initialize_multi_scan_pipeline has cognitive complexity 53 (threshold 15). Drivers by points: if/else 36 (44 pts), boolean chains 7, match/switch 2 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by_with_key_ranges (cognitive 48) crates/polars-stream/src/physical_plan/lower_group_by.rs:1021 — polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by_with_key_ranges has cognitive complexity 48 (threshold 15). Drivers by points: if/else 24 (36 pts), loops 7 (8 pts), boolean chains 3, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::execute::run_subgraph (cognitive 40) crates/polars-stream/src/execute.rs:140 — polars_stream::execute::run_subgraph has cognitive complexity 40 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 11 (17 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • polars_stream::physical_plan::lower_group_by::try_lower_elementwise_scalar_agg_expr (cognitive 37) crates/polars-stream/src/physical_plan/lower_group_by.rs:263 — polars_stream::physical_plan::lower_group_by::try_lower_elementwise_scalar_agg_expr has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (25 pts), match/switch 5 (10 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::nodes::io_sources::multi_scan::pipeline::tasks::reader_starter::start_reader_impl (cognitive 36) crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/reader_starter.rs:443 — polars_stream::nodes::io_sources::multi_scan::pipeline::tasks::reader_starter::start_reader_impl has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (27 pts), match/switch 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::physical_plan::to_description::phys_props (cognitive 32) crates/polars-stream/src/physical_plan/to_description.rs:67 — polars_stream::physical_plan::to_description::phys_props has cognitive complexity 32 (threshold 15). Drivers by points: match/switch 10 (22 pts), if/else 5 (10 pts) (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_stream::nodes::merge_sorted::find_mergeable (cognitive 30) crates/polars-stream/src/nodes/merge_sorted.rs:51 — polars_stream::nodes::merge_sorted::find_mergeable has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 2 (6 pts), boolean chains 3, loops 2 (nesting depth added 12). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::execute::execute_graph (cognitive 28) crates/polars-stream/src/execute.rs:285 — polars_stream::execute::execute_graph has cognitive complexity 28 (threshold 15). Drivers by points: loops 10 (16 pts), if/else 6 (12 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_stream::nodes::joins::asof_join::distribute_work_task (cognitive 27) crates/polars-stream/src/nodes/joins/asof_join.rs:289 — polars_stream::nodes::joins::asof_join::distribute_work_task has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 4 (10 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::nodes::io_sources::multi_scan::functions::resolve_slice::resolve_negative_slice (cognitive 26) crates/polars-stream/src/nodes/io_sources/multi_scan/functions/resolve_slice.rs:44 — polars_stream::nodes::io_sources::multi_scan::functions::resolve_slice::resolve_negative_slice has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 3 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::nodes::io_sources::parquet::projection::resolve_arrow_field_projections (cognitive 25) crates/polars-stream/src/nodes/io_sources/parquet/projection.rs:410 — polars_stream::nodes::io_sources::parquet::projection::resolve_arrow_field_projections has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 4 (6 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::nodes::joins::merge_join::find_mergeable_search (cognitive 25) crates/polars-stream/src/nodes/joins/merge_join.rs:732 — polars_stream::nodes::joins::merge_join::find_mergeable_search has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12, boolean chains 10, match/switch 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • polars_stream::nodes::sort::partition_frames (cognitive 25) crates/polars-stream/src/nodes/sort/mod.rs:497 — polars_stream::nodes::sort::partition_frames has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::nodes::scalar_window::reduce_partitions (cognitive 24) crates/polars-stream/src/nodes/scalar_window.rs:527 — polars_stream::nodes::scalar_window::reduce_partitions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 7 (11 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::nodes::joins::equi_join::compute_payload_selector (cognitive 22) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:135 — polars_stream::nodes::joins::equi_join::compute_payload_selector has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • polars_stream::nodes::joins::range_join::compute_and_emit_task (cognitive 22) crates/polars-stream/src/nodes/joins/range_join.rs:306 — polars_stream::nodes::joins::range_join::compute_and_emit_task has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (7 pts), loops 3 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::physical_plan::lower_group_by::merge_min_max_by (cognitive 22) crates/polars-stream/src/physical_plan/lower_group_by.rs:898 — polars_stream::physical_plan::lower_group_by::merge_min_max_by has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::nodes::io_sources::multi_scan::pipeline::tasks::attach_reader_to_bridge::run_unordered (cognitive 21) crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/attach_reader_to_bridge.rs:90 — polars_stream::nodes::io_sources::multi_scan::pipeline::tasks::attach_reader_to_bridge::run_unordered has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::nodes::io_sources::parquet::metadata_utils::read_parquet_metadata_bytes (cognitive 21) crates/polars-stream/src/nodes/io_sources/parquet/metadata_utils.rs:8 — polars_stream::nodes::io_sources::parquet::metadata_utils::read_parquet_metadata_bytes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_stream::nodes::io_sources::parquet::projection::resolve_pruned_fields (cognitive 21) crates/polars-stream/src/nodes/io_sources/parquet/projection.rs:67 — polars_stream::nodes::io_sources::parquet::projection::resolve_pruned_fields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 11 more in this group — see findings.md.
D35 · Change Coupling · Change coupling · ×32
  • Change coupling: lib.rs ↔ sql.rs crates/polars-sql/src/lib.rs:1 — `crates/polars-sql/src/lib.rs` and `crates/polars/src/sql.rs` change together 100% of the time (11 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `46b62a71` feat: Support SQL time travel on attached Iceberg catalog tables (#30…; `ec0f9b33` feat: Support SQL `MERGE INTO` on attached Iceberg catalog tables (#3…; `077d0b23` feat: Support SQL `TRUNCATE` on attached Iceberg catalog tables (#30477) — run `git show` on any of them.
  • Change coupling: dt.rs ↔ datetime.rs crates/polars-plan/src/dsl/dt.rs:1 — `crates/polars-plan/src/dsl/dt.rs` and `crates/polars-python/src/expr/datetime.rs` change together 90% of the time (18 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 18 shared commits counted here, the most recent 3 are `9e7b2c92` chore: Remove a couple of deprecated methods (#28700); `f380d60b` feat: Support Expr for holidays in business day calculations (#26193); `785ea307` feat: Add support to output `dt.total_{}()` duration values as fracti… — run `git show` on any of them.
  • Change coupling: functions.rs ↔ ir_to_dsl.rs crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:1 — `crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs` and `crates/polars-plan/src/plans/conversion/ir_to_dsl.rs` change together 84% of the time (54 of the 64 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 54 shared commits counted here, the most recent 3 are `d9e5ab1a` fix: Make `Expr.entropy` corner cases consistent across engines (#30699); `b90f6252` feat(python): Support sinking to Iceberg table with bucket partitione…; `87e44d7b` feat: Cast the needle of `is_in` and Map lookups exactly or not at al… — run `git show` on any of them.
  • Change coupling: string.rs ↔ string.rs crates/polars-plan/src/dsl/string.rs:1 — `crates/polars-plan/src/dsl/string.rs` and `crates/polars-python/src/expr/string.rs` change together 82% of the time (42 of the 51 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 42 shared commits counted here, the most recent 3 are `16b69e77` feat: Support regex in `str.split` (#26060); `3e2413c0` feat: Add leftmost option to `str.replace_many / str.find_many / str.…; `b6687128` feat: Add dtype to str.to_integer() (#22239) — run `git show` on any of them.
  • Change coupling: list.rs ↔ list.rs crates/polars-plan/src/dsl/list.rs:1 — `crates/polars-plan/src/dsl/list.rs` and `crates/polars-python/src/expr/list.rs` change together 81% of the time (22 of the 27 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 22 shared commits counted here, the most recent 3 are `3bba9f11` refactor: Re-work `shuffle` parameter for `sample()` (#27460); `ff62eb51` perf: Dispatch `{list,arr}.{unique,n_unique,reverse}` to group_by eng…; `551ff1fb` refactor: Make `list.to_struct` and `arr.to_struct` serializable (#23… — run `git show` on any of them.
  • Change coupling: fmt.rs ↔ to_graph.rs crates/polars-stream/src/physical_plan/fmt.rs:1 — `crates/polars-stream/src/physical_plan/fmt.rs` and `crates/polars-stream/src/physical_plan/to_graph.rs` change together 79% of the time (54 of the 68 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 54 shared commits counted here, the most recent 3 are `1af57752` refactor(rust): Expose `bytes_per_source` in physical plan (#29349); `7b187dca` perf: Rechunk before selecting in group-by pre-select (#29219); `3a780c26` feat!: Respect file column order when schema is given for `scan_csv()… — run `git show` on any of them.
  • Change coupling: partition_by.rs ↔ single_file.rs crates/polars-stream/src/nodes/io_sinks/pipeline_initialization/partition_by.rs:1 — `crates/polars-stream/src/nodes/io_sinks/pipeline_initialization/partition_by.rs` and `crates/polars-stream/src/nodes/io_sinks/pipeline_initialization/single_file.rs` change together 77% of the time (10 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `5e32866c` fix: Don't finish a sink's output file when its query fails (#30279); `f6408481` fix: Fix EntityTooSmall on sink_ipc to S3 (#28255); `93bfdf9f` perf: Remove excess memory copy in streaming IPC sink (#28141) — run `git show` on any of them.
  • Change coupling: mod.rs ↔ array.rs crates/polars-ops/src/chunked_array/array/mod.rs:1 — `crates/polars-ops/src/chunked_array/array/mod.rs` and `crates/polars-plan/src/dsl/function_expr/array.rs` change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `60cb846f` feat: Add native fixed-array dot (#28504); `775152f4` feat: `list` & `array` measures of dispersion (#13245); `5fbce482` feat: Impl `count_matches` for array namespace (#13675) — run `git show` on any of them.
  • Change coupling: meta.rs ↔ meta.rs crates/polars-plan/src/dsl/meta.rs:1 — `crates/polars-plan/src/dsl/meta.rs` and `crates/polars-python/src/expr/meta.rs` change together 72% of the time (13 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `49dff65a` feat: Add `schema` parameter to `Expr.meta` properties (#30613); `5de4805c` feat: Add more expression properties to `meta` namespace (#28091); `1af179ab` refactor: Add schema parameters to `expr.meta` (#22906) — run `git show` on any of them.
  • Change coupling: list.rs ↔ list.rs crates/polars-plan/src/dsl/function_expr/list.rs:1 — `crates/polars-plan/src/dsl/function_expr/list.rs` and `crates/polars-python/src/expr/list.rs` change together 70% of the time (19 of the 27 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 19 shared commits counted here, the most recent 3 are `3bba9f11` refactor: Re-work `shuffle` parameter for `sample()` (#27460); `ff62eb51` perf: Dispatch `{list,arr}.{unique,n_unique,reverse}` to group_by eng…; `551ff1fb` refactor: Make `list.to_struct` and `arr.to_struct` serializable (#23… — run `git show` on any of them.
  • Change coupling: datetime.rs ↔ datetime.rs crates/polars-plan/src/dsl/function_expr/datetime.rs:1 — `crates/polars-plan/src/dsl/function_expr/datetime.rs` and `crates/polars-python/src/expr/datetime.rs` change together 70% of the time (14 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `9e7b2c92` chore: Remove a couple of deprecated methods (#28700); `785ea307` feat: Add support to output `dt.total_{}()` duration values as fracti…; `52eea507` feat: Implement `dt.days_in_month` function (#23119) — run `git show` on any of them.
  • Change coupling: dispatch_left_right.rs ↔ mod.rs crates/polars-ops/src/frame/join/dispatch_left_right.rs:1 — `crates/polars-ops/src/frame/join/dispatch_left_right.rs` and `crates/polars-ops/src/frame/join/hash_join/mod.rs` change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `f16e1817` fix: More careful slice pushdown into joins (#28578); `961f45f5` feat: Add POLARS_OOC_DISK_BUDGET_MB (#28045); `f826c32d` feat: Periodically check python signals ('CTRL-C' handling) (#20826) — run `git show` on any of them.
  • Change coupling: default.rs ↔ groups.rs crates/polars-ops/src/frame/join/asof/default.rs:1 — `crates/polars-ops/src/frame/join/asof/default.rs` and `crates/polars-ops/src/frame/join/asof/groups.rs` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `8bd626a6` perf: Push as-of join key filters to the right input (#30123); `46b27141` feat: Add 'allow_exact_matches' join_asof' (#20723); `1a9c7709` perf: fix regression non-null asof join (#11984) — run `git show` on any of them.
  • Change coupling: mod.rs ↔ mod.rs crates/polars-stream/src/nodes/io_sources/csv/mod.rs:1 — `crates/polars-stream/src/nodes/io_sources/csv/mod.rs` and `crates/polars-stream/src/nodes/io_sources/ndjson/mod.rs` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `c0dee8fa` perf: Limit the bytes of local CSV and NDJSON files read at once in m…; `e880400f` perf: Reduce requests and raise concurrency for cloud CSV scans (#29863); `2e5ec84f` perf: Reduce requests and raise concurrency for cloud NDJSON scans (#… — run `git show` on any of them.
  • Change coupling: REDACTED ↔ _options.py py-polars/src/polars/io/iceberg/_dataset.py:1 — `py-polars/src/polars/io/iceberg/_dataset.py` and `py-polars/src/polars/io/scan_options/_options.py` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `bdbf3bf2` feat: Answer min, max and counts over an Iceberg scan from manifest s…; `1eb456a7` perf(python): Reuse Iceberg data file sizes (#29063); `3e6dbf02` depr(python): Deprecate `retries=n` in favor of `storage_options={"ma… — run `git show` on any of them.
  • Change coupling: iterator.rs ↔ array.rs crates/polars-core/src/chunked_array/array/iterator.rs:1 — `crates/polars-core/src/chunked_array/array/iterator.rs` and `crates/polars-plan/src/dsl/array.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `e1bba070` feat: Implements `arr.n_unique` (#15296); `279540f0` feat: Implements `arr.shift` (#14298); `fb40db74` feat: Impl `join` for ArrayNameSpace (#13586) — run `git show` on any of them.
  • Change coupling: projection.rs ↔ stack.rs crates/polars-mem-engine/src/executors/projection.rs:1 — `crates/polars-mem-engine/src/executors/projection.rs` and `crates/polars-mem-engine/src/executors/stack.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `ca8c1ef9` fix: Allow nested `is_in()` in `when()/then()` for full-streaming (#2…; `0f647852` perf: Rechunk in DataFrame.rows if needed (#19628); `0161efda` feat(rust): eliminate ProjectionExprs and handle CSE by stacking extr… (at that commit the files were still `crates/polars-lazy/src/physical_plan/executors/projection.rs` and `crates/polars-lazy/src/physical_plan/executors/stack.rs`) — run `git show` on any of them.
  • Change coupling: namespace.rs ↔ binary.rs crates/polars-ops/src/chunked_array/binary/namespace.rs:1 — `crates/polars-ops/src/chunked_array/binary/namespace.rs` and `crates/polars-plan/src/dsl/function_expr/binary.rs` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `7919df6b` feat(rust,python): Add `bin.slice()`, `bin.head()`, and `bin.tail()` …; `5d429ea8` feat: Reinterpret binary data to fixed size numerical array (#22840); `50e44a29` refactor: Rename from_buffer()/FromBuffer to reinterpret()/Reinterpre… — run `git show` on any of them.
  • Change coupling: mean.rs ↔ sum.rs crates/polars-expr/src/reduce/mean.rs:1 — `crates/polars-expr/src/reduce/mean.rs` and `crates/polars-expr/src/reduce/sum.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `cdca1b64` perf: Vectorize Decimal mean and sum reductions (#30704); `93a0ff85` perf: Spread decimal sums and means over lanes and check the sum's 38…; `a9effe7d` perf: Add eviction-free path to GroupedReduction, with lanes (#29613) — run `git show` on any of them.
  • Change coupling: callback.rs ↔ on_startup.rs crates/polars-plan/src/callback.rs:1 — `crates/polars-plan/src/callback.rs` and `crates/polars-python/src/on_startup.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `8a876161` feat: New Expression and function: pipe_with_dtype (#29547); `2273b001` refactor: Update partitioned sink IR (#25524); `70f39e0c` refactor(rust): Take `&dyn Any` instead of `Box<dyn Any>` in python o… — run `git show` on any of them.
  • Change coupling: sink.rs ↔ to_graph.rs crates/polars-python/src/lazyframe/sink.rs:1 — `crates/polars-python/src/lazyframe/sink.rs` and `crates/polars-stream/src/physical_plan/to_graph.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `952f9707` refactor(rust): Remove old sink IR (#26130); `5993d953` feat: Add per partition sort and finish callback to sinks (#22789); `ebe03be7` feat: Allow sinking to abstract python `io` and `fs` classes (#21987) — run `git show` on any of them.
  • Change coupling: mod.rs ↔ mod.rs crates/polars-stream/src/nodes/io_sinks/writers/ipc/mod.rs:1 — `crates/polars-stream/src/nodes/io_sinks/writers/ipc/mod.rs` and `crates/polars-stream/src/nodes/io_sinks/writers/parquet/mod.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `8e83bc55` feat: Re-work behavior of arrow_schema parameter on sink_parquet (#26…; `965b0631` refactor(rust): Pass `sync_on_close` and `num_pipelines` via `start_f… (at that commit the files were still `crates/polars-stream/src/nodes/io_sinks2/writers/ipc/mod.rs` and `crates/polars-stream/src/nodes/io_sinks2/writers/parquet/mod.rs`); `7b70f90d` refactor(rust): Rename `FileType` to `FileWriteFormat` (#25951) (at that commit the files were still `crates/polars-stream/src/nodes/io_sinks2/writers/ipc/mod.rs` and `crates/polars-stream/src/nodes/io_sinks2/writers/parquet/mod.rs`) — run `git show` on any of them.
  • Change coupling: rolling.rs ↔ REDACTED crates/polars-plan/src/dsl/function_expr/rolling.rs:1 — `crates/polars-plan/src/dsl/function_expr/rolling.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/schema.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `ef1275f7` feat: Make `rolling_map` serializable (#23848); `1e64bb20` refactor(rust): Move `options` out of `RollingFunction` (#23430); `35808295` feat: Add `rolling_kurtosis` (#22335) (at that commit the file was still `crates/polars-plan/src/dsl/function_expr/schema.rs`) — run `git show` on any of them.
  • Change coupling: mod.rs ↔ fmt.rs crates/polars-stream/src/nodes/joins/mod.rs:1 — `crates/polars-stream/src/nodes/joins/mod.rs` and `crates/polars-stream/src/physical_plan/fmt.rs` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `032a7656` feat: Add a streaming range-join (#26790); `7326130c` feat: Add streaming `AsOf` join node (#26398); `a98888e6` feat(rust): Add streaming merge-join (#25964) — run `git show` on any of them.
  • Change coupling: single_file.rs ↔ io_writer.rs crates/polars-stream/src/nodes/io_sinks/pipeline_initialization/single_file.rs:1 — `crates/polars-stream/src/nodes/io_sinks/pipeline_initialization/single_file.rs` and `crates/polars-stream/src/nodes/io_sinks/writers/ipc/io_writer.rs` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `5e32866c` fix: Don't finish a sink's output file when its query fails (#30279); `f6408481` fix: Fix EntityTooSmall on sink_ipc to S3 (#28255); `93bfdf9f` perf: Remove excess memory copy in streaming IPC sink (#28141) — run `git show` on any of them.
  • + 7 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×31
  • Edited copy of a member (12 corresponding lines) crates/polars-expr/src/idx_table/binview.rs:129 — crates/polars-expr/src/idx_table/binview.rs:129-172 | crates/polars-expr/src/idx_table/single_key.rs:180-191 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-time/src/series/mod.rs:151 — crates/polars-time/src/series/mod.rs:151-162 | crates/polars-time/src/series/mod.rs:165-176 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-plan/src/plans/aexpr/predicates/mod.rs:49 — crates/polars-plan/src/plans/aexpr/predicates/mod.rs:49-60 | crates/polars-plan/src/plans/aexpr/predicates/skip_batches.rs:167-178 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-ops/src/chunked_array/gather/chunked.rs:445 — crates/polars-ops/src/chunked_array/gather/chunked.rs:445-456 | crates/polars-ops/src/chunked_array/gather/chunked.rs:463-478 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-expr/src/reduce/mod.rs:407 — crates/polars-expr/src/reduce/mod.rs:407-418 | crates/polars-expr/src/reduce/mod.rs:669-682 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-ops/src/chunked_array/array/join.rs:93 — crates/polars-ops/src/chunked_array/array/join.rs:93-104 | crates/polars-ops/src/chunked_array/list/namespace.rs:60-72 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-python/src/series/aggregation.rs:66 — crates/polars-python/src/series/aggregation.rs:66-77 | crates/polars-python/src/series/aggregation.rs:79-90 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-expr/src/reduce/first_last.rs:476 — crates/polars-expr/src/reduce/first_last.rs:476-487 | crates/polars-expr/src/reduce/first_last_nonnull.rs:468-479 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-compute/src/moment.rs:162 — crates/polars-compute/src/moment.rs:162-173 | crates/polars-compute/src/moment.rs:236-249 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-core/src/chunked_array/ops/arity.rs:442 — crates/polars-core/src/chunked_array/ops/arity.rs:442-454 | crates/polars-core/src/chunked_array/ops/zip.rs:50-61 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-compute/src/cast/decimal_to.rs:60 — crates/polars-compute/src/cast/decimal_to.rs:60-71 | crates/polars-compute/src/cast/decimal_to.rs:88-99 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:171 — crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:171-185 | crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:404-415 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) py-polars/src/polars/selectors.py:235 — py-polars/src/polars/selectors.py:235-246 | py-polars/src/polars/selectors.py:256-271 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-expr/src/reduce/min_max.rs:333 — crates/polars-expr/src/reduce/min_max.rs:333-344 | crates/polars-expr/src/reduce/min_max.rs:382-393 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-compute/src/rolling/quantile_filter.rs:147 — crates/polars-compute/src/rolling/quantile_filter.rs:147-158 | crates/polars-compute/src/rolling/quantile_filter.rs:160-171 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) REDACTED:2624 — REDACTED:2624-2636 | REDACTED:2652-2663 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-expr/src/dispatch/array.rs:160 — crates/polars-expr/src/dispatch/array.rs:160-172 | crates/polars-expr/src/dispatch/list.rs:299-310 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-plan/src/plans/functions/mod.rs:193 — crates/polars-plan/src/plans/functions/mod.rs:193-204 | crates/polars-plan/src/plans/functions/mod.rs:206-217 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-python/src/functions/eager.rs:68 — crates/polars-python/src/functions/eager.rs:68-79 | crates/polars-python/src/functions/eager.rs:86-97 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-ooc/src/spill_context/stats.rs:220 — crates/polars-ooc/src/spill_context/stats.rs:220-231 | crates/polars-ooc/src/spill_context/stats.rs:233-246 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-io/src/parquet/write/batched_writer.rs:53 — crates/polars-io/src/parquet/write/batched_writer.rs:53-68 | crates/polars-io/src/parquet/write/batched_writer.rs:164-175 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-ooc/src/decay.rs:247 — crates/polars-ooc/src/decay.rs:247-258 | crates/polars-ooc/src/decay.rs:268-280 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-parquet/src/parquet/statistics/boolean.rs:46 — crates/polars-parquet/src/parquet/statistics/boolean.rs:46-57 | crates/polars-parquet/src/parquet/statistics/primitive.rs:47-58 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) py-polars/src/polars/_utils/convert.py:91 — py-polars/src/polars/_utils/convert.py:91-107 | py-polars/src/polars/_utils/convert.py:111-122 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) crates/polars-stream/src/nodes/group_by/tuning.rs:114 — crates/polars-stream/src/nodes/group_by/tuning.rs:114-125 | crates/polars-stream/src/nodes/window/tuning.rs:60-71 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 6 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_parquet · ×30
  • polars_parquet::arrow::read::deserialize::utils::unspecialized_decode (cognitive 53) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:122 — polars_parquet::arrow::read::deserialize::utils::unspecialized_decode has cognitive complexity 53 (threshold 15). Drivers by points: loops 13 (33 pts), if/else 7 (14 pts), match/switch 4 (6 pts) (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_parquet::arrow::read::deserialize::dictionary_encoded::optional::decode (cognitive 50) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs:14 — polars_parquet::arrow::read::deserialize::dictionary_encoded::optional::decode has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (37 pts), loops 3 (10 pts), match/switch 1 (3 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_dict (cognitive 43) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:344 — polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_dict has cognitive complexity 43 (threshold 15). Drivers by points: loops 5 (17 pts), if/else 4 (14 pts), match/switch 5 (12 pts) (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_parquet::arrow::read::deserialize::binview::decode_plain_generic (cognitive 42) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:383 — polars_parquet::arrow::read::deserialize::binview::decode_plain_generic has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (29 pts), match/switch 3 (6 pts), boolean chains 5, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::write::array_to_page_simple (cognitive 39) crates/polars-parquet/src/arrow/write/mod.rs:364 — polars_parquet::arrow::write::array_to_page_simple has cognitive complexity 39 (threshold 15). Drivers by points: if/else 24 (37 pts), boolean chains 1, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::write::pages::to_nested_recursive (cognitive 39) crates/polars-parquet/src/arrow/write/pages.rs:136 — polars_parquet::arrow::write::pages::to_nested_recursive has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_plain (cognitive 38) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:214 — polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_plain has cognitive complexity 38 (threshold 15). Drivers by points: loops 4 (15 pts), if/else 4 (14 pts), match/switch 4 (9 pts) (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_parquet::arrow::write::array_to_page_nested (cognitive 30) crates/polars-parquet/src/arrow/write/mod.rs:815 — polars_parquet::arrow::write::array_to_page_nested has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::read::deserialize::binary::dictionary::decode_dictionary (cognitive 29) crates/polars-parquet/src/arrow/read/deserialize/binary/dictionary.rs:7 — polars_parquet::arrow::read::deserialize::binary::dictionary::decode_dictionary has cognitive complexity 29 (threshold 15). Drivers by points: loops 7 (19 pts), if/else 2 (6 pts), match/switch 2 (4 pts) (nesting depth added 18). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_parquet::arrow::write::schema::to_parquet_type (cognitive 29) crates/polars-parquet/src/arrow/write/schema.rs:96 — polars_parquet::arrow::write::schema::to_parquet_type has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (23 pts), match/switch 4 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::read::deserialize::dictionary_encoded::optional_masked_dense::decode (cognitive 28) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs:10 — polars_parquet::arrow::read::deserialize::dictionary_encoded::optional_masked_dense::decode has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (10 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::read::deserialize::dictionary_encoded::required_masked_dense::decode (cognitive 28) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required_masked_dense.rs:10 — polars_parquet::arrow::read::deserialize::dictionary_encoded::required_masked_dense::decode has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (10 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::write::dictionary::array_to_pages (cognitive 28) crates/polars-parquet/src/arrow/write/dictionary.rs:497 — polars_parquet::arrow::write::dictionary::array_to_pages has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 2 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::write::get_encodings_recursive (cognitive 26) crates/polars-parquet/src/arrow/write/mod.rs:1135 — polars_parquet::arrow::write::get_encodings_recursive has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 2 (7 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_parquet::arrow::read::deserialize::nested_utils::collect_value (cognitive 25) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs:745 — polars_parquet::arrow::read::deserialize::nested_utils::collect_value has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (9 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::read::deserialize::dictionary_encoded::required::decode (cognitive 24) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required.rs:9 — polars_parquet::arrow::read::deserialize::dictionary_encoded::required::decode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::read::deserialize::nested::columns_to_iter_recursive (cognitive 23) crates/polars-parquet/src/arrow/read/deserialize/nested.rs:15 — polars_parquet::arrow::read::deserialize::nested::columns_to_iter_recursive has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (6 pts), match/switch 2 (6 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::read::deserialize::nested_utils::decode_nested (cognitive 23) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs:812 — polars_parquet::arrow::read::deserialize::nested_utils::decode_nested has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::geo::geo_key_value (cognitive 22) crates/polars-parquet/src/arrow/geo.rs:185 — polars_parquet::arrow::geo::geo_key_value has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (5 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::geo::apply_geo_metadata (cognitive 21) crates/polars-parquet/src/arrow/geo.rs:91 — polars_parquet::arrow::geo::apply_geo_metadata has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2 (4 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::parquet::encoding::hybrid_rle::encoder::encode (cognitive 21) crates/polars-parquet/src/parquet/encoding/hybrid_rle/encoder.rs:147 — polars_parquet::parquet::encoding::hybrid_rle::encoder::encode has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::parquet::encryption::decrypt::decrypt_column_metadata (cognitive 19) crates/polars-parquet/src/parquet/encryption/decrypt.rs:124 — polars_parquet::parquet::encryption::decrypt::decrypt_column_metadata has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 2 (7 pts), loops 4 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::write::slice_parquet_array (cognitive 18) crates/polars-parquet/src/arrow/write/mod.rs:228 — polars_parquet::arrow::write::slice_parquet_array has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::read::deserialize::binview::delta::decode_delta_length (cognitive 17) crates/polars-parquet/src/arrow/read/deserialize/binview/delta.rs:87 — polars_parquet::arrow::read::deserialize::binview::delta::decode_delta_length has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_parquet::arrow::read::deserialize::dictionary_encoded::predicate::decode_single (cognitive 17) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:33 — polars_parquet::arrow::read::deserialize::dictionary_encoded::predicate::decode_single has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (polars_parquet::arrow::read::deserialize::dictionary_encoded::predicate::decode_multiple) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • + 5 more in this group — see findings.md.
D2 · Cognitive Complexity · SQLContext · ×29
  • SQLContext::execute_select_block (cognitive 114) REDACTED:3575 — SQLContext::execute_select_block has cognitive complexity 114 (threshold 15). Drivers by points: if/else 44 (79 pts), match/switch 8 (16 pts), loops 8 (12 pts), boolean chains 7 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::process_group_by (cognitive 103) REDACTED:6271 — SQLContext::process_group_by has cognitive complexity 103 (threshold 15). Drivers by points: if/else 50 (77 pts), boolean chains 9, loops 7 (9 pts), match/switch 7 (8 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::group_by_in_derived_table (cognitive 63) crates/polars-sql/src/subquery_group_by.rs:278 — SQLContext::group_by_in_derived_table has cognitive complexity 63 (threshold 15). Drivers by points: if/else 28 (43 pts), boolean chains 11, loops 5 (6 pts), match/switch 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::join_inputs (cognitive 46) REDACTED:4524 — SQLContext::join_inputs has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 5 (10 pts), boolean chains 6, match/switch 4 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::lateral_join (cognitive 45) crates/polars-sql/src/lateral.rs:385 — SQLContext::lateral_join has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (21 pts), match/switch 9 (13 pts), boolean chains 8, loops 3 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • SQLContext::try_attach_join_membership (cognitive 45) crates/polars-sql/src/subquery.rs:1253 — SQLContext::try_attach_join_membership has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (34 pts), match/switch 5, boolean chains 4, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::try_decorrelate_scalar_subquery (cognitive 45) crates/polars-sql/src/subquery.rs:1656 — SQLContext::try_decorrelate_scalar_subquery has cognitive complexity 45 (threshold 15). Drivers by points: if/else 22 (29 pts), boolean chains 7, match/switch 3 (7 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • SQLContext::execute_joins (cognitive 43) REDACTED:2985 — SQLContext::execute_joins has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (23 pts), match/switch 4 (14 pts), loops 2 (6 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::get_table (cognitive 37) REDACTED:5852 — SQLContext::get_table has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (31 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::process_join_on_subqueries (cognitive 36) REDACTED:4765 — SQLContext::process_join_on_subqueries has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 4, match/switch 3 (4 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::try_first_row_order (cognitive 35) crates/polars-sql/src/subquery.rs:944 — SQLContext::try_first_row_order has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 2 (6 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::try_decorrelate_in_subquery (cognitive 32) crates/polars-sql/src/subquery.rs:1890 — SQLContext::try_decorrelate_in_subquery has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (17 pts), match/switch 5 (9 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • SQLContext::rewrite_exists (cognitive 30) crates/polars-sql/src/subquery.rs:2203 — SQLContext::rewrite_exists has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::merge_plan (cognitive 27) REDACTED:855 — SQLContext::merge_plan has cognitive complexity 27 (threshold 15). Drivers by points: loops 5 (12 pts), match/switch 7 (12 pts), if/else 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::process_wildcard_additional_options (cognitive 26) REDACTED:6876 — SQLContext::process_wildcard_additional_options has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (5 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::execute_create_table (cognitive 24) REDACTED:5750 — SQLContext::execute_create_table has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (8 pts), loops 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::process_order_by (cognitive 24) REDACTED:6023 — SQLContext::process_order_by has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 3 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::expr_or_ordinal (cognitive 22) REDACTED:1725 — SQLContext::expr_or_ordinal has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 2 (5 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SQLContext::process_implicit_joins (cognitive 22) REDACTED:5495 — SQLContext::process_implicit_joins has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 3 (6 pts), loops 2, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::rewrite_subquery_conjuncts (cognitive 22) crates/polars-sql/src/subquery.rs:58 — SQLContext::rewrite_subquery_conjuncts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SQLContext::register_ctes (cognitive 20) REDACTED:2707 — SQLContext::register_ctes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::process_where (cognitive 20) REDACTED:4334 — SQLContext::process_where has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (7 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SQLContext::subqueries_join_inputs (cognitive 19) crates/polars-sql/src/subquery.rs:1459 — SQLContext::subqueries_join_inputs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLContext::outer_select_item (cognitive 19) crates/polars-sql/src/subquery_outer_select.rs:154 — SQLContext::outer_select_item has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, match/switch 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • SQLContext::process_asof_join (cognitive 17) REDACTED:5337 — SQLContext::process_asof_join has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 4 (5 pts), match/switch 3, boolean chains 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 4 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×29
  • Duplicated block (14 lines × 2) crates/polars-compute/src/rolling/no_nulls/rank.rs:115 — crates/polars-compute/src/rolling/no_nulls/rank.rs:115-128 | crates/polars-compute/src/rolling/nulls/rank.rs:122-135 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/rolling/no_nulls/rank.rs:115` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-compute/src/rolling/nulls/rank.rs:136` calls `values`, `as_slice`, `validity` and `crates/polars-compute/src/rolling/no_nulls/rank.rs:129` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) crates/polars-core/src/chunked_array/arg_min_max.rs:171 — crates/polars-core/src/chunked_array/arg_min_max.rs:171-184 | crates/polars-core/src/chunked_array/arg_min_max.rs:216-229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/arg_min_max.rs:171` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-core/src/chunked_array/builder/list/binary.rs:33 — crates/polars-core/src/chunked_array/builder/list/binary.rs:33-46 | crates/polars-core/src/chunked_array/builder/list/binary.rs:107-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `ca` to `&StringChunked` in one and `&BinaryChunked` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (14 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1088 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1088-1101 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1168-1181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:1088` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-core/src/series/arithmetic/list.rs:551 — crates/polars-core/src/series/arithmetic/list.rs:551-564 | crates/polars-core/src/series/arithmetic/list.rs:652-665 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/list.rs:551` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (14 lines × 2) crates/polars-expr/src/expressions/apply.rs:305 — crates/polars-expr/src/expressions/apply.rs:305-318 | crates/polars-expr/src/expressions/apply.rs:330-343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/apply.rs:305` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-expr/src/expressions/group_iter.rs:106 — crates/polars-expr/src/expressions/group_iter.rs:106-119 | crates/polars-expr/src/expressions/group_iter.rs:136-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/group_iter.rs:106` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-expr/src/expressions/slice.rs:187 — crates/polars-expr/src/expressions/slice.rs:187-200 | crates/polars-expr/src/expressions/slice.rs:230-243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/slice.rs:187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-expr/src/expressions/structeval.rs:242 — crates/polars-expr/src/expressions/structeval.rs:242-255 | crates/polars-expr/src/expressions/structeval.rs:285-298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/polars-io/src/utils/file.rs:52 — crates/polars-io/src/utils/file.rs:52-65 | crates/polars-io/src/utils/file.rs:77-90 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/utils/file.rs:52` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-lazy/src/frame/mod.rs:1032 — crates/polars-lazy/src/frame/mod.rs:1032-1045 | crates/polars-lazy/src/frame/mod.rs:1150-1163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-lazy/src/frame/mod.rs:1032` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-mem-engine/src/planner/lp.rs:824 — crates/polars-mem-engine/src/planner/lp.rs:824-837 | crates/polars-mem-engine/src/planner/lp.rs:851-864 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-mem-engine/src/planner/lp.rs:824` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-ops/src/chunked_array/gather/chunked.rs:540 — crates/polars-ops/src/chunked_array/gather/chunked.rs:540-553 | crates/polars-ops/src/chunked_array/gather/chunked.rs:750-763 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/gather/chunked.rs:540` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-ops/src/chunked_array/list/namespace.rs:638 — crates/polars-ops/src/chunked_array/list/namespace.rs:638-651 | crates/polars-ops/src/chunked_array/list/namespace.rs:675-688 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/namespace.rs:638` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:116 — crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:116-129 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:183-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:116` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) crates/polars-ops/src/chunked_array/strings/namespace.rs:617 — crates/polars-ops/src/chunked_array/strings/namespace.rs:617-630 | crates/polars-ops/src/chunked_array/strings/namespace.rs:658-671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/strings/namespace.rs:617` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-ops/src/frame/join/iejoin/mod.rs:690 — crates/polars-ops/src/frame/join/iejoin/mod.rs:690-703 | crates/polars-ops/src/frame/join/iejoin/mod.rs:824-837 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/iejoin/mod.rs:690` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:281 — crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:281-294 | crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:435-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:281` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:88 — crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:88-101 | crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:133-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:572 — crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:572-585 | crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:766-779 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:572` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) crates/polars-plan/src/plans/conversion/type_coercion/binary.rs:694 — crates/polars-plan/src/plans/conversion/type_coercion/binary.rs:694-707 | crates/polars-plan/src/plans/conversion/type_coercion/binary.rs:711-724 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/type_coercion/binary.rs:694` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-plan/src/plans/optimizer/join_utils.rs:183 — crates/polars-plan/src/plans/optimizer/join_utils.rs:183-196 | crates/polars-plan/src/plans/optimizer/predicate_pushdown/utils.rs:731-744 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/join_utils.rs:183` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1129 — crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1129-1142 | crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1275-1288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1129` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-plan/src/plans/python/pyarrow.rs:382 — crates/polars-plan/src/plans/python/pyarrow.rs:382-395 | crates/polars-plan/src/plans/python/pyarrow.rs:827-840 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/python/pyarrow.rs:382` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/polars-stream/src/nodes/io_sources/csv/line_batch_source.rs:285 — crates/polars-stream/src/nodes/io_sources/csv/line_batch_source.rs:285-298 | crates/polars-stream/src/nodes/io_sources/ndjson/line_batch_distributor.rs:99-112 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/csv/line_batch_source.rs:285` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 4 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×28
  • Edited copy of a member (13 corresponding lines) crates/polars-parquet/src/parquet/statistics/mod.rs:44 — crates/polars-parquet/src/parquet/statistics/mod.rs:44-56 | crates/polars-parquet/src/parquet/statistics/mod.rs:58-70 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-core/src/chunked_array/ops/arity.rs:771 — crates/polars-core/src/chunked_array/ops/arity.rs:771-783 | crates/polars-core/src/chunked_array/ops/arity.rs:796-808 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-sql/src/functions.rs:3071 — crates/polars-sql/src/functions.rs:3071-3083 | crates/polars-sql/src/functions.rs:3086-3098 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-core/src/datatypes/dtype.rs:332 — crates/polars-core/src/datatypes/dtype.rs:332-344 | crates/polars-core/src/datatypes/dtype.rs:1434-1449 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-ops/src/series/ops/is_in/binary.rs:134 — crates/polars-ops/src/series/ops/is_in/binary.rs:134-150 | crates/polars-ops/src/series/ops/is_in/binary.rs:186-198 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-json/src/json/deserialize.rs:26 — crates/polars-json/src/json/deserialize.rs:26-38 | crates/polars-json/src/json/deserialize.rs:105-118 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-plan/src/plans/optimizer/predicate_pushdown/dynamic.rs:161 — crates/polars-plan/src/plans/optimizer/predicate_pushdown/dynamic.rs:161-173 | crates/polars-plan/src/plans/optimizer/predicate_pushdown/dynamic.rs:180-192 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:762 — crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:762-774 | crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:778-790 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-plan/src/plans/ir/dot.rs:452 — crates/polars-plan/src/plans/ir/dot.rs:452-464 | crates/polars-plan/src/plans/ir/dot.rs:468-480 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-core/src/series/series_trait.rs:609 — crates/polars-core/src/series/series_trait.rs:609-621 | crates/polars-core/src/series/series_trait.rs:641-655 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-plan/src/plans/functions/mod.rs:244 — crates/polars-plan/src/plans/functions/mod.rs:244-257 | crates/polars-plan/src/plans/functions/mod.rs:264-276 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-plan/src/plans/options.rs:584 — crates/polars-plan/src/plans/options.rs:584-596 | crates/polars-plan/src/plans/options.rs:633-645 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-io/src/cloud/polars_object_store.rs:700 — crates/polars-io/src/cloud/polars_object_store.rs:700-713 | crates/polars-io/src/cloud/polars_object_store.rs:784-796 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-expr/src/key_rows/keys.rs:470 — crates/polars-expr/src/key_rows/keys.rs:470-482 | crates/polars-expr/src/key_rows/keys.rs:556-569 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-compute/src/rolling/no_nulls/mod.rs:142 — crates/polars-compute/src/rolling/no_nulls/mod.rs:142-154 | crates/polars-compute/src/rolling/no_nulls/mod.rs:172-184 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-core/src/frame/column/mod.rs:1405 — crates/polars-core/src/frame/column/mod.rs:1405-1417 | crates/polars-core/src/frame/column/mod.rs:1418-1430 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:183 — crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:183-199 | crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:208-220 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-ops/src/chunked_array/array/namespace.rs:43 — crates/polars-ops/src/chunked_array/array/namespace.rs:43-55 | crates/polars-ops/src/chunked_array/list/namespace.rs:156-168 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) REDACTED:99 — REDACTED:99-115 | REDACTED:161-173 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-plan/src/dsl/file_scan/mod.rs:395 — crates/polars-plan/src/dsl/file_scan/mod.rs:395-408 | crates/polars-plan/src/dsl/file_scan/mod.rs:411-423 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-io-ext-ffi/src/common.rs:418 — REDACTED:150-162 | crates/polars-io-ext-ffi/src/common.rs:418-430 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) py-polars/src/polars/io/parquet/encryption/_properties.py:68 — py-polars/src/polars/io/parquet/encryption/_properties.py:68-84 | py-polars/src/polars/io/parquet/encryption/_properties.py:126-138 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-core/src/chunked_array/builder/list/primitive.rs:21 — crates/polars-core/src/chunked_array/builder/list/primitive.rs:21-35 | crates/polars-core/src/chunked_array/builder/list/primitive.rs:43-55 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-python/src/conversion/mod.rs:1291 — crates/polars-python/src/conversion/mod.rs:1291-1303 | pyo3-polars/pyo3-polars/src/types.rs:95-107 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/polars-python/src/conversion/mod.rs:954 — crates/polars-python/src/conversion/mod.rs:954-966 | crates/polars-python/src/conversion/mod.rs:1051-1063 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 3 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_core · ×27
  • polars_core::chunked_array::ops::search_sorted::binary_search_ca (cognitive 53) crates/polars-core/src/chunked_array/ops/search_sorted.rs:139 — polars_core::chunked_array::ops::search_sorted::binary_search_ca has cognitive complexity 53 (threshold 15). Drivers by points: if/else 28 (52 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::utils::supertype::get_supertype_with_options::inner (cognitive 50) crates/polars-core/src/utils/supertype.rs:154 — polars_core::utils::supertype::get_supertype_with_options::inner has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 6 (13 pts), boolean chains 9, loops 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::chunked_array::ops::append::update_sorted_flag_before_append (cognitive 40) crates/polars-core/src/chunked_array/ops/append.rs:38 — polars_core::chunked_array::ops::append::update_sorted_flag_before_append has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 13, match/switch 2 (5 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_core::fmt::iso_duration_string (cognitive 37) crates/polars-core/src/fmt.rs:1075 — polars_core::fmt::iso_duration_string has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 2, match/switch 2, loops 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • polars_core::utils::supertype::get_numeric_upcast_supertype_lossless (cognitive 35) crates/polars-core/src/utils/supertype.rs:29 — polars_core::utils::supertype::get_numeric_upcast_supertype_lossless has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (22 pts), match/switch 4 (8 pts), boolean chains 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::chunked_array::comparison::_list_comparison_helper (cognitive 32) crates/polars-core/src/chunked_array/comparison/mod.rs:647 — polars_core::chunked_array::comparison::_list_comparison_helper has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (31 pts), match/switch 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (polars_core::chunked_array::comparison::_array_comparison_helper) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_core::chunked_array::comparison::_array_comparison_helper (cognitive 32) crates/polars-core/src/chunked_array/comparison/mod.rs:891 — polars_core::chunked_array::comparison::_array_comparison_helper has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (31 pts), match/switch 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (polars_core::chunked_array::comparison::_list_comparison_helper) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_core::chunked_array::ops::bits::first_true_idx_impl (cognitive 28) crates/polars-core/src/chunked_array/ops/bits.rs:3 — polars_core::chunked_array::ops::bits::first_true_idx_impl has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::fmt::fmt_float (cognitive 28) crates/polars-core/src/fmt.rs:924 — polars_core::fmt::fmt_float has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 1 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::series::any_value::any_values_to_list (cognitive 27) crates/polars-core/src/series/any_value.rs:699 — polars_core::series::any_value::any_values_to_list has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 4 (11 pts), loops 3 (9 pts), if/else 2 (6 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::frame::validation::validate_columns_slice (cognitive 25) crates/polars-core/src/frame/validation.rs:7 — polars_core::frame::validation::validate_columns_slice has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::chunked_array::ops::search_sorted::search_sorted_slice (cognitive 24) crates/polars-core/src/chunked_array/ops/search_sorted.rs:257 — polars_core::chunked_array::ops::search_sorted::search_sorted_slice has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 4 (8 pts), match/switch 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::chunked_array::ops::sort::arg_sort::arg_sort (cognitive 21) crates/polars-core/src/chunked_array/ops/sort/arg_sort.rs:114 — polars_core::chunked_array::ops::sort::arg_sort::arg_sort has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 7, match/switch 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • polars_core::series::any_value::any_values_to_string::any_values_to_string_nonstrict::_write_any_value (cognitive 21) crates/polars-core/src/series/any_value.rs:352 — polars_core::series::any_value::any_values_to_string::any_values_to_string_nonstrict::_write_any_value has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 4 (8 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_core::series::any_value::any_values_to_array (cognitive 20) crates/polars-core/src/series/any_value.rs:785 — polars_core::series::any_value::any_values_to_array has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 3 (8 pts), boolean chains 2 (nesting depth added 7). Of this number, 18 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • polars_core::fmt::fmt_duration_string (cognitive 19) crates/polars-core/src/fmt.rs:1022 — polars_core::fmt::fmt_duration_string has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 3 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::chunked_array::arg_min_max::arg_min_numeric_chunked (cognitive 18) crates/polars-core/src/chunked_array/arg_min_max.rs:163 — polars_core::chunked_array::arg_min_max::arg_min_numeric_chunked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (polars_core::chunked_array::arg_min_max::arg_max_numeric_chunked) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_core::chunked_array::arg_min_max::arg_max_numeric_chunked (cognitive 18) crates/polars-core/src/chunked_array/arg_min_max.rs:208 — polars_core::chunked_array::arg_min_max::arg_max_numeric_chunked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (polars_core::chunked_array::arg_min_max::arg_min_numeric_chunked) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_core::chunked_array::temporal::conversion::get_strftime_format (cognitive 18) crates/polars-core/src/chunked_array/temporal/conversion.rs:52 — polars_core::chunked_array::temporal::conversion::get_strftime_format has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::utils::split_and_flatten (cognitive 18) crates/polars-core/src/utils/mod.rs:274 — polars_core::utils::split_and_flatten has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::chunked_array::ops::sort::arg_sort::reverse_stable_no_nulls (cognitive 17) crates/polars-core/src/chunked_array/ops/sort/arg_sort.rs:53 — polars_core::chunked_array::ops::sort::arg_sort::reverse_stable_no_nulls has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 2 (5 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_core::frame::chunks::chunk_df_for_writing (cognitive 17) crates/polars-core/src/frame/chunks.rs:102 — polars_core::frame::chunks::chunk_df_for_writing has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::frame::horizontal::concat_df_horizontal (cognitive 17) crates/polars-core/src/frame/horizontal.rs:76 — polars_core::frame::horizontal::concat_df_horizontal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::frame::validation::ensure_names_unique (cognitive 17) crates/polars-core/src/frame/validation.rs:68 — polars_core::frame::validation::ensure_names_unique has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_core::frame::row::transpose::numeric_transpose (cognitive 16) crates/polars-core/src/frame/row/transpose.rs:165 — polars_core::frame::row::transpose::numeric_transpose has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • + 2 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×27
  • ClassTooLong: SQLContext REDACTED:316 — ClassTooLong — 4650 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 187 methods, 5 blocks, lines 316-6986. The bar is 400 significant lines; this is 4250 over it, 11.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ProjectionPushdownVisitor crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:143 — ClassTooLong — 1546 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 1 methods, 3 blocks, lines 143-2554. The bar is 400 significant lines; this is 1146 over it, 3.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SQLFunctionVisitor crates/polars-sql/src/functions.rs:46 — ClassTooLong — 1316 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 66 methods, 2 blocks, lines 46-3369. The bar is 400 significant lines; this is 916 over it, 3.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Wrap crates/polars-python/src/conversion/mod.rs:94 — ClassTooLong — 1256 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 0 methods, 68 blocks, lines 73-2284. The bar is 400 significant lines; this is 856 over it, 3.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SQLExprVisitor crates/polars-sql/src/sql_expr.rs:187 — ClassTooLong — 1199 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 41 methods, 2 blocks, lines 187-2162. The bar is 400 significant lines; this is 799 over it, 3.00× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: IRFunctionExpr crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:113 — ClassTooLong — 1169 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 8 methods, 5 blocks, lines 113-1555. The bar is 400 significant lines; this is 769 over it, 2.92× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DataType crates/polars-core/src/datatypes/dtype.rs:90 — ClassTooLong — 1155 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 95 methods, 9 blocks, lines 90-2029. The bar is 400 significant lines; this is 755 over it, 2.89× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Column crates/polars-core/src/frame/column/mod.rs:45 — ClassTooLong — 1129 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 216 methods, 7 blocks, lines 45-2004. The bar is 400 significant lines; this is 729 over it, 2.82× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AnyValue crates/polars-core/src/datatypes/any_value.rs:34 — ClassTooLong — 1102 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 38 methods, 16 blocks, lines 34-1582. The bar is 400 significant lines; this is 702 over it, 2.76× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LazyFrame crates/polars-lazy/src/frame/mod.rs:89 — ClassTooLong — 976 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 129 methods, 5 blocks, lines 77-2002. The bar is 400 significant lines; this is 576 over it, 2.44× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TypeCoercionRule crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:40 — ClassTooLong — 897 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 0 methods, 2 blocks, lines 40-1321. The bar is 400 significant lines; this is 497 over it, 2.24× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: FunctionExpr crates/polars-plan/src/dsl/function_expr/mod.rs:137 — ClassTooLong — 842 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 0 methods, 3 blocks, lines 137-1092. The bar is 400 significant lines; this is 442 over it, 2.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SelectionWalker crates/polars-plan/src/plans/optimizer/projection_pushdown/field_pruning.rs:110 — ClassTooLong — 712 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 12 methods, 2 blocks, lines 110-1106. The bar is 400 significant lines; this is 312 over it, 1.78× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SlicePushDown crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:12 — ClassTooLong — 656 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 7 methods, 3 blocks, lines 12-1052. The bar is 400 significant lines; this is 256 over it, 1.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: WindowExpr crates/polars-expr/src/expressions/window.rs:27 — ClassTooLong — 614 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 9 methods, 4 blocks, lines 27-1077. The bar is 400 significant lines; this is 214 over it, 1.54× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Series crates/polars-core/src/series/mod.rs:151 — ClassTooLong — 593 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 183 methods, 5 blocks, lines 172-1221. The bar is 400 significant lines; this is 193 over it, 1.48× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PredicatePushDown crates/polars-plan/src/plans/optimizer/predicate_pushdown/mod.rs:25 — ClassTooLong — 553 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 9 methods, 3 blocks, lines 25-823. The bar is 400 significant lines; this is 153 over it, 1.38× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Duration crates/polars-defs/src/time/duration.rs:40 — ClassTooLong — 550 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 46 methods, 7 blocks, lines 40-949. The bar is 400 significant lines; this is 150 over it, 1.38× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Config crates/polars-config/src/lib.rs:259 — ClassTooLong — 517 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 54 methods, 2 blocks, lines 259-1008. The bar is 400 significant lines; this is 117 over it, 1.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: IpcFileReader crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:64 — ClassTooLong — 464 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 0 methods, 2 blocks, lines 64-791. The bar is 400 significant lines; this is 64 over it, 1.16× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ColumnSelectorBuilder crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/builder.rs:19 — ClassTooLong — 452 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 3 methods, 2 blocks, lines 19-735. The bar is 400 significant lines; this is 52 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ApplyExpr crates/polars-expr/src/expressions/apply.rs:16 — ClassTooLong — 445 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 11 methods, 3 blocks, lines 16-721. The bar is 400 significant lines; this is 45 over it, 1.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ChunkedArray crates/polars-core/src/chunked_array/mod.rs:140 — ClassTooLong — 438 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 141 methods, 15 blocks, lines 140-1175. The bar is 400 significant lines; this is 38 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Builder crates/polars-io/src/csv/read/builder.rs:704 — ClassTooLong — 438 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 6 methods, 3 blocks, lines 704-1247. The bar is 400 significant lines; this is 38 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ExprOrderSimplifier crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:93 — ClassTooLong — 435 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 5 methods, 3 blocks, lines 93-770. The bar is 400 significant lines; this is 35 over it, 1.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 2 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_io · ×25
  • polars_io::path_utils::expand_paths_hive (cognitive 114) crates/polars-io/src/path_utils/mod.rs:403 — polars_io::path_utils::expand_paths_hive has cognitive complexity 114 (threshold 15). Drivers by points: if/else 29 (77 pts), loops 7 (25 pts), boolean chains 7, match/switch 1 (5 pts) (nesting depth added 70). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • polars_io::csv::read::parser::parse_lines (cognitive 73) crates/polars-io/src/csv/read/parser.rs:1134 — polars_io::csv::read::parser::parse_lines has cognitive complexity 73 (threshold 15). Drivers by points: if/else 16 (49 pts), loops 6 (12 pts), match/switch 2 (8 pts), boolean chains 4 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::csv::read::streaming::infer_schema (cognitive 58) crates/polars-io/src/csv/read/streaming.rs:771 — polars_io::csv::read::streaming::infer_schema has cognitive complexity 58 (threshold 15). Drivers by points: if/else 22 (50 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • polars_io::csv::write::write_impl::serializer::serializer_for (cognitive 47) crates/polars-io/src/csv/write/write_impl/serializer.rs:666 — polars_io::csv::write::write_impl::serializer::serializer_for has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (31 pts), match/switch 10 (14 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::csv::read::schema_inference::infer_types_from_line (cognitive 45) crates/polars-io/src/csv/read/schema_inference.rs:166 — polars_io::csv::read::schema_inference::infer_types_from_line has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (40 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::csv::read::streaming::for_each_line_from_reader_from_compressed_reader (cognitive 45) crates/polars-io/src/csv/read/streaming.rs:395 — polars_io::csv::read::streaming::for_each_line_from_reader_from_compressed_reader has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (36 pts), match/switch 2 (6 pts), loops 2 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (polars_io::csv::read::streaming::for_each_line_from_reader) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::csv::read::streaming::for_each_line_from_reader (cognitive 45) crates/polars-io/src/csv/read/streaming.rs:530 — polars_io::csv::read::streaming::for_each_line_from_reader has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (36 pts), match/switch 2 (6 pts), loops 2 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (polars_io::csv::read::streaming::for_each_line_from_reader_from_compressed_reader) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::csv::write::write_impl::serializer::string_serializer (cognitive 38) crates/polars-io/src/csv/write/write_impl/serializer.rs:442 — polars_io::csv::write::write_impl::serializer::string_serializer has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (21 pts), match/switch 5 (8 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 13). Of this number, 20 points are the body's own statements and 18 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::path_utils::hugging_face::expand_paths_hf (cognitive 38) crates/polars-io/src/path_utils/hugging_face.rs:221 — polars_io::path_utils::hugging_face::expand_paths_hf has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::csv::read::parser::next_line_position (cognitive 34) crates/polars-io/src/csv/read/parser.rs:271 — polars_io::csv::read::parser::next_line_position has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 3 (6 pts), match/switch 1 (2 pts) (nesting depth added 19). Of this number, 31 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::csv::read::streaming::read_until_start_and_infer_schema_from_compressed_reader (cognitive 34) crates/polars-io/src/csv/read/streaming.rs:31 — polars_io::csv::read::streaming::read_until_start_and_infer_schema_from_compressed_reader has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (polars_io::csv::read::streaming::read_until_start_and_infer_schema) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::csv::read::streaming::read_until_start_and_infer_schema (cognitive 34) crates/polars-io/src/csv/read/streaming.rs:213 — polars_io::csv::read::streaming::read_until_start_and_infer_schema has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (polars_io::csv::read::streaming::read_until_start_and_infer_schema_from_compressed_reader) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::ndjson::buffer::deserialize_all (cognitive 34) crates/polars-io/src/ndjson/buffer.rs:246 — polars_io::ndjson::buffer::deserialize_all has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 7 (12 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::cloud::dns::lookup_hedged (cognitive 27) crates/polars-io/src/cloud/dns.rs:224 — polars_io::cloud::dns::lookup_hedged has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (20 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::csv::read::builder::slow_datetime_parser (cognitive 27) crates/polars-io/src/csv/read/builder.rs:453 — polars_io::csv::read::builder::slow_datetime_parser has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 5 (8 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::csv::read::schema_inference::infer_field_schema (cognitive 26) crates/polars-io/src/csv/read/schema_inference.rs:337 — polars_io::csv::read::schema_inference::infer_field_schema has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 4 (10 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • polars_io::csv::read::utils::decompress_impl (cognitive 24) crates/polars-io/src/csv/read/utils.rs:12 — polars_io::csv::read::utils::decompress_impl has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_io::csv::read::parser::count_rows_from_reader_par (cognitive 21) crates/polars-io/src/csv/read/parser.rs:68 — polars_io::csv::read::parser::count_rows_from_reader_par has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::csv::read::schema_inference::infer_file_schema_impl (cognitive 21) crates/polars-io/src/csv/read/schema_inference.rs:25 — polars_io::csv::read::schema_inference::infer_file_schema_impl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::csv::read::streaming::skip_lines_naive_from_compressed_reader (cognitive 18) crates/polars-io/src/csv/read/streaming.rs:663 — polars_io::csv::read::streaming::skip_lines_naive_from_compressed_reader has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (polars_io::csv::read::streaming::skip_lines_naive) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::csv::read::streaming::skip_lines_naive (cognitive 18) crates/polars-io/src/csv/read/streaming.rs:716 — polars_io::csv::read::streaming::skip_lines_naive has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (polars_io::csv::read::streaming::skip_lines_naive_from_compressed_reader) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::utils::other::update_row_counts2 (cognitive 18) crates/polars-io/src/utils/other.rs:97 — polars_io::utils::other::update_row_counts2 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (polars_io::utils::other::update_row_counts3) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::utils::other::update_row_counts3 (cognitive 18) crates/polars-io/src/utils/other.rs:124 — polars_io::utils::other::update_row_counts3 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (polars_io::utils::other::update_row_counts2) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::scan_lines::split_lines_to_rows_impl (cognitive 17) crates/polars-io/src/scan_lines.rs:31 — polars_io::scan_lines::split_lines_to_rows_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_io::shared::finish_reader (cognitive 17) crates/polars-io/src/shared.rs:47 — polars_io::shared::finish_reader has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×25
  • Edited copy of a member (10 corresponding lines) crates/polars-time/src/series/mod.rs:180 — crates/polars-time/src/series/mod.rs:180-189 | crates/polars-time/src/series/mod.rs:204-213 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-compute/src/sum.rs:54 — crates/polars-compute/src/sum.rs:54-63 | crates/polars-compute/src/sum.rs:69-78 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:924 — crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:924-933 | crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:935-946 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-python/src/conversion/mod.rs:424 — crates/polars-python/src/conversion/mod.rs:424-434 | pyo3-polars/pyo3-polars/src/types.rs:80-89 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-compute/src/ewm/cov.rs:148 — crates/polars-compute/src/ewm/cov.rs:148-157 | crates/polars-compute/src/ewm/cov.rs:176-186 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-ops/src/series/ops/is_first_distinct.rs:16 — crates/polars-ops/src/series/ops/is_first_distinct.rs:16-25 | crates/polars-ops/src/series/ops/is_first_distinct.rs:27-36 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-sql/src/lateral.rs:63 — crates/polars-sql/src/lateral.rs:63-75 | crates/polars-sql/src/subquery_group_by.rs:41-50 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-expr/src/reduce/mod.rs:534 — crates/polars-expr/src/reduce/mod.rs:534-543 | crates/polars-expr/src/reduce/mod.rs:786-797 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:560 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:560-569 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:573-582 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-core/src/frame/column/scalar.rs:156 — crates/polars-core/src/frame/column/scalar.rs:156-165 | crates/polars-core/src/frame/column/scalar.rs:172-182 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-plan/src/plans/options.rs:705 — crates/polars-plan/src/plans/options.rs:705-714 | crates/polars-plan/src/plans/options.rs:717-726 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-expr/src/groups/key_rows.rs:176 — crates/polars-expr/src/groups/key_rows.rs:176-190 | crates/polars-expr/src/groups/single_key.rs:276-285 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-core/src/chunked_array/ops/nulls.rs:25 — crates/polars-core/src/chunked_array/ops/nulls.rs:25-34 | crates/polars-core/src/chunked_array/ops/nulls.rs:36-45 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-io-ext-ffi/src/common.rs:90 — crates/polars-io-ext-ffi/src/common.rs:90-101 | crates/polars-io-ext-ffi/src/common.rs:224-233 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-plan/src/dsl/function_expr/correlation.rs:17 — crates/polars-plan/src/dsl/function_expr/correlation.rs:17-26 | crates/polars-plan/src/plans/aexpr/function_expr/correlation.rs:13-22 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-core/src/utils/mod.rs:884 — crates/polars-core/src/utils/mod.rs:884-893 | crates/polars-core/src/utils/mod.rs:899-908 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-expr/src/dispatch/range/datetime_range.rs:67 — crates/polars-expr/src/dispatch/range/datetime_range.rs:67-76 | crates/polars-expr/src/dispatch/range/datetime_range.rs:84-93 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-core/src/chunked_array/comparison/scalar.rs:97 — crates/polars-core/src/chunked_array/comparison/scalar.rs:97-106 | crates/polars-core/src/chunked_array/comparison/scalar.rs:119-128 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-core/src/chunked_array/arg_min_max.rs:137 — crates/polars-core/src/chunked_array/arg_min_max.rs:137-146 | crates/polars-core/src/chunked_array/arg_min_max.rs:152-161 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-expr/src/dispatch/strings.rs:432 — crates/polars-expr/src/dispatch/strings.rs:432-441 | crates/polars-expr/src/dispatch/strings.rs:451-460 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-expr/src/groups/binview.rs:31 — crates/polars-expr/src/groups/binview.rs:31-42 | crates/polars-expr/src/groups/row_encoded.rs:23-32 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:813 — crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:813-822 | crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:888-899 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-core/src/datatypes/extension/generic.rs:57 — crates/polars-core/src/datatypes/extension/generic.rs:57-66 | crates/polars-python/src/extension.rs:92-101 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-lazy/src/scan/csv.rs:481 — crates/polars-lazy/src/scan/csv.rs:481-491 | crates/polars-lazy/src/scan/file_list_reader.rs:64-73 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) crates/polars-core/src/datatypes/dtype.rs:1019 — crates/polars-core/src/datatypes/dtype.rs:1019-1028 | crates/polars-plan/src/plans/conversion/type_coercion/binary.rs:35-49 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×25
  • Duplicated block (13 lines × 2) crates/polars-compute/src/binview_index_map.rs:188 — crates/polars-compute/src/binview_index_map.rs:188-200 | crates/polars-compute/src/binview_index_map.rs:222-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/binview_index_map.rs:188` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-compute/src/binview_index_map.rs:221` calls `get_external_slice_unchecked` and `crates/polars-compute/src/binview_index_map.rs:187` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) crates/polars-compute/src/moment.rs:176 — crates/polars-compute/src/moment.rs:176-188 | crates/polars-compute/src/moment.rs:252-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:681 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:681-693 | crates/polars-core/src/series/arithmetic/fixed_size_list.rs:711-723 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/fixed_size_list.rs:681` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-core/src/series/arrow_export/mod.rs:219 — crates/polars-core/src/series/arrow_export/mod.rs:219-231 | crates/polars-core/src/series/arrow_export/mod.rs:270-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arrow_export/mod.rs:219` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) crates/polars-expr/src/dispatch/horizontal.rs:44 — crates/polars-expr/src/dispatch/horizontal.rs:44-56 | crates/polars-expr/src/dispatch/horizontal.rs:90-102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/horizontal.rs:44` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-expr/src/dispatch/horizontal.rs:118 — crates/polars-expr/src/dispatch/horizontal.rs:118-130 | crates/polars-expr/src/dispatch/horizontal.rs:163-175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/horizontal.rs:118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-expr/src/expressions/slice.rs:186 — crates/polars-expr/src/expressions/slice.rs:186-198 | crates/polars-expr/src/expressions/slice.rs:278-290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/slice.rs:186` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) crates/polars-io/src/csv/read/splitfields.rs:289 — crates/polars-io/src/csv/read/splitfields.rs:289-301 | crates/polars-io/src/csv/read/splitfields.rs:380-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/splitfields.rs:289` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-mem-engine/src/executors/group_by_dynamic.rs:29 — crates/polars-mem-engine/src/executors/group_by_dynamic.rs:29-41 | crates/polars-mem-engine/src/executors/group_by_rolling.rs:70-82 — before extracting anything, compare `crates/polars-mem-engine/src/executors/group_by_dynamic.rs` and `crates/polars-mem-engine/src/executors/group_by_rolling.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) crates/polars-ooc/src/memory_manager.rs:326 — crates/polars-ooc/src/memory_manager.rs:326-338 | crates/polars-ooc/src/memory_manager.rs:416-428 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ooc/src/memory_manager.rs:326` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-ops/src/chunked_array/gather/chunked.rs:741 — crates/polars-ops/src/chunked_array/gather/chunked.rs:741-753 | crates/polars-ops/src/chunked_array/gather/chunked.rs:792-804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/gather/chunked.rs:741` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-ops/src/chunked_array/gather_skip_nulls.rs:75 — crates/polars-ops/src/chunked_array/gather_skip_nulls.rs:75-87 | crates/polars-ops/src/chunked_array/gather_skip_nulls.rs:108-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `indices` to `&[IdxSize]` in one and `&IdxCa` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (13 lines × 2) crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:73 — crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:73-85 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:140-152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:73` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs:272 — crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs:272-284 | crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:909-921 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/nested.rs:32 — crates/polars-parquet/src/arrow/read/deserialize/nested.rs:32-44 | crates/polars-parquet/src/arrow/read/deserialize/nested.rs:47-59 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/nested.rs:32` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:618 — crates/polars-parquet/src/arrow/write/mod.rs:618-630 | crates/polars-parquet/src/arrow/write/mod.rs:1000-1012 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:618` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:716 — crates/polars-parquet/src/arrow/write/mod.rs:716-728 | crates/polars-parquet/src/arrow/write/mod.rs:938-950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:716` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:929 — crates/polars-parquet/src/arrow/write/mod.rs:929-941 | crates/polars-parquet/src/arrow/write/mod.rs:991-1003 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:929` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-plan/src/plans/builder_ir.rs:107 — crates/polars-plan/src/plans/builder_ir.rs:107-119 | crates/polars-plan/src/plans/builder_ir.rs:140-152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/builder_ir.rs:107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-stream/src/nodes/dynamic_group_by.rs:340 — crates/polars-stream/src/nodes/dynamic_group_by.rs:340-352 | crates/polars-stream/src/nodes/rolling_group_by.rs:274-286 — before extracting anything, compare `crates/polars-stream/src/nodes/dynamic_group_by.rs` and `crates/polars-stream/src/nodes/rolling_group_by.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/dynamic_group_by.rs:340` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-stream/src/physical_plan/to_graph.rs:1693 — crates/polars-stream/src/physical_plan/to_graph.rs:1693-1705 | crates/polars-stream/src/physical_plan/to_graph.rs:1762-1774 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/to_graph.rs:1693` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) crates/polars-expr/src/reduce/implode.rs:101 — crates/polars-expr/src/reduce/implode.rs:101-113 | crates/polars-expr/src/reduce/unique.rs:256-268 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/implode.rs:101` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-compute/src/unique/distinct.rs:493 — crates/polars-compute/src/unique/distinct.rs:493-505 | crates/polars-compute/src/unique/distinct.rs:697-709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/unique/distinct.rs:493` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-compute/src/unique/distinct.rs:633 — crates/polars-compute/src/unique/distinct.rs:633-645 | crates/polars-compute/src/unique/distinct.rs:790-802 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/unique/distinct.rs:633` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) crates/polars-io/src/file_cache/entry.rs:96 — crates/polars-io/src/file_cache/entry.rs:96-108 | crates/polars-io/src/file_cache/entry.rs:123-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D6 · Cohesion (LCOM4) · Low cohesion · ×23
  • Low cohesion: ChunkedArray (LCOM4 46) crates/polars-core/src/chunked_array/mod.rs:140 — ChunkedArray's methods fall into 46 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 46 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Series (LCOM4 36) crates/polars-core/src/series/mod.rs:151 — Series's methods fall into 36 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 36 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CsvReadOptions (LCOM4 23) crates/polars-io/src/csv/read/options.rs:19 — CsvReadOptions's methods fall into 23 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 23 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: DataFrame (LCOM4 9) crates/polars-core/src/frame/dataframe.rs:85 — DataFrame's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ArrowSchema (LCOM4 6) crates/polars-io-ext-ffi/src/common.rs:341 — ArrowSchema's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: LazyFrame (LCOM4 5) crates/polars-lazy/src/frame/mod.rs:89 — LazyFrame's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: NodeMetrics (LCOM4 5) crates/polars-stream/src/metrics.rs:17 — NodeMetrics's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: PythonConvertRegistry (LCOM4 5) crates/polars-utils/src/python_convert_registry.rs:53 — PythonConvertRegistry's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: BinviewHashGrouper (LCOM4 4) crates/polars-expr/src/groups/binview.rs:10 — BinviewHashGrouper's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: KeyRowHashGrouper (LCOM4 4) crates/polars-expr/src/groups/key_rows.rs:7 — KeyRowHashGrouper's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: RowEncodedHashGrouper (LCOM4 4) crates/polars-expr/src/groups/row_encoded.rs:12 — RowEncodedHashGrouper's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: SingleKeyHashGrouper (LCOM4 4) crates/polars-expr/src/groups/single_key.rs:13 — SingleKeyHashGrouper's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: SketchUnionReducer (LCOM4 4) crates/polars-expr/src/reduce/approx_quantile.rs:226 — SketchUnionReducer's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: NumUnorderedImplodeReducer (LCOM4 4) crates/polars-expr/src/reduce/implode.rs:36 — NumUnorderedImplodeReducer's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: NumMeanReducer (LCOM4 4) crates/polars-expr/src/reduce/mean.rs:73 — NumMeanReducer's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: BoolVarStdReducer (LCOM4 4) crates/polars-expr/src/reduce/var_std.rs:146 — BoolVarStdReducer's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: BinViewDecoder (LCOM4 4) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:86 — BinViewDecoder's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CategoricalDecoder (LCOM4 4) crates/polars-parquet/src/arrow/read/deserialize/categorical.rs:67 — CategoricalDecoder's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: BinaryDecoder (LCOM4 4) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:71 — BinaryDecoder's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: FixedLenDecimalDecoder (LCOM4 4) crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:75 — FixedLenDecimalDecoder's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: FloatDecoder (LCOM4 4) crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:71 — FloatDecoder's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: IntDecoder (LCOM4 4) crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:86 — IntDecoder's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: JoinTuning (LCOM4 4) crates/polars-stream/src/nodes/joins/tuning.rs:75 — JoinTuning's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×20
  • Edited copy of a member (17 corresponding lines) crates/polars-plan/src/plans/conversion/dsl_to_ir/sql.rs:194 — crates/polars-plan/src/plans/conversion/dsl_to_ir/sql.rs:194-210 | crates/polars-plan/src/plans/conversion/type_coercion/membership.rs:288-304 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-expr/src/dispatch/misc.rs:282 — crates/polars-expr/src/dispatch/misc.rs:282-298 | crates/polars-expr/src/dispatch/misc.rs:300-316 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-python/src/interop/numpy/to_numpy_series.rs:119 — crates/polars-python/src/interop/numpy/to_numpy_series.rs:119-135 | crates/polars-python/src/interop/numpy/to_numpy_series.rs:141-159 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-core/src/chunked_array/ops/apply.rs:24 — crates/polars-core/src/chunked_array/ops/apply.rs:24-42 | crates/polars-core/src/chunked_array/ops/apply.rs:53-69 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-io/src/utils/compression.rs:90 — crates/polars-io/src/utils/compression.rs:90-110 | crates/polars-io/src/utils/compression.rs:266-282 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:25 — crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:25-41 | crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:62-81 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) REDACTED:2585 — REDACTED:2585-2601 | REDACTED:2604-2621 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-core/src/chunked_array/ops/arity.rs:578 — crates/polars-core/src/chunked_array/ops/arity.rs:578-595 | crates/polars-core/src/chunked_array/ops/arity.rs:664-680 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-core/src/frame/horizontal.rs:20 — crates/polars-core/src/frame/horizontal.rs:20-38 | crates/polars-core/src/frame/horizontal.rs:54-70 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-schema/src/schema.rs:494 — crates/polars-schema/src/schema.rs:494-510 | crates/polars-schema/src/schema.rs:538-558 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-compute/src/rolling/arg_min_max.rs:71 — crates/polars-compute/src/rolling/arg_min_max.rs:71-87 | crates/polars-compute/src/rolling/arg_min_max.rs:132-149 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-expr/src/key_rows/keys.rs:496 — crates/polars-expr/src/key_rows/keys.rs:496-513 | crates/polars-expr/src/key_rows/keys.rs:527-543 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-ops/src/chunked_array/list/min_max.rs:16 — crates/polars-ops/src/chunked_array/list/min_max.rs:16-32 | crates/polars-ops/src/chunked_array/list/min_max.rs:127-143 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-stream/src/nodes/io_sources/ipc/builder.rs:63 — crates/polars-stream/src/nodes/io_sources/ipc/builder.rs:63-79 | crates/polars-stream/src/nodes/io_sources/parquet/builder.rs:85-106 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-sql/src/subquery.rs:2705 — crates/polars-sql/src/subquery.rs:2705-2721 | crates/polars-sql/src/subquery.rs:2739-2755 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-io/src/csv/read/read_impl.rs:531 — crates/polars-io/src/csv/read/read_impl.rs:531-547 | crates/polars-io/src/ndjson/core.rs:156-173 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-plan/src/plans/optimizer/sortedness.rs:34 — crates/polars-plan/src/plans/optimizer/sortedness.rs:34-50 | crates/polars-plan/src/plans/optimizer/sortedness.rs:180-196 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-core/src/chunked_array/ops/fill_null.rs:261 — crates/polars-core/src/chunked_array/ops/fill_null.rs:261-277 | crates/polars-core/src/chunked_array/ops/fill_null.rs:279-300 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-plan/src/dsl/options/sink.rs:505 — crates/polars-plan/src/dsl/options/sink.rs:505-523 | crates/polars-plan/src/plans/options.rs:506-522 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) crates/polars-plan/src/dsl/options/sink.rs:426 — crates/polars-plan/src/dsl/options/sink.rs:426-444 | crates/polars-plan/src/plans/options.rs:483-499 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×20
  • Edited copy of a member (14 corresponding lines) crates/polars-ops/src/chunked_array/cov.rs:12 — crates/polars-ops/src/chunked_array/cov.rs:12-25 | crates/polars-ops/src/chunked_array/cov.rs:33-46 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-compute/src/gather/binary.rs:30 — crates/polars-compute/src/gather/binary.rs:30-44 | crates/polars-compute/src/gather/boolean.rs:67-80 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-plan/src/dsl/function_expr/struct_.rs:19 — crates/polars-plan/src/dsl/function_expr/struct_.rs:19-33 | crates/polars-plan/src/plans/aexpr/function_expr/struct_.rs:131-144 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-utils/src/order_statistic_tree.rs:255 — crates/polars-utils/src/order_statistic_tree.rs:255-268 | crates/polars-utils/src/order_statistic_tree.rs:271-284 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1201 — crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1201-1214 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1216-1229 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-expr/src/dispatch/array.rs:144 — crates/polars-expr/src/dispatch/array.rs:144-157 | crates/polars-expr/src/dispatch/list.rs:78-91 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-ops/src/series/ops/is_first_distinct.rs:76 — crates/polars-ops/src/series/ops/is_first_distinct.rs:76-89 | crates/polars-ops/src/series/ops/is_last_distinct.rs:145-159 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-core/src/chunked_array/ops/chunkops.rs:142 — crates/polars-core/src/chunked_array/ops/chunkops.rs:142-161 | crates/polars-core/src/series/implementations/null.rs:61-74 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-ops/src/chunked_array/strings/escape_regex.rs:8 — crates/polars-ops/src/chunked_array/strings/escape_regex.rs:8-21 | crates/polars-ops/src/chunked_array/strings/normalize.rs:8-21 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-python/src/lazyframe/general.rs:385 — crates/polars-python/src/lazyframe/general.rs:385-398 | crates/polars-python/src/lazyframe/general.rs:407-420 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-compute/src/gather/sublist/fixed_size_list.rs:49 — crates/polars-compute/src/gather/sublist/fixed_size_list.rs:49-62 | crates/polars-compute/src/gather/sublist/fixed_size_list.rs:68-81 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-utils/src/parma/raw/mod.rs:296 — crates/polars-utils/src/parma/raw/mod.rs:296-309 | crates/polars-utils/src/parma/raw/mod.rs:312-328 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-compute/src/rolling/sum.rs:68 — crates/polars-compute/src/rolling/sum.rs:68-81 | crates/polars-compute/src/rolling/sum.rs:83-96 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-utils/src/itertools/mod.rs:72 — crates/polars-utils/src/itertools/mod.rs:72-88 | crates/polars-utils/src/itertools/mod.rs:96-109 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-core/src/frame/mod.rs:701 — crates/polars-core/src/frame/mod.rs:701-716 | crates/polars-core/src/frame/mod.rs:724-737 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/boolean.rs:152 — crates/polars-parquet/src/arrow/read/deserialize/boolean.rs:152-165 | crates/polars-parquet/src/arrow/read/deserialize/boolean.rs:227-245 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-compute/src/rolling/min_max.rs:26 — crates/polars-compute/src/rolling/min_max.rs:26-40 | crates/polars-compute/src/rolling/min_max.rs:70-83 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-plan/src/dsl/builder_dsl.rs:473 — crates/polars-plan/src/dsl/builder_dsl.rs:473-486 | crates/polars-plan/src/dsl/builder_dsl.rs:497-512 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-plan/src/dsl/functions/horizontal.rs:14 — crates/polars-plan/src/dsl/functions/horizontal.rs:14-27 | crates/polars-plan/src/dsl/functions/horizontal.rs:91-106 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) crates/polars-time/src/windows/group_by.rs:539 — crates/polars-time/src/windows/group_by.rs:539-552 | crates/polars-time/src/windows/group_by.rs:564-577 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×20
  • Edited copy of a member (11 corresponding lines) crates/polars-expr/src/reduce/cov.rs:80 — crates/polars-expr/src/reduce/cov.rs:80-90 | crates/polars-expr/src/reduce/cov.rs:224-234 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-ops/src/series/ops/horizontal.rs:56 — crates/polars-ops/src/series/ops/horizontal.rs:56-66 | crates/polars-ops/src/series/ops/horizontal.rs:72-82 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-python/src/sql.rs:399 — crates/polars-python/src/sql.rs:399-410 | crates/polars-python/src/sql.rs:419-429 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-ops/src/chunked_array/strings/strip.rs:121 — crates/polars-ops/src/chunked_array/strings/strip.rs:121-131 | crates/polars-ops/src/chunked_array/strings/strip.rs:133-143 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/boolean.rs:346 — crates/polars-parquet/src/arrow/read/deserialize/boolean.rs:346-356 | crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:580-595 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-io/src/csv/write/write_impl/serializer.rs:155 — crates/polars-io/src/csv/write/write_impl/serializer.rs:155-166 | crates/polars-io/src/csv/write/write_impl/serializer.rs:170-180 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-ops/src/series/ops/is_last_distinct.rs:116 — crates/polars-ops/src/series/ops/is_last_distinct.rs:116-126 | crates/polars-ops/src/series/ops/is_last_distinct.rs:133-143 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-core/src/chunked_array/ops/append.rs:168 — crates/polars-core/src/chunked_array/ops/append.rs:168-178 | crates/polars-core/src/chunked_array/ops/append.rs:183-193 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-utils/src/order_statistic_tree.rs:291 — crates/polars-utils/src/order_statistic_tree.rs:291-301 | crates/polars-utils/src/order_statistic_tree.rs:458-468 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-ops/src/chunked_array/strings/find_many.rs:147 — crates/polars-ops/src/chunked_array/strings/find_many.rs:147-157 | crates/polars-ops/src/chunked_array/strings/find_many.rs:245-255 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-python/src/interop/numpy/to_numpy_series.rs:259 — crates/polars-python/src/interop/numpy/to_numpy_series.rs:259-269 | crates/polars-python/src/interop/numpy/to_numpy_series.rs:494-506 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-ops/src/series/ops/moment.rs:16 — crates/polars-ops/src/series/ops/moment.rs:16-26 | crates/polars-ops/src/series/ops/moment.rs:37-47 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-python/src/lazyframe/general.rs:1004 — crates/polars-python/src/lazyframe/general.rs:1004-1014 | crates/polars-python/src/lazyframe/general.rs:1016-1026 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-io/src/predicates.rs:444 — crates/polars-io/src/predicates.rs:444-454 | crates/polars-io/src/predicates.rs:458-469 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-io/src/parquet/read/async_impl.rs:81 — crates/polars-io/src/parquet/read/async_impl.rs:81-92 | crates/polars-io/src/parquet/read/reader.rs:136-146 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-stream/src/nodes/io_sources/multi_scan/functions/mod.rs:18 — crates/polars-stream/src/nodes/io_sources/multi_scan/functions/mod.rs:18-30 | crates/polars-stream/src/nodes/io_sources/multi_scan/functions/mod.rs:60-70 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-compute/src/rolling/no_nulls/quantile.rs:38 — crates/polars-compute/src/rolling/no_nulls/quantile.rs:38-49 | crates/polars-compute/src/rolling/nulls/quantile.rs:36-46 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-core/src/chunked_array/builder/list/binary.rs:10 — crates/polars-core/src/chunked_array/builder/list/binary.rs:10-20 | crates/polars-core/src/chunked_array/builder/list/boolean.rs:10-20 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/polars-lazy/src/frame/mod.rs:534 — crates/polars-lazy/src/frame/mod.rs:534-544 | crates/polars-plan/src/dsl/plan.rs:293-306 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) REDACTED:9110 — REDACTED:9110-9120 | crates/polars-sql/src/sql_expr.rs:810-823 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×20
  • Edited copy of a member (9 corresponding lines) crates/polars-compute/src/comparisons/mod.rs:16 — crates/polars-compute/src/comparisons/mod.rs:16-24 | crates/polars-compute/src/comparisons/mod.rs:26-34 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-ops/src/chunked_array/array/count.rs:20 — crates/polars-ops/src/chunked_array/array/count.rs:20-28 | crates/polars-ops/src/chunked_array/list/count.rs:54-63 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-expr/src/dispatch/range/linear_space.rs:347 — crates/polars-expr/src/dispatch/range/linear_space.rs:347-357 | crates/polars-expr/src/dispatch/range/utils.rs:213-221 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-ops/src/chunked_array/array/count.rs:10 — crates/polars-ops/src/chunked_array/array/count.rs:10-18 | crates/polars-ops/src/chunked_array/list/count.rs:44-52 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-expr/src/key_rows/layout.rs:134 — crates/polars-expr/src/key_rows/layout.rs:134-142 | crates/polars-expr/src/key_rows/layout.rs:147-155 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-compute/src/cast/utf8_to.rs:35 — crates/polars-compute/src/cast/utf8_to.rs:35-43 | crates/polars-compute/src/cast/utf8_to.rs:46-54 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-core/src/chunked_array/object/builder.rs:235 — crates/polars-core/src/chunked_array/object/builder.rs:235-243 | crates/polars-core/src/chunked_array/object/builder.rs:252-265 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-core/src/chunked_array/temporal/string/infer.rs:314 — crates/polars-core/src/chunked_array/temporal/string/infer.rs:314-323 | crates/polars-core/src/chunked_array/temporal/string/infer.rs:328-336 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) REDACTED:1669 — REDACTED:1669-1677 | REDACTED:1679-1687 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-parquet/src/parquet/encoding/bitpacked/decode.rs:30 — crates/polars-parquet/src/parquet/encoding/bitpacked/decode.rs:30-38 | crates/polars-parquet/src/parquet/encoding/bitpacked/encode.rs:44-52 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-ooc/src/spill_token.rs:896 — crates/polars-ooc/src/spill_token.rs:896-904 | crates/polars-ooc/src/spill_token.rs:907-915 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-plan/src/plans/ir/inputs.rs:455 — crates/polars-plan/src/plans/ir/inputs.rs:455-465 | crates/polars-plan/src/plans/ir/inputs.rs:511-519 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-ops/src/frame/join/cross_join.rs:27 — crates/polars-ops/src/frame/join/cross_join.rs:27-36 | crates/polars-ops/src/frame/join/cross_join.rs:38-46 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-expr/src/reduce/cov.rs:160 — crates/polars-expr/src/reduce/cov.rs:160-168 | crates/polars-expr/src/reduce/cov.rs:303-316 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-python/src/functions/io.rs:185 — crates/polars-python/src/functions/io.rs:185-193 | crates/polars-python/src/functions/io.rs:197-205 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-plan/src/traversal/tree_traversal.rs:265 — crates/polars-plan/src/traversal/tree_traversal.rs:265-273 | crates/polars-plan/src/traversal/tree_traversal.rs:275-285 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-utils/src/order_statistic_tree.rs:313 — crates/polars-utils/src/order_statistic_tree.rs:313-321 | crates/polars-utils/src/order_statistic_tree.rs:351-359 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) py-polars/src/polars/datatype_expr/struct.py:16 — py-polars/src/polars/datatype_expr/struct.py:16-24 | py-polars/src/polars/expr/struct.py:27-75 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-sql/src/window_frames.rs:541 — crates/polars-sql/src/window_frames.rs:541-549 | crates/polars-sql/src/window_frames.rs:552-563 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) crates/polars-plan/src/plans/aexpr/function_expr/array.rs:46 — crates/polars-plan/src/plans/aexpr/function_expr/array.rs:46-54 | crates/polars-plan/src/plans/aexpr/function_expr/list.rs:62-70 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×19
  • Duplicated block (15 lines × 2) crates/polars-core/src/chunked_array/cast.rs:606 — crates/polars-core/src/chunked_array/cast.rs:606-620 | crates/polars-core/src/chunked_array/cast.rs:670-684 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `ca` to `&ListChunked` in one and `&ArrayChunked` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (15 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:553 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:553-567 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:734-748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:553` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (15 lines × 2) crates/polars-expr/src/expressions/apply.rs:91 — crates/polars-expr/src/expressions/apply.rs:91-105 | crates/polars-expr/src/expressions/structeval.rs:194-208 — before extracting anything, compare `crates/polars-expr/src/expressions/apply.rs` and `crates/polars-expr/src/expressions/structeval.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) crates/polars-ops/src/series/ops/round.rs:339 — crates/polars-ops/src/series/ops/round.rs:339-353 | crates/polars-ops/src/series/ops/round.rs:381-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/round.rs:339` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:607 — crates/polars-parquet/src/arrow/write/mod.rs:607-621 | crates/polars-parquet/src/arrow/write/mod.rs:705-719 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:607` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) crates/polars-plan/src/dsl/file_scan/mod.rs:1056 — crates/polars-plan/src/dsl/file_scan/mod.rs:1056-1070 | crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/builder.rs:58-72 — before extracting anything, compare `crates/polars-plan/src/dsl/file_scan/mod.rs` and `crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/builder.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/file_scan/mod.rs:1056` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) crates/polars-plan/src/dsl/function_expr/array.rs:53 — crates/polars-plan/src/dsl/function_expr/array.rs:53-67 | crates/polars-plan/src/plans/aexpr/function_expr/array.rs:220-234 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-plan/src/dsl/function_expr/array.rs:52` calls `Slice` and `crates/polars-plan/src/plans/aexpr/function_expr/array.rs:219` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 2) crates/polars-plan/src/dsl/function_expr/bitwise.rs:29 — crates/polars-plan/src/dsl/function_expr/bitwise.rs:29-43 | crates/polars-plan/src/plans/aexpr/function_expr/bitwise.rs:69-83 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/bitwise.rs:29` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) crates/polars-plan/src/dsl/functions/range.rs:44 — crates/polars-plan/src/dsl/functions/range.rs:44-58 | crates/polars-plan/src/dsl/functions/range.rs:77-91 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/functions/range.rs:44` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) crates/polars-plan/src/dsl/selector.rs:22 — crates/polars-plan/src/dsl/selector.rs:22-36 | crates/polars-plan/src/plans/options.rs:52-66 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (15 lines × 2) crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:247 — crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:247-261 | crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:292-306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:247` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:106 — crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:106-120 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/mod.rs:100-114 — `crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs` and `crates/polars-stream/src/nodes/io_sinks/writers/ndjson/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 78 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) crates/polars-stream/src/nodes/io_sources/ipc/metadata.rs:57 — crates/polars-stream/src/nodes/io_sources/ipc/metadata.rs:57-71 | crates/polars-stream/src/nodes/io_sources/parquet/metadata_utils.rs:72-86 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/ipc/metadata.rs:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:424 — crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:424-438 | crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:1008-1022 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:424` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:423` calls `default` and `crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:1007` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 2) crates/polars-stream/src/nodes/ordered_union.rs:102 — crates/polars-stream/src/nodes/ordered_union.rs:102-116 | crates/polars-stream/src/nodes/unordered_union.rs:129-143 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/ordered_union.rs:102` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) crates/polars-mem-engine/src/executors/group_by_dynamic.rs:51 — crates/polars-mem-engine/src/executors/group_by_dynamic.rs:51-65 | crates/polars-mem-engine/src/executors/group_by_rolling.rs:86-100 — before extracting anything, compare `crates/polars-mem-engine/src/executors/group_by_dynamic.rs` and `crates/polars-mem-engine/src/executors/group_by_rolling.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-mem-engine/src/executors/group_by_dynamic.rs:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) crates/polars-ops/src/series/ops/clip.rs:38 — crates/polars-ops/src/series/ops/clip.rs:38-52 | crates/polars-time/src/replace.rs:56-80 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/clip.rs:38` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:242 — crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:242-256 | crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:342-356 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:242` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) py-polars/src/polars/sql/context.py:1442 — py-polars/src/polars/sql/context.py:1442-1456 | py-polars/src/polars/sql/context.py:1502-1516 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×18
  • Edited copy of a member (8 corresponding lines) crates/polars-plan/src/plans/lit.rs:31 — crates/polars-plan/src/plans/lit.rs:31-38 | crates/polars-plan/src/plans/lit.rs:54-64 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) py-polars/src/polars/series/series.py:1210 — py-polars/src/polars/series/series.py:1210-1222 | py-polars/src/polars/series/series.py:1284-1291 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-utils/src/order_statistic_tree.rs:332 — crates/polars-utils/src/order_statistic_tree.rs:332-339 | crates/polars-utils/src/order_statistic_tree.rs:370-377 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-compute/src/if_then_else/scalar.rs:8 — crates/polars-compute/src/if_then_else/scalar.rs:8-16 | crates/polars-compute/src/if_then_else/scalar.rs:23-30 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-expr/src/reduce/mod.rs:545 — crates/polars-expr/src/reduce/mod.rs:545-552 | crates/polars-expr/src/reduce/mod.rs:799-807 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-plan/src/dsl/dsl_resolver/mod.rs:37 — crates/polars-plan/src/dsl/dsl_resolver/mod.rs:37-46 | crates/polars-plan/src/dsl/dsl_resolver/mod.rs:134-141 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-core/src/frame/explode.rs:15 — crates/polars-core/src/frame/explode.rs:15-22 | crates/polars-core/src/series/mod.rs:695-702 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-expr/src/dispatch/boolean.rs:93 — crates/polars-expr/src/dispatch/boolean.rs:93-100 | crates/polars-expr/src/dispatch/boolean.rs:102-109 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-compute/src/cast/primitive_to.rs:250 — crates/polars-compute/src/cast/primitive_to.rs:250-257 | crates/polars-compute/src/cast/primitive_to.rs:278-285 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-python/src/sql.rs:363 — crates/polars-python/src/sql.rs:363-374 | crates/polars-python/src/sql.rs:383-390 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-time/src/windows/index_space.rs:84 — crates/polars-time/src/windows/index_space.rs:84-93 | crates/polars-time/src/windows/index_space.rs:96-103 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-ops/src/series/ops/is_close.rs:81 — crates/polars-ops/src/series/ops/is_close.rs:81-89 | crates/polars-ops/src/series/ops/is_close.rs:100-107 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-stream/src/nodes/dynamic_slice.rs:28 — crates/polars-stream/src/nodes/dynamic_slice.rs:28-35 | crates/polars-stream/src/nodes/repeat.rs:27-34 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-compute/src/cast/binary_to.rs:132 — crates/polars-compute/src/cast/binary_to.rs:132-139 | crates/polars-compute/src/cast/binview_to.rs:93-100 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-plan/src/plans/aexpr/canonical.rs:242 — crates/polars-plan/src/plans/aexpr/canonical.rs:242-249 | crates/polars-plan/src/plans/ir/canonical.rs:210-219 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-ops/src/chunked_array/binary/slice.rs:7 — crates/polars-ops/src/chunked_array/binary/slice.rs:7-14 | crates/polars-ops/src/chunked_array/strings/substring.rs:124-131 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-ops/src/chunked_array/binary/slice.rs:30 — crates/polars-ops/src/chunked_array/binary/slice.rs:30-37 | crates/polars-ops/src/chunked_array/strings/substring.rs:141-148 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) crates/polars-core/src/utils/mod.rs:910 — crates/polars-core/src/utils/mod.rs:910-917 | crates/polars-stream/src/nodes/sort/sample.rs:115-122 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D1 · Cyclomatic Complexity · SQLContext · ×17
  • SQLContext::execute_select_block (cyclomatic 65) REDACTED:3575 — SQLContext::execute_select_block has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::process_group_by (cyclomatic 64) REDACTED:6271 — SQLContext::process_group_by has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::group_by_in_derived_table (cyclomatic 47) crates/polars-sql/src/subquery_group_by.rs:278 — SQLContext::group_by_in_derived_table has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::lateral_join (cyclomatic 42) crates/polars-sql/src/lateral.rs:385 — SQLContext::lateral_join has cyclomatic complexity 42 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • SQLContext::try_attach_join_membership (cyclomatic 38) crates/polars-sql/src/subquery.rs:1253 — SQLContext::try_attach_join_membership has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::try_decorrelate_scalar_subquery (cyclomatic 32) crates/polars-sql/src/subquery.rs:1656 — SQLContext::try_decorrelate_scalar_subquery has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • SQLContext::join_inputs (cyclomatic 28) REDACTED:4524 — SQLContext::join_inputs has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::try_decorrelate_in_subquery (cyclomatic 27) crates/polars-sql/src/subquery.rs:1890 — SQLContext::try_decorrelate_in_subquery has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • SQLContext::process_join_on_subqueries (cyclomatic 26) REDACTED:4765 — SQLContext::process_join_on_subqueries has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::execute_joins (cyclomatic 23) REDACTED:2985 — SQLContext::execute_joins has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::try_first_row_order (cyclomatic 20) crates/polars-sql/src/subquery.rs:944 — SQLContext::try_first_row_order has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::merge_plan (cyclomatic 18) REDACTED:855 — SQLContext::merge_plan has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • SQLContext::process_asof_join (cyclomatic 18) REDACTED:5337 — SQLContext::process_asof_join has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • SQLContext::get_table (cyclomatic 18) REDACTED:5852 — SQLContext::get_table has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::process_wildcard_additional_options (cyclomatic 18) REDACTED:6876 — SQLContext::process_wildcard_additional_options has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::rewrite_exists (cyclomatic 18) crates/polars-sql/src/subquery.rs:2203 — SQLContext::rewrite_exists has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLContext::outer_select_item (cyclomatic 18) crates/polars-sql/src/subquery_outer_select.rs:154 — SQLContext::outer_select_item has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×17
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-compute/src/unique/distinct.rs:582 — crates/polars-compute/src/unique/distinct.rs:582-625 | crates/polars-compute/src/unique/distinct.rs:627-674 | crates/polars-compute/src/unique/distinct.rs:752-782 | crates/polars-compute/src/unique/distinct.rs:784-815 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-expr/src/dispatch/struct_.rs:33 — crates/polars-expr/src/dispatch/struct_.rs:33-48 | crates/polars-expr/src/dispatch/struct_.rs:54-74 | crates/polars-expr/src/dispatch/struct_.rs:76-91 | crates/polars-expr/src/dispatch/struct_.rs:93-108 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-expr/src/reduce/mod.rs:426 — crates/polars-expr/src/reduce/mod.rs:426-461 | crates/polars-expr/src/reduce/mod.rs:469-507 | crates/polars-expr/src/reduce/mod.rs:690-716 | crates/polars-expr/src/reduce/mod.rs:724-755 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-io/src/csv/write/write_impl/serializer.rs:206 — crates/polars-io/src/csv/write/write_impl/serializer.rs:206-222 | crates/polars-io/src/csv/write/write_impl/serializer.rs:237-254 | crates/polars-io/src/csv/write/write_impl/serializer.rs:271-288 | crates/polars-io/src/csv/write/write_impl/serializer.rs:305-321 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-ops/src/chunked_array/array/join.rs:9 — crates/polars-ops/src/chunked_array/array/join.rs:9-40 | crates/polars-ops/src/chunked_array/array/join.rs:46-85 | crates/polars-ops/src/chunked_array/list/namespace.rs:74-104 | crates/polars-ops/src/chunked_array/list/namespace.rs:110-146 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-ops/src/frame/join/asof/groups.rs:212 — crates/polars-ops/src/frame/join/asof/groups.rs:212-295 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:25-130 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:138-233 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:241-359 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-ops/src/series/ops/log.rs:79 — crates/polars-ops/src/series/ops/log.rs:79-99 | crates/polars-ops/src/series/ops/log.rs:102-122 | crates/polars-ops/src/series/ops/log.rs:125-153 | crates/polars-ops/src/series/ops/log.rs:156-184 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs:30 — crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs:30-45 | crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:40-68 | crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:41-61 | crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:37-62 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-parquet/src/arrow/read/deserialize/categorical.rs:260 — crates/polars-parquet/src/arrow/read/deserialize/categorical.rs:260-273 | crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:221-234 | crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:195-208 | crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:309-322 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-parquet/src/arrow/write/binary/nested.rs:22 — crates/polars-parquet/src/arrow/write/binary/nested.rs:22-51 | crates/polars-parquet/src/arrow/write/binview/nested.rs:18-47 | crates/polars-parquet/src/arrow/write/boolean/nested.rs:17-44 | crates/polars-parquet/src/arrow/write/fixed_size_binary/nested.rs:17-38 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) REDACTED:5024 — REDACTED:5024-5103 | REDACTED:5113-5182 | REDACTED:7358-7415 | crates/polars-sql/src/sql_visitors.rs:750-785 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-sql/src/subquery.rs:348 — crates/polars-sql/src/subquery.rs:348-402 | crates/polars-sql/src/subquery.rs:1662-1884 | crates/polars-sql/src/subquery.rs:1896-2078 | crates/polars-sql/src/subquery.rs:2303-2434 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-sql/src/subquery_outer_select.rs:39 — crates/polars-sql/src/subquery_outer_select.rs:39-107 | crates/polars-sql/src/subquery_pull_up.rs:142-229 | crates/polars-sql/src/subquery_pull_up.rs:417-473 | crates/polars-sql/src/subquery_pull_up.rs:577-645 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-stream/src/nodes/dynamic_group_by.rs:317 — crates/polars-stream/src/nodes/dynamic_group_by.rs:317-459 | crates/polars-stream/src/nodes/rolling_fixed_window.rs:177-272 | crates/polars-stream/src/nodes/rolling_group_by.rs:258-392 | crates/polars-stream/src/nodes/sorted_group_by.rs:151-300 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-stream/src/nodes/forward_fill.rs:62 — crates/polars-stream/src/nodes/forward_fill.rs:62-214 | crates/polars-stream/src/nodes/gather_every.rs:55-118 | crates/polars-stream/src/nodes/sorted_unique.rs:74-173 | crates/polars-stream/src/nodes/with_row_index.rs:51-99 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-time/src/chunkedarray/datetime.rs:42 — crates/polars-time/src/chunkedarray/datetime.rs:42-61 | crates/polars-time/src/chunkedarray/datetime.rs:63-82 | crates/polars-time/src/chunkedarray/datetime.rs:101-120 | crates/polars-time/src/chunkedarray/datetime.rs:170-189 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) py-polars/src/polars/expr/list.py:1542 — py-polars/src/polars/expr/list.py:1542-1581 | py-polars/src/polars/expr/list.py:1584-1625 | py-polars/src/polars/expr/list.py:1628-1665 | py-polars/src/polars/expr/list.py:1668-1707 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×17
  • Edited copy of a member (16 corresponding lines) crates/polars-core/src/chunked_array/ops/arity.rs:154 — crates/polars-core/src/chunked_array/ops/arity.rs:154-169 | crates/polars-core/src/chunked_array/ops/arity.rs:181-196 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-expr/src/idx_table/key_rows.rs:134 — crates/polars-expr/src/idx_table/key_rows.rs:134-149 | crates/polars-expr/src/idx_table/row_encoded.rs:92-107 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-sql/src/catalog.rs:808 — crates/polars-sql/src/catalog.rs:808-827 | crates/polars-sql/src/catalog.rs:1058-1073 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-utils/src/arc.rs:4 — crates/polars-utils/src/arc.rs:4-19 | crates/polars-utils/src/arc.rs:24-39 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-python/src/map/series.rs:42 — crates/polars-python/src/map/series.rs:42-57 | crates/polars-python/src/series/map.rs:82-101 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-lazy/src/frame/mod.rs:2073 — crates/polars-lazy/src/frame/mod.rs:2073-2088 | crates/polars-lazy/src/frame/mod.rs:2091-2106 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-expr/src/dispatch/pow.rs:174 — crates/polars-expr/src/dispatch/pow.rs:174-189 | crates/polars-expr/src/dispatch/trigonometry.rs:34-50 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-python/src/expr/mod.rs:48 — crates/polars-python/src/expr/mod.rs:48-63 | crates/polars-utils/src/python_thread_pool.rs:23-45 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-expr/src/groups/single_key.rs:210 — crates/polars-expr/src/groups/single_key.rs:210-225 | crates/polars-expr/src/idx_table/single_key.rs:310-329 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-core/src/frame/builder.rs:36 — crates/polars-core/src/frame/builder.rs:36-51 | crates/polars-core/src/frame/builder.rs:53-70 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-core/src/utils/mod.rs:1264 — crates/polars-core/src/utils/mod.rs:1264-1279 | crates/polars-core/src/utils/mod.rs:1284-1302 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-compute/src/cardinality.rs:127 — crates/polars-compute/src/cardinality.rs:127-142 | crates/polars-compute/src/cardinality.rs:144-159 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs:708 — crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs:708-725 | crates/polars-parquet/src/parquet/encoding/hybrid_rle/mod.rs:193-208 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-expr/src/reduce/cov.rs:32 — crates/polars-expr/src/reduce/cov.rs:32-48 | crates/polars-expr/src/reduce/cov.rs:178-193 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) py-polars/src/polars/lazyframe/opt_flags.py:46 — py-polars/src/polars/lazyframe/opt_flags.py:46-61 | py-polars/src/polars/lazyframe/opt_flags.py:94-111 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:189 — crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:189-204 | crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:171-188 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) crates/polars-io/src/catalog/unity/client.rs:200 — crates/polars-io/src/catalog/unity/client.rs:200-218 | crates/polars-io/src/catalog/unity/client.rs:279-294 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×17
  • Duplicated block (18 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:512 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:512-529 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:693-710 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:512` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-core/src/frame/group_by/aggregations/mod.rs:511` calls `clone`, `into_series`, `agg_last_non_null` and `crates/polars-core/src/frame/group_by/aggregations/mod.rs:692` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) crates/polars-core/src/series/arithmetic/list.rs:597 — crates/polars-core/src/series/arithmetic/list.rs:597-614 | crates/polars-core/src/series/arithmetic/list.rs:695-712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/list.rs:597` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/polars-core/src/series/from.rs:335 — crates/polars-core/src/series/from.rs:335-352 | crates/polars-core/src/series/from.rs:362-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/from.rs:335` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/polars-io/src/csv/read/streaming.rs:40 — crates/polars-io/src/csv/read/streaming.rs:40-57 | crates/polars-io/src/csv/read/streaming.rs:223-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/polars-ops/src/chunked_array/list/min_max.rs:100 — crates/polars-ops/src/chunked_array/list/min_max.rs:100-117 | crates/polars-ops/src/chunked_array/list/min_max.rs:218-235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/min_max.rs:100` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (18 lines × 2) crates/polars-ops/src/chunked_array/list/namespace.rs:426 — crates/polars-ops/src/chunked_array/list/namespace.rs:426-443 | crates/polars-ops/src/chunked_array/list/namespace.rs:500-517 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/namespace.rs:426` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (18 lines × 2) crates/polars-ops/src/chunked_array/strings/namespace.rs:632 — crates/polars-ops/src/chunked_array/strings/namespace.rs:632-649 | crates/polars-ops/src/chunked_array/strings/namespace.rs:673-690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/strings/namespace.rs:632` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:259 — crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:259-276 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:283-300 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:259` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:781 — crates/polars-parquet/src/arrow/write/mod.rs:781-798 | crates/polars-parquet/src/arrow/write/mod.rs:1081-1098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:781` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/polars-plan/src/plans/aexpr/predicates/skip_batches.rs:408 — crates/polars-plan/src/plans/aexpr/predicates/skip_batches.rs:408-425 | crates/polars-plan/src/plans/aexpr/predicates/skip_batches.rs:456-473 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/predicates/skip_batches.rs:408` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/polars-sql/src/sql_expr.rs:2521 — crates/polars-sql/src/sql_expr.rs:2521-2538 | crates/polars-sql/src/sql_expr.rs:2594-2611 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-sql/src/sql_expr.rs:2521` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/polars-stream/src/nodes/backward_fill.rs:52 — crates/polars-stream/src/nodes/backward_fill.rs:52-69 | crates/polars-stream/src/nodes/interpolate.rs:66-83 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:811 — crates/polars-stream/src/physical_plan/lower_expr.rs:811-828 | crates/polars-stream/src/physical_plan/lower_expr.rs:871-895 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:811` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (18 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:2382 — crates/polars-stream/src/physical_plan/lower_expr.rs:2382-2399 | crates/polars-stream/src/physical_plan/lower_expr.rs:2456-2473 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:2382` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (18 lines × 2) crates/polars-row/src/fixed/decimal.rs:189 — crates/polars-row/src/fixed/decimal.rs:189-206 | crates/polars-row/src/fixed/decimal.rs:224-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:63 — crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:63-80 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/mod.rs:57-74 — `crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs` and `crates/polars-stream/src/nodes/io_sinks/writers/ndjson/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 78 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:63` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) py-polars/src/polars/functions/eager.py:308 — py-polars/src/polars/functions/eager.py:308-325 | py-polars/src/polars/functions/eager.py:619-636 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/functions/eager.py:308` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `QueryOptFlags` names `polars.lazyframe` in one and `polars.lazyframe.opt_flags` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×17
  • Duplicated block (7 lines × 3) crates/polars-buffer/src/storage.rs:158 — crates/polars-buffer/src/storage.rs:158-164 | crates/polars-buffer/src/storage.rs:217-223 | crates/polars-buffer/src/storage.rs:236-242 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-buffer/src/storage.rs:158` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:469 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:469-475 | crates/polars-core/src/series/arithmetic/fixed_size_list.rs:519-525 | crates/polars-core/src/series/arithmetic/fixed_size_list.rs:569-575 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/fixed_size_list.rs:469` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) crates/polars-expr/src/idx_table/binview.rs:223 — crates/polars-expr/src/idx_table/binview.rs:223-229 | crates/polars-expr/src/idx_table/binview.rs:240-247 | crates/polars-expr/src/idx_table/row_encoded.rs:147-154 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/idx_table/binview.rs:223` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) crates/polars-json/src/json/write/serialize.rs:187 — crates/polars-json/src/json/write/serialize.rs:187-193 | crates/polars-json/src/json/write/serialize.rs:202-208 | crates/polars-json/src/json/write/serialize.rs:217-223 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-json/src/json/write/serialize.rs:186` calls `unwrap` and `crates/polars-json/src/json/write/serialize.rs:201` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 3) crates/polars-ops/src/chunked_array/array/sum_mean.rs:55 — crates/polars-ops/src/chunked_array/array/sum_mean.rs:55-61 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:65-71 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:216-222 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/array/sum_mean.rs:55` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) crates/polars-ops/src/chunked_array/list/dispersion.rs:6 — crates/polars-ops/src/chunked_array/list/dispersion.rs:6-12 | crates/polars-ops/src/chunked_array/list/dispersion.rs:51-57 | crates/polars-ops/src/chunked_array/list/dispersion.rs:87-93 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/dispersion.rs:6` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) crates/polars-ops/src/chunked_array/list/sum_mean.rs:88 — crates/polars-ops/src/chunked_array/list/sum_mean.rs:88-94 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:108-114 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:123-129 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/sum_mean.rs:88` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 3) crates/polars-ops/src/chunked_array/strings/pad.rs:66 — crates/polars-ops/src/chunked_array/strings/pad.rs:66-72 | crates/polars-ops/src/chunked_array/strings/pad.rs:83-89 | crates/polars-ops/src/chunked_array/strings/pad.rs:100-106 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/strings/pad.rs:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) crates/polars-parquet/src/arrow/write/binary/nested.rs:24 — crates/polars-parquet/src/arrow/write/binary/nested.rs:24-30 | crates/polars-parquet/src/arrow/write/binview/nested.rs:20-26 | crates/polars-parquet/src/arrow/write/fixed_size_binary/nested.rs:19-25 — `crates/polars-parquet/src/arrow/write/binary/nested.rs` and `crates/polars-parquet/src/arrow/write/binview/nested.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 38 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 3) crates/polars-parquet/src/arrow/write/mod.rs:469 — crates/polars-parquet/src/arrow/write/mod.rs:469-475 | crates/polars-parquet/src/arrow/write/mod.rs:773-779 | crates/polars-parquet/src/arrow/write/mod.rs:797-803 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:469` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) crates/polars-sql/src/subquery_pull_up.rs:1132 — crates/polars-sql/src/subquery_pull_up.rs:1132-1138 | crates/polars-sql/src/subquery_pull_up.rs:1155-1161 | crates/polars-sql/src/subquery_pull_up.rs:1227-1233 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-sql/src/subquery_pull_up.rs:1132` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 3) crates/polars-io/src/cloud/credential_provider.rs:812 — crates/polars-io/src/cloud/credential_provider.rs:812-818 | crates/polars-io/src/cloud/credential_provider.rs:889-895 | crates/polars-io/src/cloud/credential_provider.rs:995-1001 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/cloud/credential_provider.rs:812` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) crates/polars-expr/src/reduce/skew_kurtosis.rs:101 — crates/polars-expr/src/reduce/skew_kurtosis.rs:101-107 | crates/polars-expr/src/reduce/skew_kurtosis.rs:168-174 | crates/polars-expr/src/reduce/var_std.rs:75-81 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (7 lines × 3) crates/polars-stream/src/nodes/group_by/tuning.rs:24 — crates/polars-stream/src/nodes/group_by/tuning.rs:24-30 | crates/polars-stream/src/nodes/joins/tuning.rs:17-23 | crates/polars-stream/src/nodes/window/tuning.rs:18-24 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) crates/polars-plan/src/dsl/array.rs:189 — crates/polars-plan/src/dsl/array.rs:189-195 | crates/polars-plan/src/dsl/list.rs:271-277 | crates/polars-plan/src/dsl/list.rs:279-285 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (7 lines × 3) docs/source/src/rust/user-guide/io/csv.rs:6 — docs/source/src/rust/user-guide/io/csv.rs:6-12 | docs/source/src/rust/user-guide/io/json.rs:3-9 | docs/source/src/rust/user-guide/io/parquet.rs:5-11 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7 lines × 3) crates/polars-ops/src/chunked_array/array/sum_mean.rs:97 — crates/polars-ops/src/chunked_array/array/sum_mean.rs:97-103 | crates/polars-ops/src/chunked_array/array/sum_mean.rs:133-139 | crates/polars-ops/src/chunked_array/array/sum_mean.rs:141-147 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/array/sum_mean.rs:97` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · polars_stream · ×16
  • polars_stream::physical_plan::lower_ir::lower_ir_inner (cyclomatic 156) crates/polars-stream/src/physical_plan/lower_ir.rs:279 — polars_stream::physical_plan::lower_ir::lower_ir_inner has cyclomatic complexity 156 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_stream::physical_plan::fmt::visualize_plan_rec (cyclomatic 127) crates/polars-stream/src/physical_plan/fmt.rs:181 — polars_stream::physical_plan::fmt::visualize_plan_rec has cyclomatic complexity 127 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx (cyclomatic 115) crates/polars-stream/src/physical_plan/lower_expr.rs:556 — polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx has cyclomatic complexity 115 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_stream::physical_plan::to_graph::to_graph_rec (cyclomatic 113) crates/polars-stream/src/physical_plan/to_graph.rs:137 — polars_stream::physical_plan::to_graph::to_graph_rec has cyclomatic complexity 113 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • polars_stream::physical_plan::to_description::phys_props (cyclomatic 81) crates/polars-stream/src/physical_plan/to_description.rs:67 — polars_stream::physical_plan::to_description::phys_props has cyclomatic complexity 81 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_stream::physical_plan::_visit_nodes_impl (cyclomatic 58) crates/polars-stream/src/physical_plan/mod.rs:662 — polars_stream::physical_plan::_visit_nodes_impl has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_stream::physical_plan::lower_group_by::try_lower_elementwise_scalar_agg_expr (cyclomatic 42) crates/polars-stream/src/physical_plan/lower_group_by.rs:263 — polars_stream::physical_plan::lower_group_by::try_lower_elementwise_scalar_agg_expr has cyclomatic complexity 42 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_stream::nodes::io_sources::multi_scan::pipeline::initialization::finish_initialize_multi_scan_pipeline (cyclomatic 41) crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/initialization.rs:99 — polars_stream::nodes::io_sources::multi_scan::pipeline::initialization::finish_initialize_multi_scan_pipeline has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • polars_stream::physical_plan::lower_expr::is_input_independent_rec (cyclomatic 32) crates/polars-stream/src/physical_plan/lower_expr.rs:105 — polars_stream::physical_plan::lower_expr::is_input_independent_rec has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by_with_key_ranges (cyclomatic 31) crates/polars-stream/src/physical_plan/lower_group_by.rs:1021 — polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by_with_key_ranges has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_stream::nodes::joins::merge_join::find_mergeable_search (cyclomatic 27) crates/polars-stream/src/nodes/joins/merge_join.rs:732 — polars_stream::nodes::joins::merge_join::find_mergeable_search has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • polars_stream::nodes::io_sources::multi_scan::pipeline::tasks::reader_starter::start_reader_impl (cyclomatic 21) crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/reader_starter.rs:443 — polars_stream::nodes::io_sources::multi_scan::pipeline::tasks::reader_starter::start_reader_impl has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_stream::nodes::merge_sorted::find_mergeable (cyclomatic 21) crates/polars-stream/src/nodes/merge_sorted.rs:51 — polars_stream::nodes::merge_sorted::find_mergeable has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_stream::execute::run_subgraph (cyclomatic 18) crates/polars-stream/src/execute.rs:140 — polars_stream::execute::run_subgraph has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_stream::execute::execute_graph (cyclomatic 17) crates/polars-stream/src/execute.rs:285 — polars_stream::execute::execute_graph has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_stream::nodes::io_sources::multi_scan::functions::resolve_slice::resolve_negative_slice (cyclomatic 16) crates/polars-stream/src/nodes/io_sources/multi_scan/functions/resolve_slice.rs:44 — polars_stream::nodes::io_sources::multi_scan::functions::resolve_slice::resolve_negative_slice has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · polars_parquet · ×15
  • polars_parquet::arrow::read::deserialize::simple::page_iter_to_array (cyclomatic 51) crates/polars-parquet/src/arrow/read/deserialize/simple.rs:31 — polars_parquet::arrow::read::deserialize::simple::page_iter_to_array has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_parquet::arrow::write::schema::to_parquet_type (cyclomatic 50) crates/polars-parquet/src/arrow/write/schema.rs:96 — polars_parquet::arrow::write::schema::to_parquet_type has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_parquet::arrow::write::array_to_page_simple (cyclomatic 42) crates/polars-parquet/src/arrow/write/mod.rs:364 — polars_parquet::arrow::write::array_to_page_simple has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_parquet::arrow::write::array_to_page_nested (cyclomatic 35) crates/polars-parquet/src/arrow/write/mod.rs:815 — polars_parquet::arrow::write::array_to_page_nested has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_parquet::arrow::read::deserialize::utils::unspecialized_decode (cyclomatic 29) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:122 — polars_parquet::arrow::read::deserialize::utils::unspecialized_decode has cyclomatic complexity 29 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_parquet::arrow::read::statistics::deserialize_all (cyclomatic 28) crates/polars-parquet/src/arrow/read/statistics.rs:155 — polars_parquet::arrow::read::statistics::deserialize_all has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_parquet::arrow::read::deserialize::binview::decode_plain_generic (cyclomatic 26) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:383 — polars_parquet::arrow::read::deserialize::binview::decode_plain_generic has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_parquet::arrow::write::dictionary::array_to_pages (cyclomatic 26) crates/polars-parquet/src/arrow/write/dictionary.rs:497 — polars_parquet::arrow::write::dictionary::array_to_pages has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_dict (cyclomatic 24) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:344 — polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_dict has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_plain (cyclomatic 22) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:214 — polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_plain has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • polars_parquet::arrow::write::pages::to_nested_recursive (cyclomatic 21) crates/polars-parquet/src/arrow/write/pages.rs:136 — polars_parquet::arrow::write::pages::to_nested_recursive has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_parquet::arrow::geo::geo_key_value (cyclomatic 20) crates/polars-parquet/src/arrow/geo.rs:185 — polars_parquet::arrow::geo::geo_key_value has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_parquet::arrow::read::schema::convert::from_int64 (cyclomatic 18) crates/polars-parquet/src/arrow/read/schema/convert.rs:96 — polars_parquet::arrow::read::schema::convert::from_int64 has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: polars_parquet::arrow::read::schema::convert::from_int32 (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • polars_parquet::arrow::read::deserialize::nested::columns_to_iter_recursive (cyclomatic 17) crates/polars-parquet/src/arrow/read/deserialize/nested.rs:15 — polars_parquet::arrow::read::deserialize::nested::columns_to_iter_recursive has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • polars_parquet::arrow::read::deserialize::dictionary_encoded::optional::decode (cyclomatic 16) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs:14 — polars_parquet::arrow::read::deserialize::dictionary_encoded::optional::decode has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×15
  • Edited copy of a member (4 corresponding lines) crates/polars-compute/src/binview_index_map.rs:260 — crates/polars-compute/src/binview_index_map.rs:260-267 | crates/polars-utils/src/idx_map/bytes_idx_map.rs:118-121 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-compute/src/binview_index_map.rs:274 — crates/polars-compute/src/binview_index_map.rs:274-277 | crates/polars-utils/src/idx_map/bytes_idx_map.rs:128-131 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-core/src/frame/group_by/aggregations/boolean.rs:24 — crates/polars-core/src/frame/group_by/aggregations/boolean.rs:24-27 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:252-255 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-core/src/frame/group_by/aggregations/mod.rs:261 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:261-264 | crates/polars-core/src/frame/group_by/aggregations/string.rs:14-17 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-core/src/chunked_array/object/mod.rs:199 — crates/polars-arrow/src/array/binview/mod.rs:718-721 | crates/polars-core/src/chunked_array/object/mod.rs:199-202 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-expr/src/reduce/mean.rs:235 — crates/polars-expr/src/reduce/mean.rs:235-238 | crates/polars-expr/src/reduce/var_std.rs:170-173 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-sql/src/catalog.rs:469 — crates/polars-sql/src/catalog.rs:469-472 | crates/polars-sql/src/time_travel.rs:76-79 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-stream/src/nodes/sort/mod.rs:490 — crates/polars-stream/src/nodes/sort/mod.rs:490-493 | crates/polars-stream/src/nodes/window/flush.rs:242-245 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-core/src/chunked_array/object/mod.rs:194 — crates/polars-arrow/src/array/binview/mod.rs:713-716 | crates/polars-core/src/chunked_array/object/mod.rs:194-197 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-compute/src/binview_index_map.rs:81 — crates/polars-compute/src/binview_index_map.rs:81-84 | crates/polars-utils/src/idx_map/bytes_idx_map.rs:69-72 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-core/src/frame/group_by/aggregations/mod.rs:215 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:215-218 | crates/polars-core/src/frame/group_by/aggregations/string.rs:6-9 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-expr/src/expressions/column.rs:120 — crates/polars-expr/src/expressions/column.rs:120-123 | crates/polars-expr/src/expressions/element.rs:34-37 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-core/src/chunked_array/builder/boolean.rs:22 — crates/polars-core/src/chunked_array/builder/boolean.rs:22-25 | crates/polars-core/src/chunked_array/builder/primitive.rs:28-31 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-parquet/src/parquet/write/indexes/write.rs:27 — crates/polars-parquet/src/parquet/write/indexes/write.rs:27-31 | crates/polars-parquet/src/parquet/write/page.rs:250-253 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/polars-stream/src/nodes/group_by/tuning.rs:134 — crates/polars-stream/src/nodes/group_by/tuning.rs:134-137 | crates/polars-stream/src/nodes/joins/tuning.rs:105-108 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D1 · Cyclomatic Complexity · polars_ops · ×14
  • polars_ops::series::ops::unique::unique_counts (cyclomatic 41) crates/polars-ops/src/series/ops/unique.rs:32 — polars_ops::series::ops::unique::unique_counts has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_ops::frame::join::merge_join::gather_and_postprocess (cyclomatic 30) crates/polars-ops/src/frame/join/merge_join.rs:227 — polars_ops::frame::join::merge_join::gather_and_postprocess has cyclomatic complexity 30 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • polars_ops::series::ops::index_of::index_of (cyclomatic 23) crates/polars-ops/src/series/ops/index_of.rs:63 — polars_ops::series::ops::index_of::index_of has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_ops::chunked_array::gather::chunked::take_opt_chunked_unchecked_binview (cyclomatic 22) crates/polars-ops/src/chunked_array/gather/chunked.rs:685 — polars_ops::chunked_array::gather::chunked::take_opt_chunked_unchecked_binview has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_ops::series::ops::rank::rank (cyclomatic 22) crates/polars-ops/src/series/ops/rank.rs:29 — polars_ops::series::ops::rank::rank has cyclomatic complexity 22 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_ops::series::ops::various::is_sorted_impl (cyclomatic 22) crates/polars-ops/src/series/ops/various.rs:128 — polars_ops::series::ops::various::is_sorted_impl has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • polars_ops::frame::join::cross_join::fused_cross_filter (cyclomatic 20) crates/polars-ops/src/frame/join/cross_join.rs:139 — polars_ops::frame::join::cross_join::fused_cross_filter has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_ops::series::ops::duration::impl_duration (cyclomatic 20) crates/polars-ops/src/series/ops/duration.rs:7 — polars_ops::series::ops::duration::impl_duration has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_ops::chunked_array::list::get::lst_get (cyclomatic 17) crates/polars-ops/src/chunked_array/list/get.rs:9 — polars_ops::chunked_array::list::get::lst_get has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_ops::series::ops::clip::clip_helper_both_bounds (cyclomatic 17) crates/polars-ops/src/series/ops/clip.rs:152 — polars_ops::series::ops::clip::clip_helper_both_bounds has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_ops::series::ops::rle::rle_lengths (cyclomatic 17) crates/polars-ops/src/series/ops/rle.rs:13 — polars_ops::series::ops::rle::rle_lengths has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_ops::chunked_array::gather::chunked::take_chunked_unchecked_binview (cyclomatic 16) crates/polars-ops/src/chunked_array/gather/chunked.rs:480 — polars_ops::chunked_array::gather::chunked::take_chunked_unchecked_binview has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_ops::chunked_array::strings::concat::hor_str_concat (cyclomatic 16) crates/polars-ops/src/chunked_array/strings/concat.rs:59 — polars_ops::chunked_array::strings::concat::hor_str_concat has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_ops::frame::join::hash_join::single_keys::build_tables (cyclomatic 16) crates/polars-ops/src/frame/join/hash_join/single_keys.rs:16 — polars_ops::frame::join::hash_join::single_keys::build_tables has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · polars_compute · ×14
  • polars_compute::decimal::str_to_dec128 (cognitive 40) crates/polars-compute/src/decimal.rs:1072 — polars_compute::decimal::str_to_dec128 has cognitive complexity 40 (threshold 15). Drivers by points: if/else 28 (34 pts), boolean chains 5, match/switch 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • polars_compute::rolling::create_validity (cognitive 35) crates/polars-compute/src/rolling/mod.rs:93 — polars_compute::rolling::create_validity has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_compute::decimal::divrem_256_128 (cognitive 24) crates/polars-compute/src/decimal.rs:382 — polars_compute::decimal::divrem_256_128 has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 11 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • polars_compute::gather::fixed_size_list::take_unchecked (cognitive 24) crates/polars-compute/src/gather/fixed_size_list.rs:158 — polars_compute::gather::fixed_size_list::take_unchecked has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_compute::cast::cast (cognitive 23) crates/polars-compute/src/cast/mod.rs:400 — polars_compute::cast::cast has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 12 (22 pts), if/else 1 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_compute::cast::cast_list_uint8_to_binary (cognitive 22) crates/polars-compute/src/cast/mod.rs:241 — polars_compute::cast::cast_list_uint8_to_binary has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_compute::filter::boolean::filter_boolean_kernel_sparse (cognitive 22) crates/polars-compute/src/filter/boolean.rs:106 — polars_compute::filter::boolean::filter_boolean_kernel_sparse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 5 (8 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_compute::cast::cast_list_to_fixed_size_list (cognitive 20) crates/polars-compute/src/cast/mod.rs:171 — polars_compute::cast::cast_list_to_fixed_size_list has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (10 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_compute::cast::binview_to::try_binview_to_fixed_size_list (cognitive 20) crates/polars-compute/src/cast/binview_to.rs:167 — polars_compute::cast::binview_to::try_binview_to_fixed_size_list has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_compute::gather::sublist::list::sublist_get_indexes (cognitive 18) crates/polars-compute/src/gather/sublist/list.rs:39 — polars_compute::gather::sublist::list::sublist_get_indexes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_compute::rolling::van_herk::van_herk_kernel (cognitive 17) crates/polars-compute/src/rolling/van_herk.rs:66 — polars_compute::rolling::van_herk::van_herk_kernel has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 5 (7 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_compute::decimal::dec128_div_scaled (cognitive 16) crates/polars-compute/src/decimal.rs:837 — polars_compute::decimal::dec128_div_scaled has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_compute::gather::primitive::take_values_and_validity_unchecked (cognitive 16) crates/polars-compute/src/gather/primitive.rs:9 — polars_compute::gather::primitive::take_values_and_validity_unchecked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_compute::propagate_nulls::propagate_nulls_struct (cognitive 16) crates/polars-compute/src/propagate_nulls.rs:198 — polars_compute::propagate_nulls::propagate_nulls_struct has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (3 pts), match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×14
  • Edited copy of a member (18 corresponding lines) crates/polars-json/src/json/deserialize.rs:43 — crates/polars-json/src/json/deserialize.rs:43-60 | crates/polars-json/src/json/deserialize.rs:391-411 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-core/src/frame/column/mod.rs:1827 — crates/polars-core/src/frame/column/mod.rs:1827-1846 | crates/polars-core/src/frame/column/mod.rs:1869-1886 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-compute/src/moment.rs:650 — crates/polars-compute/src/moment.rs:650-667 | crates/polars-compute/src/moment.rs:673-690 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-core/src/utils/mod.rs:1017 — crates/polars-core/src/utils/mod.rs:1017-1034 | crates/polars-core/src/utils/mod.rs:1043-1060 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-compute/src/float_sum.rs:198 — crates/polars-compute/src/float_sum.rs:198-216 | crates/polars-compute/src/float_sum.rs:224-241 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-compute/src/moment.rs:349 — crates/polars-compute/src/moment.rs:349-366 | crates/polars-compute/src/moment.rs:492-515 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-parquet/src/parquet/handwritten_thrift/parquet_thrift.rs:173 — crates/polars-parquet/src/parquet/handwritten_thrift/parquet_thrift.rs:173-190 | crates/polars-parquet/src/parquet/handwritten_thrift/parquet_thrift.rs:229-249 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-plan/src/dsl/function_expr/cat.rs:22 — crates/polars-plan/src/dsl/function_expr/cat.rs:22-39 | crates/polars-plan/src/plans/aexpr/function_expr/cat.rs:45-62 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-python/src/io/parquet_encryption.rs:27 — crates/polars-python/src/io/parquet_encryption.rs:27-44 | crates/polars-python/src/io/parquet_encryption.rs:66-83 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-io/src/csv/read/parser.rs:447 — crates/polars-io/src/csv/read/parser.rs:447-468 | crates/polars-io/src/csv/read/parser.rs:692-709 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-compute/src/rolling/moment.rs:270 — crates/polars-compute/src/rolling/moment.rs:270-287 | crates/polars-compute/src/rolling/sum.rs:132-149 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-plan/src/dsl/function_expr/bitwise.rs:26 — crates/polars-plan/src/dsl/function_expr/bitwise.rs:26-43 | crates/polars-plan/src/plans/aexpr/function_expr/bitwise.rs:66-83 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-ops/src/frame/join/hash_join/mod.rs:66 — crates/polars-ops/src/frame/join/hash_join/mod.rs:66-83 | crates/polars-ops/src/frame/join/hash_join/mod.rs:93-110 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/polars-plan/src/plans/aexpr/properties/general.rs:99 — crates/polars-plan/src/plans/aexpr/properties/general.rs:99-116 | crates/polars-plan/src/plans/aexpr/properties/general.rs:408-427 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×14
  • Edited copy of a member (15 corresponding lines) crates/polars-python/src/functions/io.rs:121 — crates/polars-python/src/functions/io.rs:121-144 | crates/polars-python/src/functions/io.rs:158-172 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-core/src/datatypes/any_value.rs:682 — crates/polars-core/src/datatypes/any_value.rs:682-697 | crates/polars-core/src/datatypes/any_value.rs:1164-1178 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-expr/src/reduce/any_all.rs:325 — crates/polars-expr/src/reduce/any_all.rs:325-339 | crates/polars-expr/src/reduce/any_all.rs:451-465 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-expr/src/dispatch/range/datetime_range.rs:23 — crates/polars-expr/src/dispatch/range/datetime_range.rs:23-37 | crates/polars-expr/src/dispatch/range/datetime_range.rs:45-59 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-expr/src/expressions/apply.rs:234 — crates/polars-expr/src/expressions/apply.rs:234-248 | crates/polars-expr/src/expressions/structeval.rs:54-68 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:215 — crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:215-229 | crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:593-609 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-sql/src/functions.rs:2697 — crates/polars-sql/src/functions.rs:2697-2711 | crates/polars-sql/src/functions.rs:2766-2782 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-json/src/json/write/serialize.rs:125 — crates/polars-json/src/json/write/serialize.rs:125-139 | crates/polars-json/src/json/write/serialize.rs:145-159 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-expr/src/dispatch/datetime.rs:327 — crates/polars-expr/src/dispatch/datetime.rs:327-341 | crates/polars-expr/src/dispatch/datetime.rs:343-357 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-core/src/utils/mod.rs:842 — crates/polars-core/src/utils/mod.rs:842-856 | crates/polars-core/src/utils/mod.rs:864-878 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-utils/src/mem.rs:21 — crates/polars-utils/src/mem.rs:21-35 | crates/polars-utils/src/mem.rs:40-54 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-python/src/conversion/mod.rs:1232 — crates/polars-python/src/conversion/mod.rs:1232-1247 | crates/polars-python/src/conversion/mod.rs:1253-1267 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-expr/src/idx_table/binview.rs:45 — crates/polars-expr/src/idx_table/binview.rs:45-59 | crates/polars-expr/src/idx_table/row_encoded.rs:40-54 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:241 — crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:241-255 | crates/polars-parquet/src/arrow/read/deserialize/primitive/mod.rs:50-65 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×14
  • Edited copy of a member (7 corresponding lines) crates/polars-ops/src/chunked_array/list/min_max.rs:38 — crates/polars-ops/src/chunked_array/list/min_max.rs:38-44 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:187-193 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-core/src/chunked_array/arg_min_max.rs:21 — crates/polars-core/src/chunked_array/arg_min_max.rs:21-27 | crates/polars-core/src/chunked_array/arg_min_max.rs:33-39 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-ops/src/chunked_array/binary/namespace.rs:80 — crates/polars-ops/src/chunked_array/binary/namespace.rs:80-86 | crates/polars-ops/src/chunked_array/strings/namespace.rs:915-922 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-python/src/functions/range.rs:173 — crates/polars-python/src/functions/range.rs:173-179 | crates/polars-python/src/functions/range.rs:187-193 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-compute/src/rolling/moment.rs:312 — crates/polars-compute/src/rolling/moment.rs:312-318 | crates/polars-compute/src/rolling/sum.rs:174-180 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:74 — crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:74-81 | crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:61-67 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-core/src/datatypes/extension/generic.rs:38 — crates/polars-core/src/datatypes/extension/generic.rs:38-44 | crates/polars-python/src/extension.rs:73-79 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-stream/src/nodes/io_sources/csv/builder.rs:36 — crates/polars-stream/src/nodes/io_sources/csv/builder.rs:36-42 | crates/polars-stream/src/nodes/io_sources/ndjson/builder.rs:34-40 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-compute/src/nan.rs:16 — crates/polars-compute/src/nan.rs:16-22 | crates/polars-io/src/csv/read/field_index.rs:63-69 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-expr/src/dispatch/array.rs:110 — crates/polars-expr/src/dispatch/array.rs:110-116 | crates/polars-plan/src/plans/aexpr/function_expr/array.rs:185-191 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-expr/src/dispatch/list.rs:389 — crates/polars-expr/src/dispatch/list.rs:389-395 | crates/polars-plan/src/plans/aexpr/function_expr/list.rs:224-230 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-ops/src/chunked_array/strings/literal_chain.rs:57 — crates/polars-ops/src/chunked_array/strings/literal_chain.rs:57-63 | crates/polars-ops/src/chunked_array/strings/namespace.rs:93-99 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-python/src/error.rs:160 — crates/polars-python/src/error.rs:160-167 | pyo3-polars/pyo3-polars/src/error.rs:61-67 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) crates/polars-utils/src/idx_vec.rs:232 — crates/polars-arrow/src/array/list/mutable.rs:69-76 | crates/polars-utils/src/idx_vec.rs:232-238 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×14
  • Duplicated block (17 lines × 2) crates/polars-core/src/chunked_array/random.rs:88 — crates/polars-core/src/chunked_array/random.rs:88-104 | crates/polars-core/src/chunked_array/random.rs:142-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/random.rs:88` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-core/src/chunked_array/random.rs:86` calls `Ok`, `clear` and `crates/polars-core/src/chunked_array/random.rs:141` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 2) crates/polars-core/src/fmt.rs:676 — crates/polars-core/src/fmt.rs:676-692 | crates/polars-core/src/fmt.rs:697-713 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/fmt.rs:676` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) crates/polars-mem-engine/src/executors/hconcat.rs:41 — crates/polars-mem-engine/src/executors/hconcat.rs:41-57 | crates/polars-mem-engine/src/executors/union.rs:91-107 — before extracting anything, compare `crates/polars-mem-engine/src/executors/hconcat.rs` and `crates/polars-mem-engine/src/executors/union.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/simple.rs:392 — crates/polars-parquet/src/arrow/read/deserialize/simple.rs:392-408 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:424-440 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/simple.rs:392` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:538 — crates/polars-parquet/src/arrow/write/mod.rs:538-554 | crates/polars-parquet/src/arrow/write/mod.rs:565-581 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:538` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:834 — crates/polars-plan/src/dsl/function_expr/mod.rs:834-850 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:821-837 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/mod.rs:834` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:820` calls `hash` and `crates/polars-plan/src/dsl/function_expr/mod.rs:833` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:136 — crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:136-152 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/mod.rs:127-143 — `crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs` and `crates/polars-stream/src/nodes/io_sinks/writers/ndjson/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 78 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:136` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) crates/polars-stream/src/nodes/sort/flush.rs:231 — crates/polars-stream/src/nodes/sort/flush.rs:231-247 | crates/polars-stream/src/nodes/window/flush.rs:210-226 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/sort/flush.rs:231` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) crates/polars-stream/src/physical_plan/fmt.rs:847 — crates/polars-stream/src/physical_plan/fmt.rs:847-863 | crates/polars-stream/src/physical_plan/fmt.rs:944-960 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/fmt.rs:847` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (17 lines × 2) crates/polars-stream/src/physical_plan/to_graph.rs:1387 — crates/polars-stream/src/physical_plan/to_graph.rs:1387-1403 | crates/polars-stream/src/physical_plan/to_graph.rs:1419-1435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/to_graph.rs:1387` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (17 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:41 — crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:41-57 | crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:48-64 — before extracting anything, compare `crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs` and `crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:41` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) crates/polars-parquet/src/parquet/encoding/hybrid_rle/mod.rs:94 — crates/polars-parquet/src/parquet/encoding/hybrid_rle/mod.rs:94-110 | crates/polars-parquet/src/parquet/encoding/hybrid_rle/mod.rs:151-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/parquet/encoding/hybrid_rle/mod.rs:94` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) crates/polars-expr/src/groups/row_encoded.rs:129 — crates/polars-expr/src/groups/row_encoded.rs:129-145 | crates/polars-expr/src/groups/row_encoded.rs:180-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/groups/row_encoded.rs:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) crates/polars-compute/src/propagate_nulls.rs:7 — crates/polars-compute/src/propagate_nulls.rs:7-23 | crates/polars-compute/src/trim_lists_to_normalized_offsets.rs:7-23 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×14
  • Duplicated block (16 lines × 2) crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:127 — crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:127-142 | crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:609-624 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:127` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) crates/polars-core/src/utils/mod.rs:253 — crates/polars-core/src/utils/mod.rs:253-268 | crates/polars-core/src/utils/mod.rs:275-290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) crates/polars-expr/src/dispatch/pow.rs:55 — crates/polars-expr/src/dispatch/pow.rs:55-70 | crates/polars-expr/src/dispatch/pow.rs:91-106 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/pow.rs:55` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) crates/polars-expr/src/expressions/eval.rs:223 — crates/polars-expr/src/expressions/eval.rs:223-238 | crates/polars-expr/src/expressions/eval.rs:406-421 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/eval.rs:223` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) crates/polars-io/src/parquet/read/read_impl.rs:223 — crates/polars-io/src/parquet/read/read_impl.rs:223-238 | crates/polars-io/src/parquet/read/read_impl.rs:365-380 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/parquet/read/read_impl.rs:223` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/boolean.rs:367 — crates/polars-parquet/src/arrow/read/deserialize/boolean.rs:367-382 | crates/polars-parquet/src/arrow/read/deserialize/boolean.rs:416-431 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/boolean.rs:367` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) crates/polars-plan/src/dsl/function_expr/cat.rs:24 — crates/polars-plan/src/dsl/function_expr/cat.rs:24-39 | crates/polars-plan/src/plans/aexpr/function_expr/cat.rs:47-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/cat.rs:24` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:550 — crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:550-565 | crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:580-595 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:550` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) crates/polars-stream/src/nodes/io_sources/csv/mod.rs:65 — crates/polars-stream/src/nodes/io_sources/csv/mod.rs:65-80 | crates/polars-stream/src/nodes/io_sources/ndjson/mod.rs:63-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (16 lines × 2) crates/polars-core/src/frame/mod.rs:1262 — crates/polars-core/src/frame/mod.rs:1262-1277 | crates/polars-core/src/frame/mod.rs:1310-1325 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/mod.rs:1262` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `idx` to `&IdxCa` in one and `&[IdxSize]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (16 lines × 2) crates/polars-ops/src/series/ops/is_in/mod.rs:405 — crates/polars-ops/src/series/ops/is_in/mod.rs:405-420 | crates/polars-ops/src/series/ops/is_in/mod.rs:493-508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/is_in/mod.rs:405` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) crates/polars-compute/src/moment.rs:332 — crates/polars-compute/src/moment.rs:332-347 | crates/polars-compute/src/moment.rs:465-480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (16 lines × 2) crates/polars-plan/src/dsl/function_expr/rolling_by.rs:18 — crates/polars-plan/src/dsl/function_expr/rolling_by.rs:18-33 | crates/polars-plan/src/plans/aexpr/function_expr/rolling_by.rs:17-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) py-polars/src/polars/functions/eager.py:355 — py-polars/src/polars/functions/eager.py:355-370 | py-polars/src/polars/functions/eager.py:666-681 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/functions/eager.py:355` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×14
  • Duplicated block (5 lines × 3) crates/polars-expr/src/groups/binview.rs:231 — crates/polars-expr/src/groups/binview.rs:231-235 | crates/polars-expr/src/groups/binview.rs:274-278 | crates/polars-expr/src/groups/binview.rs:315-319 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/polars-ops/src/chunked_array/array/dispersion.rs:27 — crates/polars-ops/src/chunked_array/array/dispersion.rs:27-31 | crates/polars-ops/src/chunked_array/array/dispersion.rs:62-66 | crates/polars-ops/src/chunked_array/list/dispersion.rs:74-78 — `crates/polars-ops/src/chunked_array/array/dispersion.rs` and `crates/polars-ops/src/chunked_array/list/dispersion.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 46 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/array/dispersion.rs:27` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:76 — crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:76-80 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:305-309 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:400-404 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:82 — crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:82-86 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:311-315 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:406-410 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:82` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) crates/polars-sql/src/functions.rs:3021 — crates/polars-sql/src/functions.rs:3021-3025 | crates/polars-sql/src/functions.rs:3034-3038 | crates/polars-sql/src/functions.rs:3197-3201 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/polars-stream/src/nodes/dynamic_group_by.rs:181 — crates/polars-stream/src/nodes/dynamic_group_by.rs:181-185 | crates/polars-stream/src/nodes/rolling_group_by.rs:123-127 | crates/polars-stream/src/nodes/sorted_group_by.rs:99-103 — before extracting anything, compare `crates/polars-stream/src/nodes/dynamic_group_by.rs` and `crates/polars-stream/src/nodes/rolling_group_by.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) crates/polars-stream/src/physical_plan/lower_expr.rs:1201 — crates/polars-stream/src/physical_plan/lower_expr.rs:1201-1209 | crates/polars-stream/src/physical_plan/lower_expr.rs:1492-1496 | crates/polars-stream/src/physical_plan/lower_expr.rs:1523-1529 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:1201` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) crates/polars-expr/src/reduce/any_all.rs:110 — crates/polars-expr/src/reduce/any_all.rs:110-114 | crates/polars-expr/src/reduce/any_all.rs:209-213 | crates/polars-expr/src/reduce/has_nulls.rs:102-106 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) crates/polars-expr/src/dispatch/strings.rs:297 — crates/polars-expr/src/dispatch/strings.rs:297-301 | crates/polars-expr/src/dispatch/strings.rs:310-314 | crates/polars-expr/src/dispatch/strings.rs:323-327 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/polars-core/src/utils/supertype.rs:261 — crates/polars-core/src/utils/supertype.rs:261-265 | crates/polars-core/src/utils/supertype.rs:310-314 | crates/polars-core/src/utils/supertype.rs:317-321 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-core/src/utils/supertype.rs:268` calls `is_integer`, `is_bool`, `Some` and `crates/polars-core/src/utils/supertype.rs:317` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) crates/polars-expr/src/reduce/bitwise.rs:239 — crates/polars-expr/src/reduce/bitwise.rs:239-243 | crates/polars-expr/src/reduce/min_max.rs:518-522 | crates/polars-expr/src/reduce/min_max.rs:634-638 — before extracting anything, compare `crates/polars-expr/src/reduce/bitwise.rs` and `crates/polars-expr/src/reduce/min_max.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 3) crates/polars-expr/src/reduce/first_last.rs:455 — crates/polars-expr/src/reduce/first_last.rs:455-459 | crates/polars-expr/src/reduce/first_last_nonnull.rs:447-451 | crates/polars-expr/src/reduce/implode.rs:357-361 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/first_last.rs:455` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) crates/polars-ops/src/series/ops/fused.rs:45 — crates/polars-ops/src/series/ops/fused.rs:45-49 | crates/polars-ops/src/series/ops/fused.rs:96-100 | crates/polars-ops/src/series/ops/fused.rs:146-150 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/fused.rs:45` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) crates/polars-stream/src/nodes/cum_agg.rs:69 — crates/polars-stream/src/nodes/cum_agg.rs:69-73 | crates/polars-stream/src/nodes/ewm.rs:47-51 | crates/polars-stream/src/nodes/rle_id.rs:54-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D1 · Cyclomatic Complexity · polars_io · ×13
  • polars_io::csv::write::write_impl::serializer::serializer_for (cyclomatic 72) crates/polars-io/src/csv/write/write_impl/serializer.rs:666 — polars_io::csv::write::write_impl::serializer::serializer_for has cyclomatic complexity 72 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_io::path_utils::expand_paths_hive (cyclomatic 41) crates/polars-io/src/path_utils/mod.rs:403 — polars_io::path_utils::expand_paths_hive has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_io::ndjson::buffer::deserialize_all (cyclomatic 32) crates/polars-io/src/ndjson/buffer.rs:246 — polars_io::ndjson::buffer::deserialize_all has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_io::csv::write::write_impl::serializer::string_serializer (cyclomatic 30) crates/polars-io/src/csv/write/write_impl/serializer.rs:442 — polars_io::csv::write::write_impl::serializer::string_serializer has cyclomatic complexity 30 (threshold 15). Of this number, 21 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_io::csv::read::parser::parse_lines (cyclomatic 27) crates/polars-io/src/csv/read/parser.rs:1134 — polars_io::csv::read::parser::parse_lines has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_io::csv::read::builder::init_builders (cyclomatic 25) crates/polars-io/src/csv/read/builder.rs:582 — polars_io::csv::read::builder::init_builders has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_io::csv::read::streaming::read_until_start_and_infer_schema_from_compressed_reader (cyclomatic 22) crates/polars-io/src/csv/read/streaming.rs:31 — polars_io::csv::read::streaming::read_until_start_and_infer_schema_from_compressed_reader has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (polars_io::csv::read::streaming::read_until_start_and_infer_schema) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::csv::read::streaming::read_until_start_and_infer_schema (cyclomatic 22) crates/polars-io/src/csv/read/streaming.rs:213 — polars_io::csv::read::streaming::read_until_start_and_infer_schema has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (polars_io::csv::read::streaming::read_until_start_and_infer_schema_from_compressed_reader) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::csv::read::streaming::infer_schema (cyclomatic 22) crates/polars-io/src/csv/read/streaming.rs:771 — polars_io::csv::read::streaming::infer_schema has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_io::csv::read::schema_inference::infer_field_schema (cyclomatic 20) crates/polars-io/src/csv/read/schema_inference.rs:337 — polars_io::csv::read::schema_inference::infer_field_schema has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • polars_io::csv::read::streaming::for_each_line_from_reader_from_compressed_reader (cyclomatic 19) crates/polars-io/src/csv/read/streaming.rs:395 — polars_io::csv::read::streaming::for_each_line_from_reader_from_compressed_reader has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (polars_io::csv::read::streaming::for_each_line_from_reader) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::csv::read::streaming::for_each_line_from_reader (cyclomatic 19) crates/polars-io/src/csv/read/streaming.rs:530 — polars_io::csv::read::streaming::for_each_line_from_reader has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (polars_io::csv::read::streaming::for_each_line_from_reader_from_compressed_reader) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_io::csv::read::schema_inference::infer_types_from_line (cyclomatic 17) crates/polars-io/src/csv/read/schema_inference.rs:166 — polars_io::csv::read::schema_inference::infer_types_from_line has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×13
  • Edited copy of a member (22 corresponding lines) crates/polars-core/src/datatypes/dtype.rs:1262 — crates/polars-core/src/datatypes/dtype.rs:1262-1283 | crates/polars-core/src/datatypes/dtype.rs:1286-1307 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-json/src/json/deserialize.rs:123 — crates/polars-json/src/json/deserialize.rs:123-144 | crates/polars-json/src/json/deserialize.rs:149-170 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-expr/src/dispatch/rolling.rs:15 — crates/polars-expr/src/dispatch/rolling.rs:15-36 | crates/polars-expr/src/dispatch/rolling_by.rs:11-33 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-expr/src/dispatch/datetime.rs:67 — crates/polars-expr/src/dispatch/datetime.rs:67-88 | crates/polars-expr/src/dispatch/datetime.rs:89-110 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-expr/src/dispatch/pow.rs:191 — crates/polars-expr/src/dispatch/pow.rs:191-212 | crates/polars-expr/src/dispatch/pow.rs:223-244 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-io/src/ipc/ipc_stream.rs:267 — crates/polars-io/src/ipc/ipc_stream.rs:267-288 | crates/polars-io/src/ipc/write.rs:157-183 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-expr/src/dispatch/trigonometry.rs:10 — crates/polars-expr/src/dispatch/trigonometry.rs:10-32 | crates/polars-expr/src/dispatch/trigonometry.rs:52-73 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-core/src/chunked_array/ops/aggregate/mod.rs:140 — crates/polars-core/src/chunked_array/ops/aggregate/mod.rs:140-161 | crates/polars-core/src/chunked_array/ops/aggregate/mod.rs:163-193 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-io/src/utils/other.rs:97 — crates/polars-io/src/utils/other.rs:97-119 | crates/polars-io/src/utils/other.rs:124-145 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-core/src/chunked_array/ops/fill_null.rs:302 — crates/polars-core/src/chunked_array/ops/fill_null.rs:302-323 | crates/polars-core/src/chunked_array/ops/fill_null.rs:325-351 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) py-polars/src/polars/lazyframe/engine_remote.py:259 — py-polars/src/polars/lazyframe/engine_remote.py:259-280 | py-polars/src/polars/lazyframe/engine_remote.py:348-378 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/binview/optional.rs:16 — crates/polars-parquet/src/arrow/read/deserialize/binview/optional.rs:16-37 | crates/polars-parquet/src/arrow/read/deserialize/binview/required_masked.rs:17-39 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) crates/polars-python/src/catalog/unity.rs:435 — crates/polars-python/src/catalog/unity.rs:435-458 | crates/polars-python/src/catalog/unity.rs:472-493 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D2 · Cognitive Complexity · polars_sql · ×12
  • polars_sql::subquery_pull_up::try_move (cognitive 79) crates/polars-sql/src/subquery_pull_up.rs:693 — polars_sql::subquery_pull_up::try_move has cognitive complexity 79 (threshold 15). Drivers by points: if/else 29 (44 pts), boolean chains 15, match/switch 9 (14 pts), loops 3 (6 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_sql::context::disambiguate_projection_cols (cognitive 52) REDACTED:181 — polars_sql::context::disambiguate_projection_cols has cognitive complexity 52 (threshold 15). Drivers by points: if/else 6 (29 pts), loops 5 (11 pts), match/switch 3 (11 pts), boolean chains 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_sql::subquery_pull_up::prepare (cognitive 38) crates/polars-sql/src/subquery_pull_up.rs:254 — polars_sql::subquery_pull_up::prepare has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 7 (14 pts), boolean chains 4, loops 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_sql::context::merge_source_columns (cognitive 29) REDACTED:8909 — polars_sql::context::merge_source_columns has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (8 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_sql::time_travel::extract_table_versions (cognitive 25) crates/polars-sql/src/time_travel.rs:82 — polars_sql::time_travel::extract_table_versions has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_sql::sql_expr::resolve_compound_identifier (cognitive 21) crates/polars-sql/src/sql_expr.rs:2492 — polars_sql::sql_expr::resolve_compound_identifier has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 6 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_sql::types::map_sql_dtype_to_polars (cognitive 20) crates/polars-sql/src/types.rs:71 — polars_sql::types::map_sql_dtype_to_polars has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 8 (16 pts), if/else 2 (4 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_sql::subquery::exists_aggregates (cognitive 19) crates/polars-sql/src/subquery.rs:3048 — polars_sql::subquery::exists_aggregates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 4 (5 pts), boolean chains 4, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • polars_sql::context::disambiguate_output_names (cognitive 18) REDACTED:262 — polars_sql::context::disambiguate_output_names has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_sql::grouping_sets::expand_grouping_sets (cognitive 18) crates/polars-sql/src/grouping_sets.rs:95 — polars_sql::grouping_sets::expand_grouping_sets has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (8 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_sql::join_keys::comparison_casts (cognitive 17) crates/polars-sql/src/join_keys.rs:129 — polars_sql::join_keys::comparison_casts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (13 pts), boolean chains 3, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_sql::sql_expr::cast_literal_series (cognitive 16) crates/polars-sql/src/sql_expr.rs:194 — polars_sql::sql_expr::cast_literal_series has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 2 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×12
  • Edited copy of a member (21 corresponding lines) crates/polars-expr/src/reduce/first_last.rs:454 — crates/polars-expr/src/reduce/first_last.rs:454-474 | crates/polars-expr/src/reduce/first_last_nonnull.rs:446-466 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:40 — crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:40-60 | crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:47-73 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-compute/src/rolling/no_nulls/rank.rs:64 — crates/polars-compute/src/rolling/no_nulls/rank.rs:64-84 | crates/polars-compute/src/rolling/nulls/rank.rs:59-83 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-expr/src/dispatch/strings.rs:368 — crates/polars-expr/src/dispatch/strings.rs:368-388 | crates/polars-expr/src/dispatch/strings.rs:390-410 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-plan/src/plans/parquet_footers.rs:217 — crates/polars-plan/src/plans/parquet_footers.rs:217-238 | crates/polars-plan/src/plans/parquet_footers.rs:245-265 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-expr/src/expressions/apply.rs:90 — crates/polars-expr/src/expressions/apply.rs:90-110 | crates/polars-expr/src/expressions/structeval.rs:193-213 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-io/src/csv/write/writer.rs:46 — crates/polars-io/src/csv/write/writer.rs:46-66 | crates/polars-io/src/csv/write/writer.rs:201-228 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-core/src/series/arrow_export/categorical.rs:281 — crates/polars-core/src/series/arrow_export/categorical.rs:281-302 | crates/polars-dtype/src/categorical/mapping.rs:154-174 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-python/src/interop/numpy/to_numpy_df.rs:248 — crates/polars-python/src/interop/numpy/to_numpy_df.rs:248-272 | crates/polars-python/src/interop/numpy/to_numpy_df.rs:274-294 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-core/src/series/builder.rs:80 — crates/polars-core/src/series/builder.rs:80-100 | crates/polars-core/src/series/builder.rs:132-157 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-python/src/functions/lazy.rs:357 — crates/polars-python/src/functions/lazy.rs:357-379 | crates/polars-python/src/functions/lazy.rs:386-406 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) crates/polars-parquet/src/parquet/encoding/bitpacked/decode.rs:60 — crates/polars-parquet/src/parquet/encoding/bitpacked/decode.rs:60-80 | crates/polars-parquet/src/parquet/encoding/bitpacked/decode.rs:83-105 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×12
  • Edited copy of a member (19 corresponding lines) crates/polars-expr/src/reduce/mod.rs:514 — crates/polars-expr/src/reduce/mod.rs:514-532 | crates/polars-expr/src/reduce/mod.rs:762-784 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-compute/src/moment.rs:175 — crates/polars-compute/src/moment.rs:175-193 | crates/polars-compute/src/moment.rs:251-271 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-stream/src/nodes/is_sorted.rs:220 — crates/polars-stream/src/nodes/is_sorted.rs:220-249 | crates/polars-stream/src/nodes/reduce.rs:191-209 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-expr/src/reduce/first_last_nonnull.rs:18 — crates/polars-expr/src/reduce/first_last_nonnull.rs:18-42 | crates/polars-expr/src/reduce/implode.rs:16-34 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-core/src/chunked_array/ops/float_sorted_arg_max.rs:11 — crates/polars-core/src/chunked_array/ops/float_sorted_arg_max.rs:11-29 | crates/polars-core/src/chunked_array/ops/float_sorted_arg_max.rs:31-50 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-core/src/chunked_array/random.rs:83 — crates/polars-core/src/chunked_array/random.rs:83-104 | crates/polars-core/src/chunked_array/random.rs:140-158 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-ops/src/chunked_array/strings/extract.rs:99 — crates/polars-ops/src/chunked_array/strings/extract.rs:99-117 | crates/polars-ops/src/chunked_array/strings/extract.rs:123-143 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-core/src/chunked_array/ops/chunkops.rs:200 — crates/polars-core/src/chunked_array/ops/chunkops.rs:200-218 | crates/polars-core/src/series/series_trait.rs:323-341 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-parquet/src/parquet/write/file.rs:319 — crates/polars-parquet/src/parquet/write/file.rs:319-337 | crates/polars-parquet/src/parquet/write/stream.rs:114-132 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-stream/src/nodes/rle.rs:54 — crates/polars-stream/src/nodes/rle.rs:54-72 | crates/polars-stream/src/nodes/rolling_fixed_window.rs:150-168 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-stream/src/nodes/sort/flush.rs:197 — crates/polars-stream/src/nodes/sort/flush.rs:197-215 | crates/polars-stream/src/nodes/window/flush.rs:176-200 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) crates/polars-core/src/chunked_array/object/iterator.rs:29 — crates/polars-core/src/chunked_array/object/iterator.rs:29-47 | crates/polars-core/src/chunked_array/object/iterator.rs:118-136 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D1 · Cyclomatic Complexity · polars_sql · ×11
  • polars_sql::subquery_pull_up::try_move (cyclomatic 58) crates/polars-sql/src/subquery_pull_up.rs:693 — polars_sql::subquery_pull_up::try_move has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_sql::types::map_sql_dtype_to_polars (cyclomatic 49) crates/polars-sql/src/types.rs:71 — polars_sql::types::map_sql_dtype_to_polars has cyclomatic complexity 49 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_sql::sql_expr::parse_extract_date_part (cyclomatic 46) crates/polars-sql/src/sql_expr.rs:2324 — polars_sql::sql_expr::parse_extract_date_part has cyclomatic complexity 46 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_sql::subquery_pull_up::prepare (cyclomatic 27) crates/polars-sql/src/subquery_pull_up.rs:254 — polars_sql::subquery_pull_up::prepare has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • polars_sql::catalog::hint_unsupported_part (cyclomatic 19) crates/polars-sql/src/catalog.rs:1159 — polars_sql::catalog::hint_unsupported_part has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_sql::join_keys::sql_join_key_pair (cyclomatic 19) crates/polars-sql/src/join_keys.rs:16 — polars_sql::join_keys::sql_join_key_pair has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_sql::sql_expr::resolve_compound_identifier (cyclomatic 19) crates/polars-sql/src/sql_expr.rs:2492 — polars_sql::sql_expr::resolve_compound_identifier has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_sql::subquery::exists_aggregates (cyclomatic 19) crates/polars-sql/src/subquery.rs:3048 — polars_sql::subquery::exists_aggregates has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_sql::context::merge_source_columns (cyclomatic 18) REDACTED:8909 — polars_sql::context::merge_source_columns has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_sql::catalog::partition_field (cyclomatic 17) crates/polars-sql/src/catalog.rs:971 — polars_sql::catalog::partition_field has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_sql::context::disambiguate_projection_cols (cyclomatic 17) REDACTED:181 — polars_sql::context::disambiguate_projection_cols has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: SQLContext::catalog_statement (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×11
  • Edited copy of a member (6 corresponding lines) crates/polars-core/src/frame/column/mod.rs:661 — crates/polars-core/src/frame/column/mod.rs:661-666 | crates/polars-core/src/frame/column/mod.rs:668-675 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/polars-compute/src/ewm/cov.rs:201 — crates/polars-compute/src/ewm/cov.rs:201-206 | crates/polars-compute/src/ewm/cov.rs:223-228 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/polars-utils/src/order_statistic_tree.rs:324 — crates/polars-utils/src/order_statistic_tree.rs:324-329 | crates/polars-utils/src/order_statistic_tree.rs:362-367 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/polars-core/src/frame/mod.rs:2085 — crates/polars-core/src/frame/mod.rs:2085-2090 | crates/polars-core/src/frame/mod.rs:2123-2128 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/polars-plan/src/plans/ir/unoptimized.rs:119 — crates/polars-plan/src/plans/ir/unoptimized.rs:119-124 | crates/polars-plan/src/plans/ir/unoptimized.rs:131-136 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/polars-io/src/configs.rs:4 — crates/polars-io/src/configs.rs:4-9 | crates/polars-stream/src/nodes/io_sources/shared/pipeline_budget.rs:86-92 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/polars-plan/src/plans/optimizer/join_order/cluster.rs:397 — crates/polars-plan/src/plans/optimizer/join_order/cluster.rs:397-402 | crates/polars-plan/src/plans/optimizer/join_predicate_fusion.rs:56-63 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/polars-expr/src/hot_groups/binview.rs:92 — crates/polars-expr/src/hot_groups/binview.rs:92-99 | crates/polars-expr/src/hot_groups/single_key.rs:53-58 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/polars-core/src/chunked_array/object/mod.rs:152 — crates/polars-arrow/src/array/binview/mod.rs:479-485 | crates/polars-core/src/chunked_array/object/mod.rs:152-157 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/polars-python/src/functions/business.rs:11 — crates/polars-python/src/functions/business.rs:11-16 | crates/polars-python/src/functions/range.rs:15-20 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/polars-core/src/frame/column/mod.rs:1574 — crates/polars-core/src/frame/column/mod.rs:1574-1579 | crates/polars-core/src/series/series_trait.rs:441-446 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×11
  • Duplicated block (20 lines × 2) crates/polars-compute/src/boolean.rs:49 — crates/polars-compute/src/boolean.rs:49-68 | crates/polars-compute/src/boolean.rs:116-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/boolean.rs:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) crates/polars-io/src/cloud/options.rs:664 — crates/polars-io/src/cloud/options.rs:664-683 | crates/polars-io/src/cloud/options.rs:734-753 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/cloud/options.rs:664` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) crates/polars-ops/src/chunked_array/list/sets.rs:188 — crates/polars-ops/src/chunked_array/list/sets.rs:188-207 | crates/polars-ops/src/chunked_array/list/sets.rs:283-302 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/sets.rs:188` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) crates/polars-ops/src/series/ops/horizontal.rs:132 — crates/polars-ops/src/series/ops/horizontal.rs:132-151 | crates/polars-ops/src/series/ops/horizontal.rs:158-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/horizontal.rs:132` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:911 — crates/polars-plan/src/dsl/function_expr/mod.rs:911-930 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:931-950 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) crates/polars-plan/src/dsl/function_expr/range.rs:123 — crates/polars-plan/src/dsl/function_expr/range.rs:123-142 | crates/polars-plan/src/plans/aexpr/function_expr/range.rs:202-221 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/range.rs:123` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `f` to `&mut fmt::Formatter<'_>` in one and `&mut Formatter<'_>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (20 lines × 2) crates/polars-plan/src/plans/optimizer/sortedness.rs:316 — crates/polars-plan/src/plans/optimizer/sortedness.rs:316-335 | crates/polars-plan/src/plans/optimizer/sortedness.rs:356-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/sortedness.rs:316` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/ipc/mod.rs:61 — crates/polars-stream/src/nodes/io_sinks/writers/ipc/mod.rs:61-80 | crates/polars-stream/src/nodes/io_sinks/writers/parquet/mod.rs:103-122 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sinks/writers/ipc/mod.rs:61` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) crates/polars-stream/src/physical_plan/lower_group_by.rs:822 — crates/polars-stream/src/physical_plan/lower_group_by.rs:822-841 | crates/polars-stream/src/physical_plan/lower_group_by.rs:871-890 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_group_by.rs:822` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) crates/polars-ops/src/chunked_array/array/sum_mean.rs:39 — crates/polars-ops/src/chunked_array/array/sum_mean.rs:39-58 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:49-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/array/sum_mean.rs:39` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-ops/src/chunked_array/list/sum_mean.rs:48` calls `offsets`, `as_slice` and `crates/polars-ops/src/chunked_array/array/sum_mean.rs:38` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (20 lines × 2) crates/polars-plan/src/dsl/function_expr/trigonometry.rs:25 — crates/polars-plan/src/dsl/function_expr/trigonometry.rs:25-44 | crates/polars-plan/src/plans/aexpr/function_expr/trigonometry.rs:24-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D1 · Cyclomatic Complexity · polars_core · ×10
  • polars_core::utils::supertype::get_supertype_with_options::inner (cyclomatic 179) crates/polars-core/src/utils/supertype.rs:154 — polars_core::utils::supertype::get_supertype_with_options::inner has cyclomatic complexity 179 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_core::utils::supertype::get_numeric_upcast_supertype_lossless (cyclomatic 32) crates/polars-core/src/utils/supertype.rs:29 — polars_core::utils::supertype::get_numeric_upcast_supertype_lossless has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_core::chunked_array::ops::append::update_sorted_flag_before_append (cyclomatic 25) crates/polars-core/src/chunked_array/ops/append.rs:38 — polars_core::chunked_array::ops::append::update_sorted_flag_before_append has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_core::fmt::iso_duration_string (cyclomatic 19) crates/polars-core/src/fmt.rs:1075 — polars_core::fmt::iso_duration_string has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AnyValue::fmt (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • polars_core::series::any_value::any_values_to_struct (cyclomatic 18) crates/polars-core/src/series/any_value.rs:978 — polars_core::series::any_value::any_values_to_struct has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Series::from_any_values_and_dtype_unnamed (cyclomatic 35) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • polars_core::chunked_array::ops::search_sorted::search_sorted_slice (cyclomatic 17) crates/polars-core/src/chunked_array/ops/search_sorted.rs:257 — polars_core::chunked_array::ops::search_sorted::search_sorted_slice has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_core::frame::column::scalar::estimated_repeated_size (cyclomatic 17) crates/polars-core/src/frame/column/scalar.rs:393 — polars_core::frame::column::scalar::estimated_repeated_size has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_core::series::any_value::any_values_to_string::any_values_to_string_nonstrict::_write_any_value (cyclomatic 17) crates/polars-core/src/series/any_value.rs:352 — polars_core::series::any_value::any_values_to_string::any_values_to_string_nonstrict::_write_any_value has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: Series::from_any_values_and_dtype_unnamed (cyclomatic 35) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • polars_core::chunked_array::ops::search_sorted::binary_search_ca (cyclomatic 16) crates/polars-core/src/chunked_array/ops/search_sorted.rs:139 — polars_core::chunked_array::ops::search_sorted::binary_search_ca has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_core::chunked_array::ops::sort::arg_sort::arg_sort (cyclomatic 16) crates/polars-core/src/chunked_array/ops/sort/arg_sort.rs:114 — polars_core::chunked_array::ops::sort::arg_sort::arg_sort has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×10
  • Edited copy of a member (24 corresponding lines) crates/polars-stream/src/nodes/group_by/flush.rs:138 — crates/polars-stream/src/nodes/group_by/flush.rs:138-162 | crates/polars-stream/src/nodes/joins/equi_join/flush.rs:253-276 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/polars-row/src/variable/no_order.rs:139 — crates/polars-row/src/variable/no_order.rs:139-162 | crates/polars-row/src/variable/utf8.rs:154-180 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:736 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:736-763 | crates/polars-core/src/series/arithmetic/list.rs:938-961 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/polars-core/src/chunked_array/ops/fill_null.rs:157 — crates/polars-core/src/chunked_array/ops/fill_null.rs:157-180 | crates/polars-core/src/chunked_array/ops/fill_null.rs:186-213 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) docs/source/src/rust/user-guide/concepts/lazy-vs-eager.rs:3 — docs/source/src/rust/user-guide/concepts/lazy-vs-eager.rs:3-26 | docs/source/src/rust/user-guide/concepts/streaming.rs:3-36 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/polars-lazy/src/frame/mod.rs:1077 — crates/polars-lazy/src/frame/mod.rs:1077-1100 | crates/polars-lazy/src/frame/mod.rs:1123-1146 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/polars-stream/src/nodes/io_sinks/writers/ipc/mod.rs:57 — crates/polars-stream/src/nodes/io_sinks/writers/ipc/mod.rs:57-80 | crates/polars-stream/src/nodes/io_sinks/writers/parquet/mod.rs:99-122 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/polars-compute/src/rolling/nulls/mean.rs:23 — crates/polars-compute/src/rolling/nulls/mean.rs:23-46 | crates/polars-compute/src/rolling/nulls/sum.rs:22-45 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/polars-io/src/catalog/unity/client.rs:121 — crates/polars-io/src/catalog/unity/client.rs:121-144 | crates/polars-io/src/catalog/unity/client.rs:168-193 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/polars-plan/src/dsl/functions/range.rs:43 — crates/polars-plan/src/dsl/functions/range.rs:43-66 | crates/polars-plan/src/dsl/functions/range.rs:76-99 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×10
  • Edited copy of a member (25 corresponding lines) crates/polars-row/src/encode.rs:243 — crates/polars-row/src/encode.rs:243-268 | crates/polars-row/src/encode.rs:276-300 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) crates/polars-plan/src/dsl/file_scan/field_selection.rs:193 — crates/polars-plan/src/dsl/file_scan/field_selection.rs:193-217 | crates/polars-plan/src/plans/optimizer/projection_pushdown/field_pruning.rs:1461-1487 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) crates/polars-compute/src/comparisons/array.rs:39 — crates/polars-compute/src/comparisons/array.rs:39-66 | crates/polars-compute/src/comparisons/array.rs:68-92 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) crates/polars-ops/src/series/ops/horizontal.rs:127 — crates/polars-ops/src/series/ops/horizontal.rs:127-151 | crates/polars-ops/src/series/ops/horizontal.rs:153-177 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:262 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:262-286 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:290-318 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) crates/polars-parquet/src/arrow/write/binary/basic.rs:120 — crates/polars-parquet/src/arrow/write/binary/basic.rs:120-146 | crates/polars-parquet/src/arrow/write/binview/basic.rs:117-141 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) crates/polars-expr/src/hash_keys.rs:502 — crates/polars-expr/src/hash_keys.rs:502-528 | crates/polars-expr/src/hash_keys.rs:543-567 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) crates/polars-plan/src/utils.rs:338 — crates/polars-plan/src/utils.rs:338-363 | crates/polars-plan/src/utils.rs:371-395 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) crates/polars-core/src/frame/mod.rs:1829 — crates/polars-core/src/frame/mod.rs:1829-1853 | crates/polars-core/src/frame/mod.rs:1899-1930 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) crates/polars-ops/src/chunked_array/list/namespace.rs:637 — crates/polars-ops/src/chunked_array/list/namespace.rs:637-661 | crates/polars-ops/src/chunked_array/list/namespace.rs:674-698 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×10
  • Duplicated block (8–9 lines × 2) crates/polars-core/src/chunked_array/ndarray.rs:271 — crates/polars-core/src/chunked_array/ndarray.rs:271-279 | crates/polars-core/src/chunked_array/ndarray.rs:307-314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/ndarray.rs:271` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–9 lines × 2) crates/polars-expr/src/hot_groups/binview.rs:149 — crates/polars-expr/src/hot_groups/binview.rs:149-156 | crates/polars-expr/src/hot_groups/binview.rs:162-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/hot_groups/binview.rs:149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-expr/src/hot_groups/binview.rs:158` calls `push_g`, `insert_null` and `crates/polars-expr/src/hot_groups/binview.rs:170` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8–9 lines × 2) crates/polars-io/src/json/mod.rs:148 — crates/polars-io/src/json/mod.rs:148-156 | crates/polars-io/src/json/mod.rs:193-200 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `df` to `&mut DataFrame` in one and `&DataFrame` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8–9 lines × 2) crates/polars-ops/src/frame/join/hash_join/single_keys_left.rs:160 — crates/polars-ops/src/frame/join/hash_join/single_keys_left.rs:160-168 | crates/polars-ops/src/frame/join/hash_join/single_keys_semi_anti.rs:67-74 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_left.rs:160` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–9 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:651 — crates/polars-parquet/src/arrow/write/mod.rs:651-658 | crates/polars-parquet/src/arrow/write/mod.rs:750-758 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:651` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–9 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:970 — crates/polars-parquet/src/arrow/write/mod.rs:970-978 | crates/polars-parquet/src/arrow/write/mod.rs:1031-1038 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:970` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–9 lines × 2) crates/polars-plan/src/plans/python/pyarrow.rs:286 — crates/polars-plan/src/plans/python/pyarrow.rs:286-293 | crates/polars-plan/src/plans/python/pyarrow.rs:666-674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/python/pyarrow.rs:286` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–9 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:1447 — crates/polars-stream/src/physical_plan/lower_expr.rs:1447-1454 | crates/polars-stream/src/physical_plan/lower_expr.rs:1494-1502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:1447` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–9 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:544 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:544-551 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:173-181 — before extracting anything, compare `crates/polars-core/src/frame/group_by/aggregations/mod.rs` and `crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:544` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–9 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:725 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:725-732 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:106-114 — before extracting anything, compare `crates/polars-core/src/frame/group_by/aggregations/mod.rs` and `crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:725` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D15 · Churn × Complexity Hotspots · Repeated repair · ×9
  • Repeated repair: crates/polars-expr/src/expressions/sortby.rs crates/polars-expr/src/expressions/sortby.rs:292 — crates/polars-expr/src/expressions/sortby.rs changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is SortByExpr::evaluate_on_groups_impl at line 292), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: Sort with limit in in-memory group-by (#30563)”; “fix: Allow empty groups in multi key sort_by (#29825)”; “fix: Broadcast scalar inputs in `min_by`/`max_by` and `sort_by` (#29808)”; “fix: Handle reordered groups in sort_by (#29639)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-expr/src/expressions/sortby.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/polars-ops/src/series/ops/log.rs crates/polars-ops/src/series/ops/log.rs:79 — crates/polars-ops/src/series/ops/log.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is LogSeries::log1p at line 79), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: Make `Expr.entropy` corner cases consistent across engines (#30699)”; “fix: Reject non-numeric input and preserve `Decimal` scale in `entropy` (#29228)”; “fix(rust): Return error for `log()` on non-numeric dtypes (#29193)”; “fix: Error instead of segfault for `exp`/`log1p` on non-numeric dtypes (#29112)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-ops/src/series/ops/log.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/polars-sql/src/group_context.rs crates/polars-sql/src/group_context.rs:125 — crates/polars-sql/src/group_context.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is GroupContextSplitter::needs_post_aggregation at line 125), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: Read SQL column names like "*" or "^a$" as names and respect WHERE without FROM (#30440)”; “fix: Apply SQL `SELECT *` options to the wildcard columns only (#29854)”; “fix: Support SQL `HAVING` without `GROUP BY` and check columns outside aggregates (#29833)”; “fix: Fix small bugs in SQL aggregates and in group contexts (#29754)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-sql/src/group_context.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/polars-core/src/frame/group_by/aggregations/dispatch.rs crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:369 — crates/polars-core/src/frame/group_by/aggregations/dispatch.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is Series::agg_mean at line 369), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: Allow repeated indices in a group in debug aggregation checks (#30771)”; “fix: Clear the sorted flag of aggregated literals with empty groups (#30461)”; “fix: Clear the sorted flag when first/min/max leave groups empty (#30427)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-core/src/frame/group_by/aggregations/dispatch.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/polars-python/src/interop/numpy/to_numpy_series.rs crates/polars-python/src/interop/numpy/to_numpy_series.rs:72 — crates/polars-python/src/interop/numpy/to_numpy_series.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is polars_python::interop::numpy::to_numpy_series::series_to_numpy_impl at line 72), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: Do not read the values stored under null `Array` rows (#30286)”; “fix: Raise error instead of panicking on out-of-range datetimes in `to_list` (#29918)”; “fix: Various map issues (#29147)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-python/src/interop/numpy/to_numpy_series.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/polars-plan/src/plans/aexpr/function_expr/cum.rs crates/polars-plan/src/plans/aexpr/function_expr/cum.rs:9 — crates/polars-plan/src/plans/aexpr/function_expr/cum.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is polars_plan::plans::aexpr::function_expr::cum::dtypes::cum_sum at line 9), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: Fix schema errors for `UInt128` cum ops and `Null` truediv (#30584)”; “fix: Keep Decimal results within their declared precision and round Decimal to float casts correctly (#29539)”; “Revert "perf: Coerce float literals to decimal instead of casting the column" (#29503)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/aexpr/function_expr/cum.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/polars-sql/src/grouping_sets.rs crates/polars-sql/src/grouping_sets.rs:243 — crates/polars-sql/src/grouping_sets.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is GroupingSets::aggregate at line 243), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: Read SQL column names like "*" or "^a$" as names and respect WHERE without FROM (#30440)”; “fix: Fix wrong results and name clashes for computed SQL `GROUP BY` keys (#29965)”; “fix: Fix wrong results in SQL REPLACE and ARRAY_AGG, join_where on decimals and sorted group-by keys (#29823)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-sql/src/grouping_sets.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/post_apply_extra_ops.rs crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/post_apply_extra_ops.rs:27 — crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/post_apply_extra_ops.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is PostApplyExtraOps::run at line 27), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: Fix slice returning too many rows when Iceberg position delete is past end of file (#30412)”; “fix: Make distributor linearizer capacity consistent (#29057)”; “fix: Reduce memory in multi_scan pipeline `PostApplyExtraOps` (#29049)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/post_apply_extra_ops.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/polars-parquet/src/parquet/write/statistics.rs crates/polars-parquet/src/parquet/write/statistics.rs:120 — crates/polars-parquet/src/parquet/write/statistics.rs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is polars_parquet::parquet::write::statistics::reduce at line 120), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: Correct unsigned parquet stats merging (#30199)”; “fix: Write valid Parquet statistics and column index for NaN and nested values (#29868)”; “fix: Decimal Parquet statistics for decimal/i128/f16 (#29350)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 22:53:10 +01:00' --until='2026-11-13 22:53:10 +01:00' --full-history --no-merges -- crates/polars-parquet/src/parquet/write/statistics.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D2 · Cognitive Complexity · ChunkedArray · ×9
  • ChunkedArray::rolling_map (cognitive 48) crates/polars-core/src/chunked_array/ops/rolling_window.rs:81 — ChunkedArray::rolling_map has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (38 pts), match/switch 1 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ChunkedArray::agg_arg_max (cognitive 38) crates/polars-core/src/frame/group_by/aggregations/mod.rs:758 — ChunkedArray::agg_arg_max has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 4 (9 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChunkedArray::agg_arg_min (cognitive 37) crates/polars-core/src/frame/group_by/aggregations/mod.rs:577 — ChunkedArray::agg_arg_min has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 4 (9 pts), loops 2 (6 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChunkedArray::agg_list (cognitive 29) crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:15 — ChunkedArray::agg_list has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (6 pts), match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ChunkedArray::explode_by_offsets (cognitive 24) crates/polars-core/src/chunked_array/ops/explode.rs:38 — ChunkedArray::explode_by_offsets has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChunkedArray::agg_sum (cognitive 20) crates/polars-core/src/frame/group_by/aggregations/mod.rs:866 — ChunkedArray::agg_sum has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 3 (7 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ChunkedArray::agg_max (cognitive 19) crates/polars-core/src/frame/group_by/aggregations/mod.rs:684 — ChunkedArray::agg_max has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 4 (9 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ChunkedArray::agg_min (cognitive 18) crates/polars-core/src/frame/group_by/aggregations/mod.rs:503 — ChunkedArray::agg_min has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 4 (9 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ChunkedArray::create_groups_from_sorted (cognitive 18) crates/polars-core/src/frame/group_by/into_groups.rs:67 — ChunkedArray::create_groups_from_sorted has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · polars_mem_engine · ×9
  • polars_mem_engine::planner::lp::create_physical_plan_impl (cognitive 41) crates/polars-mem-engine/src/planner/lp.rs:340 — polars_mem_engine::planner::lp::create_physical_plan_impl has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (29 pts), match/switch 3 (5 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_mem_engine::executors::group_by_streaming::can_run_partitioned (cognitive 37) crates/polars-mem-engine/src/executors/group_by_streaming.rs:175 — polars_mem_engine::executors::group_by_streaming::can_run_partitioned has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (34 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_mem_engine::executors::projection_utils::check_expand_literals (cognitive 37) crates/polars-mem-engine/src/executors/projection_utils.rs:291 — polars_mem_engine::executors::projection_utils::check_expand_literals has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (25 pts), match/switch 2 (7 pts), boolean chains 4, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_mem_engine::planner::lp::python_scan_predicate (cognitive 33) crates/polars-mem-engine/src/planner/lp.rs:182 — polars_mem_engine::planner::lp::python_scan_predicate has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 2 (9 pts), loops 1 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_mem_engine::scan_predicate::functions::create_scan_predicate (cognitive 29) crates/polars-mem-engine/src/scan_predicate/functions.rs:41 — polars_mem_engine::scan_predicate::functions::create_scan_predicate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_mem_engine::scan_predicate::functions::initialize_scan_predicate (cognitive 20) crates/polars-mem-engine/src/scan_predicate/functions.rs:357 — polars_mem_engine::scan_predicate::functions::initialize_scan_predicate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_mem_engine::executors::projection_utils::execute_projection_cached_window_fns (cognitive 19) crates/polars-mem-engine/src/executors/projection_utils.rs:125 — polars_mem_engine::executors::projection_utils::execute_projection_cached_window_fns has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_mem_engine::scan_predicate::table_statistics::normalize_bounds (cognitive 17) crates/polars-mem-engine/src/scan_predicate/table_statistics.rs:68 — polars_mem_engine::scan_predicate::table_statistics::normalize_bounds has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_mem_engine::scan_predicate::functions::filter_scan_ir (cognitive 16) crates/polars-mem-engine/src/scan_predicate/functions.rs:594 — polars_mem_engine::scan_predicate::functions::filter_scan_ir has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), match/switch 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×9
  • Edited copy of a member (5 corresponding lines) py-polars/src/polars/series/series.py:1123 — py-polars/src/polars/series/series.py:1123-1127 | py-polars/src/polars/series/series.py:1231-1238 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/polars-io-ext-ffi/src/common.rs:389 — crates/polars-io-ext-ffi/src/common.rs:389-393 | crates/polars-io-ext-ffi/src/common.rs:399-403 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/polars-compute/src/cast/binview_to.rs:76 — crates/polars-compute/src/cast/binview_to.rs:76-82 | crates/polars-compute/src/cast/binary_to.rs:119-123 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/polars-plan/src/plans/optimizer/join_predicate_fusion.rs:46 — crates/polars-plan/src/plans/optimizer/join_predicate_fusion.rs:46-53 | crates/polars-plan/src/plans/optimizer/join_utils.rs:26-30 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/polars-expr/src/reduce/first_last.rs:390 — crates/polars-expr/src/reduce/first_last.rs:390-394 | crates/polars-expr/src/reduce/first_last_nonnull.rs:356-360 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/polars-expr/src/dispatch/list.rs:382 — crates/polars-expr/src/dispatch/list.rs:382-386 | crates/polars-expr/src/dispatch/strings.rs:877-884 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/polars-expr/src/reduce/first_last_nonnull.rs:241 — crates/polars-expr/src/reduce/first_last_nonnull.rs:241-248 | crates/polars-expr/src/reduce/min_max.rs:355-359 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/polars-python/src/functions/aggregation.rs:37 — crates/polars-python/src/functions/aggregation.rs:37-41 | crates/polars-python/src/functions/lazy.rs:409-413 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) crates/polars-compute/src/rolling/moment.rs:261 — crates/polars-compute/src/rolling/moment.rs:261-265 | crates/polars-compute/src/rolling/sum.rs:124-128 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×9
  • Duplicated block (7–8 lines × 2) crates/polars-core/src/frame/row/av_buffer.rs:263 — crates/polars-core/src/frame/row/av_buffer.rs:263-269 | crates/polars-core/src/frame/row/av_buffer.rs:777-784 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/row/av_buffer.rs:263` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–8 lines × 2) crates/polars-expr/src/dispatch/groups_dispatch.rs:90 — crates/polars-expr/src/dispatch/groups_dispatch.rs:90-97 | crates/polars-expr/src/dispatch/groups_dispatch.rs:147-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/groups_dispatch.rs:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) crates/polars-expr/src/dispatch/strings.rs:369 — crates/polars-expr/src/dispatch/strings.rs:369-376 | crates/polars-expr/src/dispatch/strings.rs:391-397 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/strings.rs:369` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–8 lines × 2) crates/polars-expr/src/groups/single_key.rs:173 — crates/polars-expr/src/groups/single_key.rs:173-179 | crates/polars-expr/src/hot_groups/single_key.rs:66-73 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/groups/single_key.rs:173` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `keys` to `Vec<K>` in one and `Vec<T::Physical<'static>>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7–8 lines × 2) crates/polars-expr/src/planner.rs:607 — crates/polars-expr/src/planner.rs:607-613 | crates/polars-expr/src/planner.rs:640-647 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–8 lines × 2) crates/polars-plan/src/plans/python/pyarrow.rs:314 — crates/polars-plan/src/plans/python/pyarrow.rs:314-321 | crates/polars-plan/src/plans/python/pyarrow.rs:361-367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/python/pyarrow.rs:314` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7–8 lines × 2) REDACTED:8385 — REDACTED:8385-8392 | REDACTED:8560-8566 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:8385` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7–8 lines × 2) crates/polars-sql/src/group_context.rs:381 — crates/polars-sql/src/group_context.rs:381-387 | crates/polars-sql/src/group_context.rs:419-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-sql/src/group_context.rs:381` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) crates/polars-stream/src/physical_plan/lower_group_by.rs:1659 — crates/polars-stream/src/physical_plan/lower_group_by.rs:1659-1665 | crates/polars-stream/src/physical_plan/lower_group_by.rs:1681-1688 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_group_by.rs:1659` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-stream/src/physical_plan/lower_group_by.rs:1658` calls `to_vec` and `crates/polars-stream/src/physical_plan/lower_group_by.rs:1680` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D2 · Cognitive Complexity · polars_python · ×8
  • polars_python::lazyframe::visitor::expr_nodes::into_py (cognitive 115) crates/polars-python/src/lazyframe/visitor/expr_nodes.rs:860 — polars_python::lazyframe::visitor::expr_nodes::into_py has cognitive complexity 115 (threshold 15). Drivers by points: match/switch 38 (115 pts) (nesting depth added 77). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_python::io::iceberg_plugin::v1::convert::import_output (cognitive 47) crates/polars-python/src/io/iceberg_plugin/v1/convert.rs:60 — polars_python::io::iceberg_plugin::v1::convert::import_output has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 7 (15 pts), match/switch 2 (6 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_python::conversion::any_value::py_object_to_any_value::get_conversion_function (cognitive 40) crates/polars-python/src/conversion/any_value.rs:651 — polars_python::conversion::any_value::py_object_to_any_value::get_conversion_function has cognitive complexity 40 (threshold 15). Drivers by points: if/else 28 (39 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (polars_python::conversion::any_value::py_object_to_any_value::get_list) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_python::lazyframe::visitor::nodes::into_py (cognitive 30) crates/polars-python/src/lazyframe/visitor/nodes.rs:538 — polars_python::lazyframe::visitor::nodes::into_py has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 10 (22 pts), if/else 2 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 16). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_python::conversion::any_value::py_object_to_any_value::get_list (cognitive 20) crates/polars-python/src/conversion/any_value.rs:503 — polars_python::conversion::any_value::py_object_to_any_value::get_list has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (polars_python::conversion::any_value::py_object_to_any_value::get_conversion_function) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • polars_python::timeout::timeout_thread (cognitive 19) crates/polars-python/src/timeout.rs:60 — polars_python::timeout::timeout_thread has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_python::functions::lazy::lit (cognitive 17) crates/polars-python/src/functions/lazy.rs:473 — polars_python::functions::lazy::lit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • polars_python::series::scatter::scatter (cognitive 17) crates/polars-python/src/series/scatter.rs:32 — polars_python::series::scatter::scatter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, match/switch 4 (5 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×8
  • Edited copy of a member (27 corresponding lines) crates/polars-core/src/series/arithmetic/borrowed.rs:607 — crates/polars-core/src/series/arithmetic/borrowed.rs:607-637 | crates/polars-core/src/series/arithmetic/borrowed.rs:648-674 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) crates/polars-ops/src/series/ops/rolling.rs:44 — crates/polars-ops/src/series/ops/rolling.rs:44-70 | crates/polars-ops/src/series/ops/rolling.rs:114-143 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) crates/polars-core/src/frame/mod.rs:1159 — crates/polars-core/src/frame/mod.rs:1159-1188 | crates/polars-core/src/frame/mod.rs:1191-1217 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) crates/polars-stream/src/nodes/io_sources/multi_scan/components/projection/builder.rs:370 — crates/polars-stream/src/nodes/io_sources/multi_scan/components/projection/builder.rs:370-396 | crates/polars-stream/src/nodes/io_sources/multi_scan/components/projection/builder.rs:400-426 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) crates/polars-compute/src/unique/distinct.rs:383 — crates/polars-compute/src/unique/distinct.rs:383-415 | crates/polars-compute/src/unique/distinct.rs:444-470 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) crates/polars-plan/src/plans/builder_ir.rs:89 — crates/polars-plan/src/plans/builder_ir.rs:89-119 | crates/polars-plan/src/plans/builder_ir.rs:126-152 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) crates/polars-expr/src/hash_keys.rs:422 — crates/polars-expr/src/hash_keys.rs:422-448 | crates/polars-expr/src/hash_keys.rs:462-493 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) py-polars/src/polars/functions/lazy.py:2621 — py-polars/src/polars/functions/lazy.py:2621-2652 | py-polars/src/polars/functions/lazy.py:2670-2696 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×8
  • Edited copy of a member (23 corresponding lines) crates/polars-expr/src/reduce/first_last.rs:425 — crates/polars-expr/src/reduce/first_last.rs:425-447 | crates/polars-expr/src/reduce/first_last_nonnull.rs:410-439 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) crates/polars-expr/src/dispatch/misc.rs:1170 — crates/polars-expr/src/dispatch/misc.rs:1170-1193 | crates/polars-expr/src/dispatch/misc.rs:1199-1221 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) crates/polars-ops/src/series/ops/rolling.rs:19 — crates/polars-ops/src/series/ops/rolling.rs:19-41 | crates/polars-ops/src/series/ops/rolling.rs:83-111 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) crates/polars-compute/src/rolling/no_nulls/rank.rs:38 — crates/polars-compute/src/rolling/no_nulls/rank.rs:38-62 | crates/polars-compute/src/rolling/nulls/rank.rs:35-57 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) crates/polars-compute/src/moment.rs:298 — crates/polars-compute/src/moment.rs:298-320 | crates/polars-compute/src/moment.rs:436-462 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) crates/polars-plan/src/plans/options.rs:760 — crates/polars-plan/src/plans/options.rs:760-782 | crates/polars-plan/src/plans/options.rs:785-808 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) crates/polars-core/src/series/mod.rs:1005 — crates/polars-core/src/series/mod.rs:1005-1028 | crates/polars-core/src/series/mod.rs:1031-1053 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) REDACTED:8239 — REDACTED:8239-8261 | REDACTED:8289-8315 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×8
  • Edited copy of a member (20 corresponding lines) crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:18 — crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:18-37 | crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:102-121 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) crates/polars-expr/src/dispatch/boolean.rs:254 — crates/polars-expr/src/dispatch/boolean.rs:254-273 | crates/polars-expr/src/dispatch/boolean.rs:276-295 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:668 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:668-693 | crates/polars-core/src/series/arithmetic/fixed_size_list.rs:704-723 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) crates/polars-compute/src/comparisons/array.rs:94 — crates/polars-compute/src/comparisons/array.rs:94-113 | crates/polars-compute/src/comparisons/array.rs:115-134 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:167 — crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:167-186 | crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:231-258 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) crates/polars-python/src/lazyframe/general.rs:857 — crates/polars-python/src/lazyframe/general.rs:857-877 | crates/polars-python/src/lazyframe/general.rs:963-982 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) crates/polars-core/src/chunked_array/temporal/string/infer.rs:142 — crates/polars-core/src/chunked_array/temporal/string/infer.rs:142-164 | crates/polars-core/src/chunked_array/temporal/string/infer.rs:169-188 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) crates/polars-expr/src/expressions/window.rs:227 — crates/polars-expr/src/expressions/window.rs:227-256 | crates/polars-expr/src/expressions/window.rs:275-294 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×8
  • Duplicated block (10 lines × 3) crates/polars-core/src/chunked_array/cast.rs:606 — crates/polars-core/src/chunked_array/cast.rs:606-615 | crates/polars-core/src/chunked_array/cast.rs:634-643 | crates/polars-core/src/chunked_array/cast.rs:670-679 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `ca` to `&ListChunked` in one and `&ArrayChunked` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (10 lines × 3) crates/polars-core/src/frame/group_by/aggregations/mod.rs:895 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:895-904 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:988-997 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1053-1062 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:895` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) crates/polars-core/src/utils/supertype.rs:36 — crates/polars-core/src/utils/supertype.rs:36-46 | crates/polars-core/src/utils/supertype.rs:52-61 | crates/polars-core/src/utils/supertype.rs:67-76 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/utils/supertype.rs:36` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:428 — crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:428-437 | crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:447-456 | crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:469-478 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:428` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) crates/polars-plan/src/plans/aexpr/schema.rs:629 — crates/polars-plan/src/plans/aexpr/schema.rs:629-638 | crates/polars-plan/src/plans/aexpr/schema.rs:704-713 | crates/polars-plan/src/plans/aexpr/schema.rs:782-791 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/schema.rs:629` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) crates/polars-python/src/series/construction.rs:99 — crates/polars-python/src/series/construction.rs:99-108 | crates/polars-python/src/series/construction.rs:117-126 | crates/polars-python/src/series/construction.rs:135-144 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 3) crates/polars-buffer/src/buffer.rs:524 — crates/polars-arrow/src/array/iterator.rs:76-85 | crates/polars-arrow/src/bitmap/iterator.rs:544-553 | crates/polars-buffer/src/buffer.rs:524-533 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (10 lines × 3) crates/polars-python/src/dataset/dataset_provider_funcs.rs:129 — crates/polars-python/src/dataset/dataset_provider_funcs.rs:129-138 | crates/polars-python/src/dataset/dataset_provider_funcs.rs:139-148 | crates/polars-python/src/dataset/dataset_provider_funcs.rs:149-158 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-python/src/dataset/dataset_provider_funcs.rs:129` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×8
  • Duplicated block (9–10 lines × 2) crates/polars-core/src/chunked_array/ops/zip.rs:121 — crates/polars-core/src/chunked_array/ops/zip.rs:121-129 | crates/polars-core/src/chunked_array/ops/zip.rs:139-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/ops/zip.rs:121` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:20 — crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:20-29 | crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:92-100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) crates/polars-ops/src/chunked_array/strings/find_many.rs:179 — crates/polars-ops/src/chunked_array/strings/find_many.rs:179-187 | crates/polars-ops/src/chunked_array/strings/find_many.rs:279-288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/strings/find_many.rs:179` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) crates/polars-ops/src/series/ops/interpolation/interpolate.rs:84 — crates/polars-ops/src/series/ops/interpolation/interpolate.rs:84-92 | crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:140-149 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/interpolation/interpolate.rs:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:702 — crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:702-710 | crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:718-727 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:718` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) crates/polars-stream/src/nodes/backward_fill.rs:105 — crates/polars-stream/src/nodes/backward_fill.rs:105-113 | crates/polars-stream/src/nodes/interpolate.rs:117-126 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–10 lines × 2) crates/polars-stream/src/nodes/io_sources/external_python/mod.rs:380 — crates/polars-stream/src/nodes/io_sources/external_python/mod.rs:380-389 | crates/polars-stream/src/nodes/io_sources/external_python/mod.rs:424-432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/external_python/mod.rs:380` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) crates/polars-stream/src/nodes/io_sources/ipc/builder.rs:130 — crates/polars-stream/src/nodes/io_sources/ipc/builder.rs:130-138 | crates/polars-stream/src/nodes/io_sources/parquet/builder.rs:164-173 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/ipc/builder.rs:130` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×8
  • Duplicated block (6 lines × 3) crates/polars-core/src/utils/supertype.rs:293 — crates/polars-core/src/utils/supertype.rs:293-298 | crates/polars-core/src/utils/supertype.rs:309-314 | crates/polars-core/src/utils/supertype.rs:316-321 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-core/src/utils/supertype.rs:287` calls `is_unsigned_integer`, `is_bool`, `Some` and `crates/polars-core/src/utils/supertype.rs:307` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) crates/polars-expr/src/reduce/bitwise.rs:231 — crates/polars-expr/src/reduce/bitwise.rs:231-236 | crates/polars-expr/src/reduce/min_max.rs:510-515 | crates/polars-expr/src/reduce/min_max.rs:626-631 — before extracting anything, compare `crates/polars-expr/src/reduce/bitwise.rs` and `crates/polars-expr/src/reduce/min_max.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/bitwise.rs:231` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) crates/polars-plan/src/plans/aexpr/traverse.rs:32 — crates/polars-plan/src/plans/aexpr/traverse.rs:32-37 | crates/polars-plan/src/plans/aexpr/traverse.rs:125-130 | crates/polars-plan/src/plans/aexpr/traverse.rs:246-251 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/traverse.rs:32` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) crates/polars-stream/src/physical_plan/lower_expr.rs:1446 — crates/polars-stream/src/physical_plan/lower_expr.rs:1446-1451 | crates/polars-stream/src/physical_plan/lower_expr.rs:1493-1498 | crates/polars-stream/src/physical_plan/lower_expr.rs:1526-1531 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:1446` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:245 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:245-250 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:342-347 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:540-547 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:245` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) docs/source/src/rust/user-guide/concepts/lazy-vs-eager.rs:5 — docs/source/src/rust/user-guide/concepts/lazy-vs-eager.rs:5-10 | docs/source/src/rust/user-guide/concepts/lazy-vs-eager.rs:16-21 | docs/source/src/rust/user-guide/concepts/streaming.rs:5-10 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) crates/polars-core/src/frame/group_by/aggregations/mod.rs:517 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:517-522 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:698-703 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:952-957 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:517` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) py-polars/src/polars/series/series.py:1154 — py-polars/src/polars/series/series.py:1154-1159 | py-polars/src/polars/series/series.py:1212-1217 | py-polars/src/polars/series/series.py:1284-1289 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D2 · Cognitive Complexity · polars_expr · ×7
  • polars_expr::expressions::window::set_numeric (cognitive 27) crates/polars-expr/src/expressions/window.rs:1128 — polars_expr::expressions::window::set_numeric has cognitive complexity 27 (threshold 15). Drivers by points: loops 5 (16 pts), match/switch 4 (9 pts), if/else 2 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_expr::reduce::convert::into_reduction (cognitive 25) crates/polars-expr/src/reduce/convert.rs:46 — polars_expr::reduce::convert::into_reduction has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 6 (12 pts), if/else 6 (11 pts), boolean chains 2 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_expr::packed_keys::encode_column (cognitive 22) crates/polars-expr/src/packed_keys.rs:391 — polars_expr::packed_keys::encode_column has cognitive complexity 22 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 2 (5 pts), match/switch 3 (5 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_expr::dispatch::range::linear_space::linear_spaces_impl_broadcast (cognitive 17) crates/polars-expr/src/dispatch/range/linear_space.rs:207 — polars_expr::dispatch::range::linear_space::linear_spaces_impl_broadcast has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_expr::dispatch::strings::replace_n (cognitive 17) crates/polars-expr/src/dispatch/strings.rs:637 — polars_expr::dispatch::strings::replace_n has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_expr::expressions::group_idx_per_value (cognitive 17) crates/polars-expr/src/expressions/mod.rs:854 — polars_expr::expressions::group_idx_per_value has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (7 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_expr::expressions::count::evaluate_count_on_ac (cognitive 17) crates/polars-expr/src/expressions/count.rs:6 — polars_expr::expressions::count::evaluate_count_on_ac has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 4 (7 pts), boolean chains 2 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×7
  • Edited copies of one member (3 members, 13+ corresponding lines) crates/polars-ops/src/chunked_array/strings/strip.rs:5 — crates/polars-ops/src/chunked_array/strings/strip.rs:5-17 | crates/polars-ops/src/chunked_array/strings/strip.rs:19-31 | crates/polars-ops/src/chunked_array/strings/strip.rs:33-45 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) crates/polars-ops/src/chunked_array/repeat_by.rs:31 — crates/polars-ops/src/chunked_array/repeat_by.rs:31-47 | crates/polars-ops/src/chunked_array/repeat_by.rs:49-61 | crates/polars-ops/src/chunked_array/repeat_by.rs:63-75 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) crates/polars-compute/src/moment.rs:632 — crates/polars-compute/src/moment.rs:632-644 | crates/polars-compute/src/moment.rs:695-707 | crates/polars-compute/src/moment.rs:712-724 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) crates/polars-expr/src/reduce/bitwise.rs:12 — crates/polars-expr/src/reduce/bitwise.rs:12-24 | crates/polars-expr/src/reduce/bitwise.rs:26-38 | crates/polars-expr/src/reduce/bitwise.rs:40-52 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:577 — crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:577-590 | crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:724-736 | crates/polars-parquet/src/parquet/handwritten_thrift/file_metadata_thrift.rs:794-806 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) crates/polars-expr/src/dispatch/strings.rs:167 — crates/polars-expr/src/dispatch/strings.rs:167-179 | crates/polars-expr/src/dispatch/strings.rs:187-199 | crates/polars-expr/src/dispatch/strings.rs:207-219 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) crates/polars-plan/src/dsl/mod.rs:563 — crates/polars-plan/src/dsl/mod.rs:563-576 | crates/polars-plan/src/dsl/mod.rs:602-615 | crates/polars-plan/src/dsl/mod.rs:1795-1807 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×7
  • Edited copies of one member (3 members, 8+ corresponding lines) crates/polars-ops/src/series/ops/is_in/mod.rs:519 — crates/polars-ops/src/series/ops/is_in/mod.rs:519-526 | crates/polars-ops/src/series/ops/is_in/mod.rs:567-578 | crates/polars-ops/src/series/ops/is_in/mod.rs:584-595 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) crates/polars-expr/src/reduce/first_last.rs:588 — crates/polars-expr/src/reduce/first_last.rs:588-595 | crates/polars-expr/src/reduce/first_last.rs:603-610 | crates/polars-expr/src/reduce/first_last.rs:618-625 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) crates/polars-core/src/chunked_array/ops/arity.rs:553 — crates/polars-core/src/chunked_array/ops/arity.rs:553-560 | crates/polars-core/src/chunked_array/ops/arity.rs:618-626 | crates/polars-core/src/chunked_array/ops/arity.rs:637-645 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) crates/polars-io/src/csv/write/write_impl/serializer.rs:111 — crates/polars-io/src/csv/write/write_impl/serializer.rs:111-119 | crates/polars-io/src/csv/write/write_impl/serializer.rs:121-129 | crates/polars-io/src/csv/write/write_impl/serializer.rs:133-140 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) crates/polars-ops/src/chunked_array/strings/namespace.rs:716 — crates/polars-ops/src/chunked_array/strings/namespace.rs:716-723 | crates/polars-ops/src/chunked_array/strings/namespace.rs:725-732 | crates/polars-ops/src/chunked_array/strings/namespace.rs:734-741 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) crates/polars-core/src/frame/column/mod.rs:1611 — crates/polars-core/src/frame/column/mod.rs:1611-1618 | crates/polars-core/src/frame/column/mod.rs:1619-1626 | crates/polars-core/src/frame/column/mod.rs:1627-1634 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) crates/polars-compute/src/float_sum.rs:295 — crates/polars-compute/src/float_sum.rs:295-302 | crates/polars-compute/src/float_sum.rs:307-314 | crates/polars-compute/src/sum.rs:181-188 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×7
  • Duplicated block (8 lines × 3) crates/polars-core/src/frame/group_by/aggregations/mod.rs:560 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:560-567 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:741-748 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1015-1022 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:560` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) crates/polars-stream/src/physical_plan/to_graph.rs:1699 — crates/polars-stream/src/physical_plan/to_graph.rs:1699-1706 | crates/polars-stream/src/physical_plan/to_graph.rs:1735-1742 | crates/polars-stream/src/physical_plan/to_graph.rs:1768-1775 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/to_graph.rs:1699` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 3) docs/source/src/rust/user-guide/concepts/expressions.rs:80 — docs/source/src/rust/user-guide/concepts/expressions.rs:80-88 | docs/source/src/rust/user-guide/concepts/expressions.rs:93-101 | docs/source/src/rust/user-guide/getting-started.rs:110-117 — before extracting anything, compare `docs/source/src/rust/user-guide/concepts/expressions.rs` and `docs/source/src/rust/user-guide/getting-started.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/concepts/expressions.rs:80` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 3) docs/source/src/rust/user-guide/transformations/time-series/resampling.rs:8 — docs/source/src/rust/user-guide/transformations/time-series/resampling.rs:8-15 | docs/source/src/rust/user-guide/transformations/time-series/rolling.rs:46-53 | docs/source/src/rust/user-guide/transformations/time-series/rolling.rs:105-112 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/transformations/time-series/resampling.rs:8` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) crates/polars-ops/src/chunked_array/binary/namespace.rs:122 — crates/polars-ops/src/chunked_array/binary/namespace.rs:122-129 | crates/polars-ops/src/chunked_array/binary/namespace.rs:155-162 | crates/polars-ops/src/chunked_array/binary/namespace.rs:174-181 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/binary/namespace.rs:122` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) crates/polars-ops/src/chunked_array/list/namespace.rs:242 — crates/polars-ops/src/chunked_array/list/namespace.rs:242-249 | crates/polars-ops/src/chunked_array/list/namespace.rs:417-424 | crates/polars-ops/src/chunked_array/list/namespace.rs:491-498 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/namespace.rs:242` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 3) crates/polars-ops/src/series/ops/clip.rs:88 — crates/polars-ops/src/series/ops/clip.rs:88-95 | crates/polars-ops/src/series/ops/clip.rs:124-131 | crates/polars-time/src/offset_by.rs:47-54 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×7
  • Duplicated block (6 lines × 4) crates/polars-ops/src/chunked_array/array/dispersion.rs:20 — crates/polars-ops/src/chunked_array/array/dispersion.rs:20-25 | crates/polars-ops/src/chunked_array/array/dispersion.rs:55-60 | crates/polars-ops/src/chunked_array/array/dispersion.rs:90-95 | crates/polars-ops/src/chunked_array/list/dispersion.rs:67-72 — `crates/polars-ops/src/chunked_array/array/dispersion.rs` and `crates/polars-ops/src/chunked_array/list/dispersion.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 46 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/array/dispersion.rs:20` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) crates/polars-ops/src/chunked_array/gather/chunked.rs:539 — crates/polars-ops/src/chunked_array/gather/chunked.rs:539-544 | crates/polars-ops/src/chunked_array/gather/chunked.rs:582-587 | crates/polars-ops/src/chunked_array/gather/chunked.rs:749-754 | crates/polars-ops/src/chunked_array/gather/chunked.rs:800-805 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/gather/chunked.rs:539` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) crates/polars-parquet/src/arrow/write/binary/nested.rs:23 — crates/polars-parquet/src/arrow/write/binary/nested.rs:23-28 | crates/polars-parquet/src/arrow/write/binview/nested.rs:19-24 | crates/polars-parquet/src/arrow/write/boolean/nested.rs:18-23 | crates/polars-parquet/src/arrow/write/fixed_size_binary/nested.rs:18-23 — `crates/polars-parquet/src/arrow/write/binary/nested.rs` and `crates/polars-parquet/src/arrow/write/binview/nested.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 38 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 4) docs/source/src/rust/user-guide/concepts/data-types-and-structures.rs:27 — docs/source/src/rust/user-guide/concepts/data-types-and-structures.rs:27-32 | docs/source/src/rust/user-guide/concepts/expressions.rs:12-17 | docs/source/src/rust/user-guide/getting-started.rs:12-17 | docs/source/src/rust/user-guide/getting-started.rs:183-188 — before extracting anything, compare `docs/source/src/rust/user-guide/concepts/expressions.rs` and `docs/source/src/rust/user-guide/getting-started.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/concepts/data-types-and-structures.rs:27` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 4) crates/polars-expr/src/reduce/mod.rs:427 — crates/polars-expr/src/reduce/mod.rs:427-432 | crates/polars-expr/src/reduce/mod.rs:470-475 | crates/polars-expr/src/reduce/mod.rs:691-696 | crates/polars-expr/src/reduce/mod.rs:725-730 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 4) crates/polars-core/src/chunked_array/mod.rs:667 — crates/polars-core/src/chunked_array/mod.rs:667-672 | crates/polars-core/src/frame/column/mod.rs:548-553 | crates/polars-core/src/frame/dataframe.rs:219-224 | crates/polars-core/src/series/mod.rs:373-378 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (6 lines × 4) crates/polars-ops/src/chunked_array/array/namespace.rs:87 — crates/polars-ops/src/chunked_array/array/namespace.rs:87-92 | crates/polars-ops/src/chunked_array/array/namespace.rs:94-99 | crates/polars-ops/src/chunked_array/list/namespace.rs:215-220 | crates/polars-ops/src/chunked_array/list/namespace.rs:222-227 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D1 · Cyclomatic Complexity · polars_compute · ×6
  • polars_compute::cast::cast (cyclomatic 317) crates/polars-compute/src/cast/mod.rs:400 — polars_compute::cast::cast has cyclomatic complexity 317 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_compute::decimal::str_to_dec128 (cyclomatic 28) crates/polars-compute/src/decimal.rs:1072 — polars_compute::decimal::str_to_dec128 has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • polars_compute::cardinality::estimate_cardinality (cyclomatic 23) crates/polars-compute/src/cardinality.rs:15 — polars_compute::cardinality::estimate_cardinality has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_compute::decimal::divrem_256_128 (cyclomatic 21) crates/polars-compute/src/decimal.rs:382 — polars_compute::decimal::divrem_256_128 has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • polars_compute::horizontal_concat_list::horizontal_concat_list_unchecked (cyclomatic 17) crates/polars-compute/src/horizontal_concat_list/mod.rs:30 — polars_compute::horizontal_concat_list::horizontal_concat_list_unchecked has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_compute::rolling::create_validity (cyclomatic 16) crates/polars-compute/src/rolling/mod.rs:93 — polars_compute::rolling::create_validity has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · polars_row · ×6
  • polars_row::encode::get_encoder (cyclomatic 31) crates/polars-row/src/encode.rs:303 — polars_row::encode::get_encoder has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_row::encode::encode_flat_array (cyclomatic 29) crates/polars-row/src/encode.rs:663 — polars_row::encode::encode_flat_array has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_row::encode::fixed_size (cyclomatic 27) crates/polars-row/src/encode.rs:994 — polars_row::encode::fixed_size has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_row::decode::decode (cyclomatic 24) crates/polars-row/src/decode.rs:255 — polars_row::decode::decode has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_row::decode::dtype_and_data_to_encoded_item_len (cyclomatic 23) crates/polars-row/src/decode.rs:112 — polars_row::decode::dtype_and_data_to_encoded_item_len has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_row::encode::encode_array (cyclomatic 19) crates/polars-row/src/encode.rs:800 — polars_row::encode::encode_array has cyclomatic complexity 19 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · SQLExprVisitor · ×6
  • SQLExprVisitor::visit_binary_op (cognitive 40) crates/polars-sql/src/sql_expr.rs:1123 — SQLExprVisitor::visit_binary_op has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 10 (17 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLExprVisitor::visit_like (cognitive 38) crates/polars-sql/src/sql_expr.rs:839 — SQLExprVisitor::visit_like has cognitive complexity 38 (threshold 15). Drivers by points: if/else 24 (34 pts), boolean chains 3, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLExprVisitor::visit_expr (cognitive 31) crates/polars-sql/src/sql_expr.rs:505 — SQLExprVisitor::visit_expr has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 5 (9 pts), boolean chains 2 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SQLExprVisitor::visit_case_when_then (cognitive 20) crates/polars-sql/src/sql_expr.rs:2084 — SQLExprVisitor::visit_case_when_then has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (5 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SQLExprVisitor::array_expr_to_series (cognitive 19) crates/polars-sql/src/sql_expr.rs:447 — SQLExprVisitor::array_expr_to_series has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 5 (17 pts), if/else 1, loops 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SQLExprVisitor::visit_any_subquery (cognitive 17) crates/polars-sql/src/sql_expr.rs:1534 — SQLExprVisitor::visit_any_subquery has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×6
  • Edited copy of a member (26 corresponding lines) crates/polars-expr/src/groups/binview.rs:219 — crates/polars-expr/src/groups/binview.rs:219-251 | crates/polars-expr/src/groups/binview.rs:262-292 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) crates/polars-expr/src/dispatch/pow.rs:42 — crates/polars-expr/src/dispatch/pow.rs:42-70 | crates/polars-expr/src/dispatch/pow.rs:81-106 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) crates/polars-expr/src/expressions/group_iter.rs:94 — crates/polars-expr/src/expressions/group_iter.rs:94-119 | crates/polars-expr/src/expressions/group_iter.rs:124-149 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) crates/polars-compute/src/unique/distinct.rs:350 — crates/polars-compute/src/unique/distinct.rs:350-375 | crates/polars-compute/src/unique/distinct.rs:417-442 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) py-polars/src/polars/io/iceberg/_utils.py:739 — py-polars/src/polars/io/iceberg/_utils.py:739-764 | py-polars/src/polars/io/iceberg/_utils.py:771-805 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) crates/polars-io/src/csv/read/builder.rs:139 — crates/polars-io/src/csv/read/builder.rs:139-164 | crates/polars-io/src/csv/read/builder.rs:406-432 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×6
  • Edited copy of a member (35 corresponding lines) crates/polars-core/src/chunked_array/ops/arity.rs:858 — crates/polars-core/src/chunked_array/ops/arity.rs:858-892 | crates/polars-core/src/chunked_array/ops/arity.rs:908-942 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) crates/polars-stream/src/nodes/top_k.rs:393 — crates/polars-stream/src/nodes/top_k.rs:393-427 | crates/polars-stream/src/nodes/top_k.rs:533-575 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) crates/polars-ops/src/chunked_array/gather/chunked.rs:849 — crates/polars-ops/src/chunked_array/gather/chunked.rs:849-883 | crates/polars-ops/src/chunked_array/gather/chunked.rs:890-933 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/mod.rs:155 — crates/polars-parquet/src/arrow/read/deserialize/mod.rs:155-189 | crates/polars-parquet/src/arrow/write/mod.rs:1135-1183 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) crates/polars-io/src/cloud/concurrency/admission.rs:91 — crates/polars-io/src/cloud/concurrency/admission.rs:91-139 | crates/polars-io/src/cloud/concurrency/admission.rs:327-361 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) crates/polars-ops/src/chunked_array/strings/substring.rs:18 — crates/polars-ops/src/chunked_array/strings/substring.rs:18-52 | crates/polars-ops/src/chunked_array/strings/substring.rs:70-106 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×6
  • Edited copy of a member (29 corresponding lines) crates/polars-compute/src/unique/distinct.rs:688 — crates/polars-compute/src/unique/distinct.rs:688-720 | crates/polars-compute/src/unique/distinct.rs:722-750 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) crates/polars-plan/src/plans/lit.rs:252 — crates/polars-plan/src/plans/lit.rs:252-280 | crates/polars-plan/src/plans/lit.rs:282-310 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) crates/polars-compute/src/moment.rs:368 — crates/polars-compute/src/moment.rs:368-396 | crates/polars-compute/src/moment.rs:517-555 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) crates/polars-plan/src/plans/optimizer/recursive_caches.rs:94 — crates/polars-plan/src/plans/optimizer/recursive_caches.rs:94-122 | crates/polars-stream/src/physical_plan/lower_ir.rs:2311-2342 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) crates/polars-stream/src/execution_order.rs:39 — crates/polars-stream/src/execution_order.rs:39-73 | crates/polars-stream/src/execution_order.rs:81-109 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) crates/polars-plan/src/dsl/function_expr/rolling.rs:29 — crates/polars-plan/src/dsl/function_expr/rolling.rs:29-57 | crates/polars-plan/src/plans/aexpr/function_expr/rolling.rs:28-56 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×6
  • Edited copy of a member (30 corresponding lines) crates/polars-core/src/utils/mod.rs:929 — crates/polars-core/src/utils/mod.rs:929-974 | crates/polars-core/src/utils/mod.rs:985-1014 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) crates/polars-utils/src/cache.rs:157 — crates/polars-utils/src/cache.rs:157-186 | crates/polars-utils/src/cache.rs:206-237 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) crates/polars-row/src/variable/no_order.rs:228 — crates/polars-row/src/variable/no_order.rs:228-257 | crates/polars-row/src/variable/utf8.rs:276-306 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) crates/polars-plan/src/plans/to_description.rs:29 — crates/polars-plan/src/plans/to_description.rs:29-60 | crates/polars-stream/src/physical_plan/to_description.rs:36-65 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) crates/polars-parquet/src/parquet/statistics/boolean.rs:14 — crates/polars-parquet/src/parquet/statistics/boolean.rs:14-44 | crates/polars-parquet/src/parquet/statistics/fixed_len_binary.rs:20-49 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) py-polars/src/polars/dataframe/frame.py:1016 — py-polars/src/polars/dataframe/frame.py:1016-1045 | py-polars/src/polars/series/series.py:1482-1521 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×6
  • Duplicated block (23 lines × 2) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:405 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:405-427 | crates/polars-core/src/series/arithmetic/list.rs:419-441 — before extracting anything, compare `crates/polars-core/src/series/arithmetic/fixed_size_list.rs` and `crates/polars-core/src/series/arithmetic/list.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/fixed_size_list.rs:405` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) crates/polars-expr/src/dispatch/range/linear_space.rs:137 — crates/polars-expr/src/dispatch/range/linear_space.rs:137-159 | crates/polars-expr/src/dispatch/range/linear_space.rs:175-197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/range/linear_space.rs:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs:137 — crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs:137-159 | crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required_masked_dense.rs:109-131 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs:137` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:980 — crates/polars-stream/src/physical_plan/lower_expr.rs:980-1002 | crates/polars-stream/src/physical_plan/lower_expr.rs:1076-1098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:980` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (23 lines × 2) crates/polars-ops/src/chunked_array/list/sets.rs:148 — crates/polars-ops/src/chunked_array/list/sets.rs:148-170 | crates/polars-ops/src/chunked_array/list/sets.rs:251-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/sets.rs:148` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) py-polars/src/polars/dataframe/frame.py:5156 — py-polars/src/polars/dataframe/frame.py:5156-5178 | py-polars/src/polars/lazyframe/frame.py:3029-3051 — `py-polars/src/polars/dataframe/frame.py` and `py-polars/src/polars/lazyframe/frame.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 332 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×6
  • Duplicated block (22 lines × 2) crates/polars-expr/src/dispatch/groups_dispatch.rs:195 — crates/polars-expr/src/dispatch/groups_dispatch.rs:195-216 | crates/polars-expr/src/dispatch/groups_dispatch.rs:230-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) crates/polars-expr/src/idx_table/binview.rs:88 — crates/polars-expr/src/idx_table/binview.rs:88-109 | crates/polars-expr/src/idx_table/single_key.rs:138-159 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/idx_table/binview.rs:88` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:653 — crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:653-674 | crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:841-862 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:653` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) crates/polars-parquet/src/parquet/write/row_group.rs:123 — crates/polars-parquet/src/parquet/write/row_group.rs:123-144 | crates/polars-parquet/src/parquet/write/row_group.rs:189-210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/parquet/write/row_group.rs:123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) crates/polars-plan/src/dsl/function_expr/binary.rs:35 — crates/polars-plan/src/dsl/function_expr/binary.rs:35-56 | crates/polars-plan/src/plans/aexpr/function_expr/binary.rs:65-86 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/binary.rs:35` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) crates/polars-plan/src/plans/aexpr/schema.rs:681 — crates/polars-plan/src/plans/aexpr/schema.rs:681-702 | crates/polars-plan/src/plans/aexpr/schema.rs:746-767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/schema.rs:681` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×6
  • Duplicated block (19 lines × 2) crates/polars-core/src/datatypes/_serde.rs:112 — crates/polars-core/src/datatypes/_serde.rs:112-130 | crates/polars-core/src/datatypes/_serde.rs:176-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/datatypes/_serde.rs:112` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `dt` to `&DataType` in one and `SerializableDataType` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (19 lines × 2) crates/polars-io/src/csv/read/streaming.rs:807 — crates/polars-io/src/csv/read/streaming.rs:807-825 | crates/polars-io/src/csv/read/streaming.rs:838-856 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/streaming.rs:807` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:145 — crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:145-163 | crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:173-191 — before extracting anything, compare `crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs` and `crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (19 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:778 — crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:778-796 | crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:881-899 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:778` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) crates/polars-plan/src/plans/conversion/dsl_to_ir/join.rs:241 — crates/polars-plan/src/plans/conversion/dsl_to_ir/join.rs:241-259 | crates/polars-plan/src/plans/conversion/dsl_to_ir/join.rs:261-279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/dsl_to_ir/join.rs:241` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) crates/polars-ops/src/chunked_array/array/dispersion.rs:82 — crates/polars-ops/src/chunked_array/array/dispersion.rs:82-100 | crates/polars-ops/src/chunked_array/list/dispersion.rs:59-77 — `crates/polars-ops/src/chunked_array/array/dispersion.rs` and `crates/polars-ops/src/chunked_array/list/dispersion.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 46 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/array/dispersion.rs:82` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×6
  • Duplicated block (14–15 lines × 2) crates/polars-expr/src/dispatch/misc.rs:1171 — crates/polars-expr/src/dispatch/misc.rs:1171-1185 | crates/polars-expr/src/dispatch/misc.rs:1200-1213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) crates/polars-expr/src/expressions/window.rs:1201 — crates/polars-expr/src/expressions/window.rs:1201-1214 | crates/polars-expr/src/expressions/window.rs:1230-1244 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/window.rs:1201` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) crates/polars-ops/src/frame/join/dispatch_left_right.rs:102 — crates/polars-ops/src/frame/join/dispatch_left_right.rs:102-115 | crates/polars-ops/src/frame/join/dispatch_left_right.rs:132-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/dispatch_left_right.rs:132` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs:193 — crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs:193-206 | crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required_masked_dense.rs:158-172 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs:193` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required_masked_dense.rs:155` calls `set_len` and `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs:191` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14–15 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/csv/morsel_serializer.rs:31 — crates/polars-stream/src/nodes/io_sinks/writers/csv/morsel_serializer.rs:31-45 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/morsel_serializer.rs:32-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sinks/writers/csv/morsel_serializer.rs:31` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-stream/src/nodes/io_sinks/writers/csv/morsel_serializer.rs:46` calls `clone` and `crates/polars-stream/src/nodes/io_sinks/writers/ndjson/morsel_serializer.rs:46` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14–15 lines × 2) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:267 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:267-281 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:297-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:267` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×6
  • Duplicated block (13 lines × 3) crates/polars-parquet/src/arrow/write/pages.rs:185 — crates/polars-parquet/src/arrow/write/pages.rs:185-197 | crates/polars-parquet/src/arrow/write/pages.rs:209-221 | crates/polars-parquet/src/arrow/write/pages.rs:232-244 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 3) crates/polars-row/src/encode.rs:385 — crates/polars-row/src/encode.rs:385-397 | crates/polars-row/src/encode.rs:401-413 | crates/polars-row/src/encode.rs:417-429 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-row/src/encode.rs:385` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 3) crates/polars-stream/src/nodes/dynamic_group_by.rs:399 — crates/polars-stream/src/nodes/dynamic_group_by.rs:399-413 | crates/polars-stream/src/nodes/rolling_group_by.rs:319-331 | crates/polars-stream/src/nodes/sorted_group_by.rs:206-219 — before extracting anything, compare `crates/polars-stream/src/nodes/dynamic_group_by.rs` and `crates/polars-stream/src/nodes/rolling_group_by.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/dynamic_group_by.rs:399` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 3) crates/polars-stream/src/nodes/io_sources/csv/builder.rs:129 — crates/polars-stream/src/nodes/io_sources/csv/builder.rs:129-141 | crates/polars-stream/src/nodes/io_sources/lines.rs:127-139 | crates/polars-stream/src/nodes/io_sources/ndjson/builder.rs:126-138 — before extracting anything, compare `crates/polars-stream/src/nodes/io_sources/csv/builder.rs` and `crates/polars-stream/src/nodes/io_sources/lines.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/csv/builder.rs:129` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 3) crates/polars-ops/src/series/ops/replace.rs:35 — crates/polars-ops/src/series/ops/replace.rs:35-47 | crates/polars-ops/src/series/ops/replace.rs:80-97 | crates/polars-ops/src/series/ops/replace.rs:139-151 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/replace.rs:35` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 3) crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:244 — crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:244-256 | crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:272-284 | crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:344-356 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:244` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×6
  • Duplicated block (12 lines × 3) crates/polars-core/src/chunked_array/mod.rs:653 — crates/polars-core/src/chunked_array/mod.rs:653-664 | crates/polars-core/src/frame/column/mod.rs:534-545 | crates/polars-core/src/series/mod.rs:359-370 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 3) crates/polars-core/src/series/arithmetic/borrowed.rs:214 — crates/polars-core/src/series/arithmetic/borrowed.rs:214-225 | crates/polars-core/src/series/arithmetic/borrowed.rs:235-246 | crates/polars-core/src/series/arithmetic/borrowed.rs:256-267 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/borrowed.rs:214` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `lhs` to `&Float16Chunked` in one and `&Float32Chunked` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12 lines × 3) crates/polars-ops/src/chunked_array/array/sum_mean.rs:69 — crates/polars-ops/src/chunked_array/array/sum_mean.rs:69-80 | crates/polars-ops/src/chunked_array/array/sum_mean.rs:105-116 | crates/polars-ops/src/chunked_array/array/sum_mean.rs:126-137 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/array/sum_mean.rs:69` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) crates/polars-ops/src/chunked_array/scatter.rs:73 — crates/polars-ops/src/chunked_array/scatter.rs:73-84 | crates/polars-ops/src/chunked_array/scatter.rs:118-129 | crates/polars-ops/src/chunked_array/scatter.rs:170-181 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/scatter.rs:73` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) crates/polars-ops/src/series/ops/fused.rs:13 — crates/polars-ops/src/series/ops/fused.rs:13-24 | crates/polars-ops/src/series/ops/fused.rs:64-75 | crates/polars-ops/src/series/ops/fused.rs:114-125 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) crates/polars-io/src/csv/write/write_impl.rs:69 — crates/polars-io/src/csv/write/write_impl.rs:69-80 | crates/polars-io/src/csv/write/write_impl.rs:89-100 | crates/polars-io/src/csv/write/write_impl.rs:109-120 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/write/write_impl.rs:69` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×6
  • Duplicated block (11 lines × 3) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1281 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1281-1291 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1326-1336 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1371-1381 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:1281` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) crates/polars-ops/src/series/ops/clip.rs:68 — crates/polars-ops/src/series/ops/clip.rs:68-78 | crates/polars-ops/src/series/ops/clip.rs:104-114 | crates/polars-ops/src/series/ops/clip.rs:140-150 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/clip.rs:68` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) crates/polars-plan/src/plans/aexpr/traverse.rs:39 — crates/polars-plan/src/plans/aexpr/traverse.rs:39-49 | crates/polars-plan/src/plans/aexpr/traverse.rs:132-142 | crates/polars-plan/src/plans/aexpr/traverse.rs:253-263 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/traverse.rs:39` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 3) crates/polars-stream/src/physical_plan/lower_expr.rs:1432 — crates/polars-stream/src/physical_plan/lower_expr.rs:1432-1442 | crates/polars-stream/src/physical_plan/lower_expr.rs:1456-1466 | crates/polars-stream/src/physical_plan/lower_expr.rs:1507-1517 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:1432` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 3) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:374 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:374-384 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:455-465 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:495-505 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:374` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) crates/polars-plan/src/plans/aexpr/schema.rs:663 — crates/polars-plan/src/plans/aexpr/schema.rs:663-673 | crates/polars-plan/src/plans/aexpr/schema.rs:733-743 | crates/polars-plan/src/plans/aexpr/schema.rs:931-941 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×6
  • Duplicated block (10–11 lines × 2) crates/polars-expr/src/dispatch/groups_dispatch.rs:114 — crates/polars-expr/src/dispatch/groups_dispatch.rs:114-123 | crates/polars-expr/src/dispatch/groups_dispatch.rs:166-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/groups_dispatch.rs:114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–11 lines × 2) crates/polars-expr/src/dispatch/groups_dispatch.rs:424 — crates/polars-expr/src/dispatch/groups_dispatch.rs:424-434 | crates/polars-expr/src/dispatch/groups_dispatch.rs:954-963 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/groups_dispatch.rs:424` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–11 lines × 2) crates/polars-ops/src/frame/join/asof/default.rs:37 — crates/polars-ops/src/frame/join/asof/default.rs:37-46 | crates/polars-ops/src/frame/join/asof/default.rs:54-64 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/asof/default.rs:37` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) crates/polars-ops/src/series/ops/cut.rs:14 — crates/polars-ops/src/series/ops/cut.rs:14-23 | crates/polars-ops/src/series/ops/cut.rs:77-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) crates/polars-ops/src/series/ops/interpolation/interpolate.rs:109 — crates/polars-ops/src/series/ops/interpolation/interpolate.rs:109-118 | crates/polars-ops/src/series/ops/interpolation/interpolate.rs:134-144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/interpolation/interpolate.rs:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) crates/polars-stream/src/physical_plan/lower_group_by.rs:419 — crates/polars-stream/src/physical_plan/lower_group_by.rs:419-428 | crates/polars-stream/src/physical_plan/lower_group_by.rs:541-551 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · polars_python · ×5
  • polars_python::lazyframe::visitor::expr_nodes::into_py (cyclomatic 421) crates/polars-python/src/lazyframe/visitor/expr_nodes.rs:860 — polars_python::lazyframe::visitor::expr_nodes::into_py has cyclomatic complexity 421 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_python::lazyframe::visitor::nodes::into_py (cyclomatic 50) crates/polars-python/src/lazyframe/visitor/nodes.rs:538 — polars_python::lazyframe::visitor::nodes::into_py has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_python::conversion::any_value::py_object_to_any_value::get_conversion_function (cyclomatic 27) crates/polars-python/src/conversion/any_value.rs:651 — polars_python::conversion::any_value::py_object_to_any_value::get_conversion_function has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: polars_python::conversion::any_value::any_value_into_py_object (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • polars_python::io::iceberg_plugin::v1::convert::import_output (cyclomatic 23) crates/polars-python/src/io/iceberg_plugin/v1/convert.rs:60 — polars_python::io::iceberg_plugin::v1::convert::import_output has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_python::io::delta_stats::has_min_max (cyclomatic 16) crates/polars-python/src/io/delta_stats.rs:185 — polars_python::io::delta_stats::has_min_max has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: polars_python::io::delta_stats::bound (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · polars_mem_engine · ×5
  • polars_mem_engine::planner::lp::create_physical_plan_impl (cyclomatic 44) crates/polars-mem-engine/src/planner/lp.rs:340 — polars_mem_engine::planner::lp::create_physical_plan_impl has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_mem_engine::executors::projection_utils::check_expand_literals (cyclomatic 20) crates/polars-mem-engine/src/executors/projection_utils.rs:291 — polars_mem_engine::executors::projection_utils::check_expand_literals has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_mem_engine::executors::group_by_streaming::can_run_partitioned (cyclomatic 18) crates/polars-mem-engine/src/executors/group_by_streaming.rs:175 — polars_mem_engine::executors::group_by_streaming::can_run_partitioned has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_mem_engine::scan_predicate::functions::create_scan_predicate (cyclomatic 18) crates/polars-mem-engine/src/scan_predicate/functions.rs:41 — polars_mem_engine::scan_predicate::functions::create_scan_predicate has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • polars_mem_engine::scan_predicate::functions::initialize_scan_predicate (cyclomatic 16) crates/polars-mem-engine/src/scan_predicate/functions.rs:357 — polars_mem_engine::scan_predicate::functions::initialize_scan_predicate has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · Series · ×5
  • Series::_try_from_arrow_unchecked_with_md (cognitive 22) crates/polars-core/src/series/from.rs:201 — Series::_try_from_arrow_unchecked_with_md has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 4 (7 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Series::shrink_type (cognitive 22) crates/polars-ops/src/series/ops/eager.rs:10 — Series::shrink_type has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Series::cast_with_options (cognitive 18) crates/polars-core/src/series/mod.rs:415 — Series::cast_with_options has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 4, boolean chains 3, loops 1 (2 pts) (nesting depth added 4). Of this number, 12 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Series::reshape_list (cognitive 17) crates/polars-core/src/series/ops/reshape.rs:235 — Series::reshape_list has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Series::from_any_values (cognitive 16) crates/polars-core/src/series/any_value.rs:46 — Series::from_any_values has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 7). Of this number, 11 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (37 corresponding lines) · ×5
  • Edited copy of a member (37 corresponding lines) crates/polars-compute/src/arithmetic/mod.rs:167 — crates/polars-compute/src/arithmetic/mod.rs:167-207 | crates/polars-compute/src/cast/primitive_to.rs:100-136 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) crates/polars-expr/src/dispatch/horizontal.rs:85 — crates/polars-expr/src/dispatch/horizontal.rs:85-130 | crates/polars-expr/src/dispatch/horizontal.rs:139-175 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:40 — crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:40-80 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/mod.rs:38-74 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) crates/polars-sql/src/group_context.rs:223 — crates/polars-sql/src/group_context.rs:223-264 | crates/polars-sql/src/group_context.rs:414-450 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) py-polars/src/polars/series/plotting.py:78 — py-polars/src/polars/series/plotting.py:78-115 | py-polars/src/polars/series/plotting.py:122-158 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×5
  • Edited copies of one member (3 members, 12+ corresponding lines) crates/polars-plan/src/dsl/scan_sources.rs:441 — crates/polars-plan/src/dsl/scan_sources.rs:441-461 | crates/polars-plan/src/dsl/scan_sources.rs:475-486 | crates/polars-plan/src/dsl/scan_sources.rs:506-522 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) crates/polars-ops/src/chunked_array/strings/pad.rs:64 — crates/polars-ops/src/chunked_array/strings/pad.rs:64-75 | crates/polars-ops/src/chunked_array/strings/pad.rs:81-92 | crates/polars-ops/src/chunked_array/strings/pad.rs:98-109 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) py-polars/src/polars/_utils/deprecation.py:65 — py-polars/src/polars/_utils/deprecation.py:65-77 | py-polars/src/polars/_utils/deprecation.py:86-111 | py-polars/src/polars/_utils/unstable.py:50-61 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) crates/polars-compute/src/arithmetic/mod.rs:40 — crates/polars-compute/src/arithmetic/mod.rs:40-51 | crates/polars-compute/src/arithmetic/mod.rs:52-63 | crates/polars-compute/src/arithmetic/mod.rs:65-76 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) crates/polars-expr/src/dispatch/boolean.rs:169 — crates/polars-expr/src/dispatch/boolean.rs:169-180 | crates/polars-expr/src/dispatch/business.rs:24-35 | crates/polars-expr/src/dispatch/business.rs:41-53 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×5
  • Duplicated block (26 lines × 2) crates/polars-core/src/chunked_array/comparison/mod.rs:905 — crates/polars-core/src/chunked_array/comparison/mod.rs:905-930 | crates/polars-core/src/chunked_array/comparison/mod.rs:932-957 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (26 lines × 2) crates/polars-core/src/frame/row/av_buffer.rs:170 — crates/polars-core/src/frame/row/av_buffer.rs:170-195 | crates/polars-core/src/frame/row/av_buffer.rs:675-700 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/row/av_buffer.rs:170` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) crates/polars-expr/src/reduce/convert.rs:238 — crates/polars-expr/src/reduce/convert.rs:238-263 | crates/polars-expr/src/reduce/convert.rs:271-296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/convert.rs:238` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (26 lines × 2) crates/polars-plan/src/dsl/function_expr/rolling.rs:32 — crates/polars-plan/src/dsl/function_expr/rolling.rs:32-57 | crates/polars-plan/src/plans/aexpr/function_expr/rolling.rs:31-56 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/rolling.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/rolling.rs` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/rolling.rs:32` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:793 — crates/polars-stream/src/nodes/joins/equi_join/mod.rs:793-818 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1207-1232 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join/mod.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 131 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×5
  • Duplicated block (25 lines × 2) crates/polars-expr/src/groups/binview.rs:220 — crates/polars-expr/src/groups/binview.rs:220-244 | crates/polars-expr/src/groups/binview.rs:263-287 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/groups/binview.rs:220` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) crates/polars-io/src/csv/read/schema_inference.rs:350 — crates/polars-io/src/csv/read/schema_inference.rs:350-374 | crates/polars-io/src/csv/read/schema_inference.rs:403-427 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/schema_inference.rs:350` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) crates/polars-parquet/src/arrow/write/binary/nested.rs:24 — crates/polars-parquet/src/arrow/write/binary/nested.rs:24-48 | crates/polars-parquet/src/arrow/write/binview/nested.rs:20-44 — `crates/polars-parquet/src/arrow/write/binary/nested.rs` and `crates/polars-parquet/src/arrow/write/binview/nested.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 38 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (25 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:732 — crates/polars-parquet/src/arrow/write/mod.rs:732-756 | crates/polars-parquet/src/arrow/write/mod.rs:952-976 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:732` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:1058 — crates/polars-plan/src/dsl/function_expr/mod.rs:1058-1082 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1079-1103 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×5
  • Duplicated block (24 lines × 2) crates/polars-io/src/csv/read/parser.rs:578 — crates/polars-io/src/csv/read/parser.rs:578-601 | crates/polars-io/src/csv/read/parser.rs:914-937 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/parser.rs:578` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) crates/polars-io/src/csv/read/streaming.rs:65 — crates/polars-io/src/csv/read/streaming.rs:65-88 | crates/polars-io/src/csv/read/streaming.rs:249-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/streaming.rs:65` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (24 lines × 2) crates/polars-parquet/src/arrow/write/binary/basic.rs:123 — crates/polars-parquet/src/arrow/write/binary/basic.rs:123-146 | crates/polars-parquet/src/arrow/write/binview/basic.rs:118-141 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/binary/basic.rs:123` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:634 — crates/polars-parquet/src/arrow/write/mod.rs:634-657 | crates/polars-parquet/src/arrow/write/mod.rs:1014-1037 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:634` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:830 — crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:830-853 | crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:870-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:830` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) crates/polars-compute/src/moment.rs:369 — crates/polars-compute/src/moment.rs:369-389 | crates/polars-compute/src/moment.rs:518-538 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/simple.rs:249 — crates/polars-parquet/src/arrow/read/deserialize/simple.rs:249-269 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:276-296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/simple.rs:249` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (21 lines × 2) crates/polars-plan/src/dsl/function_expr/strings.rs:145 — crates/polars-plan/src/dsl/function_expr/strings.rs:145-165 | crates/polars-plan/src/plans/aexpr/function_expr/strings.rs:333-353 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/strings.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/strings.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 97 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/strings.rs:145` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:324 — crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:324-344 | crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:365-385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:324` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) py-polars/src/polars/dataframe/frame.py:1025 — py-polars/src/polars/dataframe/frame.py:1025-1045 | py-polars/src/polars/series/series.py:1501-1521 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×5
  • Duplicated block (13–14 lines × 2) crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:112 — crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:112-124 | crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:593-606 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:112` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:172 — crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:172-185 | crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:201-213 — before extracting anything, compare `crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs` and `crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1162 — crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1162-1174 | crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1255-1268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1162` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1253` calls `try_get_supertype`, `temporal_range_output_type` and `crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1161` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13–14 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/csv/io_writer.rs:28 — crates/polars-stream/src/nodes/io_sinks/writers/csv/io_writer.rs:28-41 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/io_writer.rs:25-37 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sinks/writers/csv/io_writer.rs:28` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13–14 lines × 2) docs/source/src/rust/user-guide/transformations/time-series/rolling.rs:41 — docs/source/src/rust/user-guide/transformations/time-series/rolling.rs:41-53 | docs/source/src/rust/user-guide/transformations/time-series/rolling.rs:99-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/transformations/time-series/rolling.rs:41` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×5
  • Duplicated block (10–12 lines × 2) crates/polars-compute/src/propagate_nulls.rs:240 — crates/polars-compute/src/propagate_nulls.rs:240-251 | crates/polars-compute/src/trim_lists_to_normalized_offsets.rs:62-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/propagate_nulls.rs:240` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–12 lines × 2) crates/polars-io/src/cloud/options.rs:644 — crates/polars-io/src/cloud/options.rs:644-655 | crates/polars-io/src/cloud/options.rs:721-730 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/cloud/options.rs:644` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–12 lines × 2) crates/polars-plan/src/plans/conversion/type_check/mod.rs:21 — crates/polars-plan/src/plans/conversion/type_check/mod.rs:21-32 | crates/polars-plan/src/plans/conversion/type_check/mod.rs:34-43 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/type_check/mod.rs:21` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–12 lines × 2) crates/polars-stream/src/nodes/io_sources/ndjson/negative_slice_pass.rs:198 — crates/polars-stream/src/nodes/io_sources/ndjson/negative_slice_pass.rs:198-209 | crates/polars-stream/src/nodes/io_sources/ndjson/row_index_limit_pass.rs:57-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/ndjson/negative_slice_pass.rs:198` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–12 lines × 2) py-polars/src/polars/io/csv/functions.py:522 — py-polars/src/polars/io/csv/functions.py:522-531 | py-polars/src/polars/io/ipc/functions.py:192-203 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/io/ipc/functions.py:192` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×5
  • Duplicated block (9 lines × 3) crates/polars-expr/src/idx_table/binview.rs:240 — crates/polars-expr/src/idx_table/binview.rs:240-248 | crates/polars-expr/src/idx_table/row_encoded.rs:147-155 | crates/polars-expr/src/idx_table/row_encoded.rs:186-194 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/idx_table/binview.rs:240` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) crates/polars-mem-engine/src/executors/hconcat.rs:43 — crates/polars-mem-engine/src/executors/hconcat.rs:43-51 | crates/polars-mem-engine/src/executors/union.rs:93-101 | crates/polars-mem-engine/src/planner/lp.rs:116-124 — before extracting anything, compare `crates/polars-mem-engine/src/executors/hconcat.rs` and `crates/polars-mem-engine/src/executors/union.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-mem-engine/src/executors/hconcat.rs:43` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs:37 — crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs:37-45 | crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:53-61 | crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:54-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/binary/mod.rs:37` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) crates/polars-plan/src/plans/aexpr/filter_constraint.rs:902 — crates/polars-plan/src/plans/aexpr/filter_constraint.rs:902-910 | crates/polars-plan/src/plans/aexpr/filter_constraint.rs:1113-1121 | crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:2837-2845 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (9 lines × 3) crates/polars-stream/src/nodes/io_sources/csv/builder.rs:66 — crates/polars-stream/src/nodes/io_sources/csv/builder.rs:66-74 | crates/polars-stream/src/nodes/io_sources/lines.rs:54-62 | crates/polars-stream/src/nodes/io_sources/ndjson/builder.rs:61-69 — before extracting anything, compare `crates/polars-stream/src/nodes/io_sources/csv/builder.rs` and `crates/polars-stream/src/nodes/io_sources/lines.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/csv/builder.rs:66` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×5
  • Duplicated block (5 lines × 4) crates/polars-core/src/frame/group_by/aggregations/mod.rs:522 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:522-527 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:703-708 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:75-79 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:142-146 — before extracting anything, compare `crates/polars-core/src/frame/group_by/aggregations/mod.rs` and `crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:522` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) crates/polars-core/src/frame/group_by/aggregations/mod.rs:560 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:560-564 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:741-745 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1015-1019 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1088-1092 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:560` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) crates/polars-expr/src/dispatch/struct_.rs:44 — crates/polars-expr/src/dispatch/struct_.rs:44-48 | crates/polars-expr/src/dispatch/struct_.rs:70-74 | crates/polars-expr/src/dispatch/struct_.rs:87-91 | crates/polars-expr/src/dispatch/struct_.rs:104-108 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/struct_.rs:44` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) crates/polars-stream/src/physical_plan/to_graph.rs:218 — crates/polars-stream/src/physical_plan/to_graph.rs:218-222 | crates/polars-stream/src/physical_plan/to_graph.rs:870-874 | crates/polars-stream/src/physical_plan/to_graph.rs:1741-1746 | crates/polars-stream/src/physical_plan/to_graph.rs:1822-1826 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/to_graph.rs:218` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-stream/src/physical_plan/to_graph.rs:1819` calls `clone` and `crates/polars-stream/src/physical_plan/to_graph.rs:1738` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:88 — crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:88-92 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:191-195 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:317-321 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:412-416 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:88` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · polars_expr · ×4
  • polars_expr::dispatch::function_expr_to_udf (cyclomatic 144) crates/polars-expr/src/dispatch/mod.rs:147 — polars_expr::dispatch::function_expr_to_udf has cyclomatic complexity 144 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_expr::reduce::convert::into_reduction (cyclomatic 46) crates/polars-expr/src/reduce/convert.rs:46 — polars_expr::reduce::convert::into_reduction has cyclomatic complexity 46 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_expr::planner::create_physical_expr_inner (cyclomatic 32) crates/polars-expr/src/planner.rs:248 — polars_expr::planner::create_physical_expr_inner has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_expr::dispatch::misc::corr (cyclomatic 22) crates/polars-expr/src/dispatch/misc.rs:953 — polars_expr::dispatch::misc::corr has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 3 function items inside it that branch (covariance, pearson_corr, spearman_rank_corr). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · SQLExprVisitor · ×4
  • SQLExprVisitor::visit_binary_op (cyclomatic 70) crates/polars-sql/src/sql_expr.rs:1123 — SQLExprVisitor::visit_binary_op has cyclomatic complexity 70 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • SQLExprVisitor::visit_expr (cyclomatic 53) crates/polars-sql/src/sql_expr.rs:505 — SQLExprVisitor::visit_expr has cyclomatic complexity 53 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • SQLExprVisitor::visit_like (cyclomatic 19) crates/polars-sql/src/sql_expr.rs:839 — SQLExprVisitor::visit_like has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SQLExprVisitor::visit_any_subquery (cyclomatic 19) crates/polars-sql/src/sql_expr.rs:1534 — SQLExprVisitor::visit_any_subquery has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IR · ×4
  • IR::is_ir_equal_shallow (cyclomatic 67) crates/polars-plan/src/plans/ir/equality.rs:26 — IR::is_ir_equal_shallow has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • IR::hash_excluding_inputs (cyclomatic 34) crates/polars-plan/src/plans/ir/hash.rs:16 — IR::hash_excluding_inputs has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • IR::exprs_mut (cyclomatic 22) crates/polars-plan/src/plans/ir/inputs.rs:100 — IR::exprs_mut has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: IR::inputs (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • IR::exprs (cyclomatic 21) crates/polars-plan/src/plans/ir/inputs.rs:37 — IR::exprs has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: IR::inputs (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Series · ×4
  • Series::_try_from_arrow_unchecked_with_md (cyclomatic 50) crates/polars-core/src/series/from.rs:201 — Series::_try_from_arrow_unchecked_with_md has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Series::cast_with_options (cyclomatic 23) crates/polars-core/src/series/mod.rs:415 — Series::cast_with_options has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Series::shrink_type (cyclomatic 18) crates/polars-ops/src/series/ops/eager.rs:10 — Series::shrink_type has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Series::to_physical_repr (cyclomatic 16) crates/polars-core/src/series/mod.rs:794 — Series::to_physical_repr has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DataType · ×4
  • DataType::from_arrow (cyclomatic 43) crates/polars-core/src/datatypes/field.rs:185 — DataType::from_arrow has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • DataType::try_to_arrow (cyclomatic 40) crates/polars-core/src/datatypes/dtype.rs:1316 — DataType::try_to_arrow has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • DataType::fmt (cyclomatic 38) crates/polars-core/src/datatypes/dtype.rs:1648 — DataType::fmt has cyclomatic complexity 38 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • DataType::can_cast_to (cyclomatic 25) crates/polars-core/src/datatypes/dtype.rs:501 — DataType::can_cast_to has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: DataType::fmt (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D2 · Cognitive Complexity · DataFrame · ×4
  • DataFrame::to_ndarray (cognitive 93) crates/polars-core/src/chunked_array/ndarray.rs:100 — DataFrame::to_ndarray has cognitive complexity 93 (threshold 15). Drivers by points: loops 13 (64 pts), if/else 10 (26 pts), match/switch 3 (nesting depth added 67). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • DataFrame::fmt (cognitive 59) crates/polars-core/src/fmt.rs:596 — DataFrame::fmt has cognitive complexity 59 (threshold 15). Drivers by points: if/else 26 (36 pts), loops 7 (14 pts), boolean chains 5, match/switch 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DataFrame::sort_impl (cognitive 41) crates/polars-core/src/frame/mod.rs:1443 — DataFrame::sort_impl has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (32 pts), boolean chains 5, loops 2 (3 pts), match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DataFrame::group_by_with_series (cognitive 17) crates/polars-core/src/frame/group_by/mod.rs:29 — DataFrame::group_by_with_series has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · polars_row · ×4
  • polars_row::encode::encode_array (cognitive 44) crates/polars-row/src/encode.rs:800 — polars_row::encode::encode_array has cognitive complexity 44 (threshold 15). Drivers by points: loops 9 (27 pts), if/else 4 (12 pts), match/switch 3 (5 pts) (nesting depth added 28). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • polars_row::decode::decode (cognitive 29) crates/polars-row/src/decode.rs:255 — polars_row::decode::decode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 4 (9 pts), loops 2 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_row::encode::get_encoder (cognitive 22) crates/polars-row/src/encode.rs:303 — polars_row::encode::get_encoder has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 4 (6 pts), loops 2 (6 pts) (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • polars_row::variable::no_order::encode_view (cognitive 17) crates/polars-row/src/variable/no_order.rs:102 — polars_row::variable::no_order::encode_view has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D3 · God Classes · TooManyFunctions · ×4
  • TooManyFunctions: polars_expr::dispatch::datetime crates/polars-expr/src/dispatch/datetime.rs:13 — TooManyFunctions — 46 free functions. The bar is 30 free functions; this is 16 over it, 1.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: polars_python::functions::lazy crates/polars-python/src/functions/lazy.rs:26 — TooManyFunctions — 38 free functions. The bar is 30 free functions; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: polars_compute::cast::primitive_to crates/polars-compute/src/cast/primitive_to.rs:89 — TooManyFunctions — 35 free functions. The bar is 30 free functions; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: polars_expr::dispatch::list crates/polars-expr/src/dispatch/list.rs:15 — TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D35 · Change Coupling · Change-coupling hub · ×4
  • Change-coupling hub: array.rs → iterator.rs, mod.rs, array.rs, array.rs crates/polars-python/src/expr/array.rs — `crates/polars-python/src/expr/array.rs` changes together with 4 other files — `crates/polars-core/src/chunked_array/array/iterator.rs`, `crates/polars-ops/src/chunked_array/array/mod.rs`, `crates/polars-plan/src/dsl/array.rs`, `crates/polars-plan/src/dsl/function_expr/array.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: strings.rs → mod.rs, namespace.rs, string.rs crates/polars-plan/src/dsl/function_expr/strings.rs — `crates/polars-plan/src/dsl/function_expr/strings.rs` changes together with 3 other files — `crates/polars-ops/src/chunked_array/strings/mod.rs`, `crates/polars-ops/src/chunked_array/strings/namespace.rs`, `crates/polars-python/src/expr/string.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: determinism.rs → misc.rs, functions.rs, ir_to_dsl.rs crates/polars-plan/src/plans/aexpr/determinism.rs — `crates/polars-plan/src/plans/aexpr/determinism.rs` changes together with 3 other files — `crates/polars-expr/src/dispatch/misc.rs`, `crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs`, `crates/polars-plan/src/plans/conversion/ir_to_dsl.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: lower_ir.rs → sink.rs, row_deletions.rs, to_graph.rs crates/polars-stream/src/physical_plan/lower_ir.rs — `crates/polars-stream/src/physical_plan/lower_ir.rs` changes together with 3 other files — `crates/polars-python/src/lazyframe/sink.rs`, `crates/polars-stream/src/nodes/io_sources/multi_scan/components/row_deletions.rs`, `crates/polars-stream/src/physical_plan/to_graph.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×4
  • Edited copy of a member (38 corresponding lines) crates/polars-expr/src/reduce/min_max.rs:20 — crates/polars-expr/src/reduce/min_max.rs:20-57 | crates/polars-expr/src/reduce/min_max.rs:62-99 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) crates/polars-ops/src/series/ops/cum_agg.rs:388 — crates/polars-ops/src/series/ops/cum_agg.rs:388-425 | crates/polars-ops/src/series/ops/cum_agg.rs:436-473 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) crates/polars-row/src/fixed/decimal.rs:70 — crates/polars-row/src/fixed/decimal.rs:70-107 | crates/polars-row/src/fixed/decimal.rs:115-155 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) crates/polars-parquet/src/arrow/write/boolean/basic.rs:61 — crates/polars-parquet/src/arrow/write/boolean/basic.rs:61-102 | crates/polars-parquet/src/arrow/write/primitive/basic.rs:154-191 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×4
  • Edited copy of a member (41 corresponding lines) crates/polars-plan/src/plans/ir/inputs.rs:176 — crates/polars-plan/src/plans/ir/inputs.rs:176-216 | crates/polars-plan/src/plans/ir/inputs.rs:218-258 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) crates/polars-ops/src/series/ops/cum_agg.rs:114 — crates/polars-ops/src/series/ops/cum_agg.rs:114-154 | crates/polars-ops/src/series/ops/cum_agg.rs:156-196 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) crates/polars-compute/src/if_then_else/mod.rs:147 — crates/polars-compute/src/if_then_else/mod.rs:147-187 | crates/polars-compute/src/if_then_else/mod.rs:199-244 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) crates/polars-ops/src/chunked_array/scatter.rs:45 — crates/polars-ops/src/chunked_array/scatter.rs:45-85 | crates/polars-ops/src/chunked_array/scatter.rs:90-130 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (43 corresponding lines) · ×4
  • Edited copy of a member (43 corresponding lines) crates/polars-compute/src/unique/distinct.rs:484 — crates/polars-compute/src/unique/distinct.rs:484-536 | crates/polars-compute/src/unique/distinct.rs:538-580 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:37 — crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:37-79 | crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:86-135 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) crates/polars-core/src/frame/group_by/hashing.rs:131 — crates/polars-core/src/frame/group_by/hashing.rs:131-173 | crates/polars-core/src/frame/group_by/hashing.rs:185-237 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) crates/polars-parquet/src/arrow/write/binary/basic.rs:66 — crates/polars-parquet/src/arrow/write/binary/basic.rs:66-114 | crates/polars-parquet/src/arrow/write/binview/basic.rs:69-111 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (46 corresponding lines) · ×4
  • Edited copy of a member (46 corresponding lines) crates/polars-ops/src/chunked_array/list/min_max.rs:76 — crates/polars-ops/src/chunked_array/list/min_max.rs:76-121 | crates/polars-ops/src/chunked_array/list/min_max.rs:194-239 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (46 corresponding lines) crates/polars-ops/src/chunked_array/array/to_struct.rs:16 — crates/polars-ops/src/chunked_array/array/to_struct.rs:16-64 | crates/polars-ops/src/chunked_array/list/to_struct.rs:15-60 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (46 corresponding lines) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:499 — crates/polars-stream/src/nodes/joins/equi_join/mod.rs:499-544 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:501-559 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (46 corresponding lines) crates/polars-stream/src/nodes/io_sinks/writers/csv/morsel_serializer.rs:26 — crates/polars-stream/src/nodes/io_sinks/writers/csv/morsel_serializer.rs:26-73 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/morsel_serializer.rs:27-72 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×4
  • Edited copy of a member (34 corresponding lines) crates/polars-ops/src/series/ops/clip.rs:81 — crates/polars-ops/src/series/ops/clip.rs:81-114 | crates/polars-ops/src/series/ops/clip.rs:117-150 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) crates/polars-core/src/frame/row/av_buffer.rs:594 — crates/polars-core/src/frame/row/av_buffer.rs:594-627 | crates/polars-core/src/frame/row/av_buffer.rs:633-670 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) crates/polars-ops/src/chunked_array/strings/namespace.rs:616 — crates/polars-ops/src/chunked_array/strings/namespace.rs:616-649 | crates/polars-ops/src/chunked_array/strings/namespace.rs:657-690 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) crates/polars-ops/src/chunked_array/gather/chunked.rs:364 — crates/polars-ops/src/chunked_array/gather/chunked.rs:364-397 | crates/polars-ops/src/chunked_array/gather/chunked.rs:404-437 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×4
  • Edited copy of a member (36 corresponding lines) crates/polars-ops/src/series/ops/linear_space.rs:11 — crates/polars-ops/src/series/ops/linear_space.rs:11-46 | crates/polars-ops/src/series/ops/linear_space.rs:54-89 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) crates/polars-core/src/frame/column/scalar.rs:242 — crates/polars-core/src/frame/column/scalar.rs:242-279 | crates/polars-core/src/frame/column/scalar.rs:290-325 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) crates/polars-stream/src/nodes/in_memory_map.rs:43 — crates/polars-stream/src/nodes/in_memory_map.rs:43-78 | crates/polars-stream/src/nodes/is_sorted.rs:176-211 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:68 — crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:68-103 | crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:546-584 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×4
  • Edited copy of a member (31 corresponding lines) crates/polars-core/src/chunked_array/comparison/categorical.rs:136 — crates/polars-core/src/chunked_array/comparison/categorical.rs:136-166 | crates/polars-core/src/chunked_array/comparison/categorical.rs:175-216 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:404 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:404-434 | crates/polars-core/src/series/arithmetic/list.rs:418-448 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) crates/polars-plan/src/dsl/function_expr/array.rs:47 — crates/polars-plan/src/dsl/function_expr/array.rs:47-77 | crates/polars-plan/src/plans/aexpr/function_expr/array.rs:215-245 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) crates/polars-ops/src/series/ops/replace.rs:246 — crates/polars-ops/src/series/ops/replace.rs:246-285 | crates/polars-ops/src/series/ops/replace.rs:288-318 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×4
  • Edited copy of a member (32 corresponding lines) crates/polars-expr/src/groups/row_encoded.rs:128 — crates/polars-expr/src/groups/row_encoded.rs:128-168 | crates/polars-expr/src/groups/row_encoded.rs:179-210 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) crates/polars-stream/src/nodes/sort/flush.rs:224 — crates/polars-stream/src/nodes/sort/flush.rs:224-258 | crates/polars-stream/src/nodes/window/flush.rs:207-238 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) crates/polars-lazy/src/frame/mod.rs:1031 — crates/polars-lazy/src/frame/mod.rs:1031-1062 | crates/polars-lazy/src/frame/mod.rs:1149-1180 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) py-polars/src/polars/io/delta/_sink.py:958 — py-polars/src/polars/io/delta/_sink.py:958-989 | py-polars/src/polars/io/iceberg/_sink.py:1623-1657 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 15+ corresponding lines) · ×4
  • Edited copies of one member (4 members, 15+ corresponding lines) crates/polars-core/src/series/mod.rs:705 — crates/polars-core/src/series/mod.rs:705-719 | crates/polars-core/src/series/mod.rs:722-736 | crates/polars-core/src/series/mod.rs:739-753 | crates/polars-core/src/series/mod.rs:756-770 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 15+ corresponding lines) crates/polars-expr/src/dispatch/datetime.rs:266 — crates/polars-expr/src/dispatch/datetime.rs:266-283 | crates/polars-expr/src/dispatch/datetime.rs:293-307 | crates/polars-expr/src/dispatch/datetime.rs:310-324 | crates/polars-expr/src/dispatch/datetime.rs:359-384 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 15+ corresponding lines) crates/polars-python/src/functions/range.rs:71 — crates/polars-python/src/functions/range.rs:71-85 | crates/polars-python/src/functions/range.rs:93-107 | crates/polars-python/src/functions/range.rs:118-136 | crates/polars-python/src/functions/range.rs:147-165 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 15+ corresponding lines) crates/polars-compute/src/rolling/nulls/moment.rs:18 — crates/polars-compute/src/rolling/nulls/moment.rs:18-35 | crates/polars-compute/src/rolling/nulls/moment.rs:46-60 | crates/polars-compute/src/rolling/nulls/moment.rs:71-85 | crates/polars-compute/src/rolling/nulls/quantile.rs:139-175 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 8+ corresponding lines) · ×4
  • Edited copies of one member (5 members, 8+ corresponding lines) crates/polars-expr/src/reduce/any_all.rs:316 — crates/polars-expr/src/reduce/any_all.rs:316-323 | crates/polars-expr/src/reduce/any_all.rs:442-449 | crates/polars-expr/src/reduce/bitwise.rs:229-236 | crates/polars-expr/src/reduce/min_max.rs:508-515 | crates/polars-expr/src/reduce/min_max.rs:624-631 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 8+ corresponding lines) crates/polars-io/src/utils/byte_source.rs:854 — crates/polars-io/src/utils/byte_source.rs:854-861 | crates/polars-io/src/utils/byte_source.rs:863-870 | crates/polars-io/src/utils/byte_source.rs:872-879 | crates/polars-io/src/utils/byte_source.rs:881-888 | crates/polars-io/src/utils/byte_source.rs:893-900 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 8+ corresponding lines) crates/polars-buffer/src/buffer.rs:509 — crates/polars-arrow/src/array/dictionary/iterator.rs:28-35 | crates/polars-arrow/src/array/iterator.rs:61-68 | crates/polars-arrow/src/array/map/iterator.rs:29-38 | crates/polars-arrow/src/bitmap/iterator.rs:529-536 | crates/polars-buffer/src/buffer.rs:509-516 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 8+ corresponding lines) crates/polars-buffer/src/buffer.rs:538 — crates/polars-arrow/src/array/dictionary/iterator.rs:47-54 | crates/polars-arrow/src/array/iterator.rs:90-97 | crates/polars-arrow/src/array/map/iterator.rs:50-59 | crates/polars-arrow/src/bitmap/iterator.rs:558-565 | crates/polars-buffer/src/buffer.rs:538-545 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×4
  • Duplicated block (34 lines × 2) crates/polars-io/src/csv/read/parser.rs:484 — crates/polars-io/src/csv/read/parser.rs:484-517 | crates/polars-io/src/csv/read/parser.rs:627-660 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/parser.rs:484` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `crates/polars-io/src/csv/read/parser.rs:484` is reached only past a guard at line 477 that tests `self.v` and leaves the function early, and `crates/polars-io/src/csv/read/parser.rs:627` reads `self.v` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • Duplicated block (34 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:217 — crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:217-250 | crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:340-373 — before extracting anything, compare `crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs` and `crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:217` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (34 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:977 — crates/polars-plan/src/dsl/function_expr/mod.rs:977-1010 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:999-1032 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-plan/src/dsl/function_expr/mod.rs:1011` calls `Sql`, `fmt` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1033` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (34 lines × 2) crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/transform.rs:99 — crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/transform.rs:99-132 | crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/transform.rs:170-203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/transform.rs:99` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×4
  • Duplicated block (16–17 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:657 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:657-673 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:841-856 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:657` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16–17 lines × 2) crates/polars-io/src/csv/read/streaming.rs:403 — crates/polars-io/src/csv/read/streaming.rs:403-418 | crates/polars-io/src/csv/read/streaming.rs:539-555 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/streaming.rs:403` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (16–17 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs:177 — crates/polars-plan/src/plans/aexpr/traverse.rs:177-193 | crates/polars-plan/src/plans/aexpr/traverse.rs:294-309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/traverse.rs:177` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16–17 lines × 2) crates/polars-plan/src/plans/optimizer/sortedness.rs:306 — crates/polars-plan/src/plans/optimizer/sortedness.rs:306-322 | crates/polars-plan/src/plans/optimizer/sortedness.rs:437-452 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/sortedness.rs:306` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×4
  • Duplicated block (15 lines × 3) crates/polars-io/src/cloud/options.rs:588 — crates/polars-io/src/cloud/options.rs:588-602 | crates/polars-io/src/cloud/options.rs:664-678 | crates/polars-io/src/cloud/options.rs:734-748 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/cloud/options.rs:588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-io/src/cloud/options.rs:603` calls `with_unsigned_payload` and `crates/polars-io/src/cloud/options.rs:679` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 3) crates/polars-parquet/src/arrow/write/boolean/basic.rs:62 — crates/polars-parquet/src/arrow/write/boolean/basic.rs:62-76 | crates/polars-parquet/src/arrow/write/fixed_size_binary/basic.rs:17-31 | crates/polars-parquet/src/arrow/write/primitive/basic.rs:155-169 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (15 lines × 3) crates/polars-plan/src/plans/aexpr/traverse.rs:15 — crates/polars-plan/src/plans/aexpr/traverse.rs:15-29 | crates/polars-plan/src/plans/aexpr/traverse.rs:108-122 | crates/polars-plan/src/plans/aexpr/traverse.rs:229-243 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/traverse.rs:15` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 3) crates/polars-stream/src/nodes/dynamic_group_by.rs:294 — crates/polars-stream/src/nodes/dynamic_group_by.rs:294-308 | crates/polars-stream/src/nodes/rolling_group_by.rs:235-249 | crates/polars-stream/src/nodes/sorted_group_by.rs:128-142 — before extracting anything, compare `crates/polars-stream/src/nodes/dynamic_group_by.rs` and `crates/polars-stream/src/nodes/rolling_group_by.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/dynamic_group_by.rs:294` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-stream/src/nodes/dynamic_group_by.rs:291` calls `Ok` and `crates/polars-stream/src/nodes/sorted_group_by.rs:125` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×4
  • Duplicated block (11–12 lines × 2) crates/polars-expr/src/expressions/apply.rs:621 — crates/polars-expr/src/expressions/apply.rs:621-632 | crates/polars-expr/src/expressions/binary.rs:402-412 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/apply.rs:621` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11–12 lines × 2) crates/polars-ops/src/chunked_array/top_k.rs:153 — crates/polars-ops/src/chunked_array/top_k.rs:153-163 | crates/polars-ops/src/chunked_array/top_k.rs:234-245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:829 — crates/polars-stream/src/nodes/joins/equi_join/mod.rs:829-840 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1250-1260 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join/mod.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 131 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1250` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) docs/source/src/rust/user-guide/concepts/expressions.rs:79 — docs/source/src/rust/user-guide/concepts/expressions.rs:79-89 | docs/source/src/rust/user-guide/concepts/expressions.rs:91-102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/concepts/expressions.rs:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×4
  • Duplicated block (8 lines × 4) crates/polars-io/src/csv/read/parser.rs:578 — crates/polars-io/src/csv/read/parser.rs:578-585 | crates/polars-io/src/csv/read/parser.rs:914-921 | crates/polars-io/src/csv/read/splitfields.rs:292-299 | crates/polars-io/src/csv/read/splitfields.rs:383-390 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/parser.rs:578` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) crates/polars-ops/src/chunked_array/gather/chunked.rs:742 — crates/polars-ops/src/chunked_array/gather/chunked.rs:742-749 | crates/polars-ops/src/chunked_array/gather/chunked.rs:766-773 | crates/polars-ops/src/chunked_array/gather/chunked.rs:793-800 | crates/polars-ops/src/chunked_array/gather/chunked.rs:813-820 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/gather/chunked.rs:742` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) crates/polars-parquet/src/arrow/read/deserialize/categorical.rs:266 — crates/polars-parquet/src/arrow/read/deserialize/categorical.rs:266-273 | crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:227-234 | crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:201-208 | crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:315-322 — before extracting anything, compare `crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs` and `crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/categorical.rs:266` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) crates/polars-stream/src/nodes/forward_fill.rs:65 — crates/polars-stream/src/nodes/forward_fill.rs:65-72 | crates/polars-stream/src/nodes/gather_every.rs:57-64 | crates/polars-stream/src/nodes/sorted_unique.rs:78-85 | crates/polars-stream/src/nodes/with_row_index.rs:53-60 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
D5 · Coupling · Off the main sequence · ×4
  • Off the main sequence: polars-descriptions — polars-descriptions: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
  • Off the main sequence: polars-io-ext-ffi — polars-io-ext-ffi: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: polars-buffer — polars-buffer: abstractness 0.00, instability 0.07, distance 0.93 — zone of pain — concrete and depended on by 14 project(s), so it's rigid to change.
  • Off the main sequence: polars-config — polars-config: abstractness 0.00, instability 0.08, distance 0.92 — zone of pain — concrete and depended on by 12 project(s), so it's rigid to change.
D1 · Cyclomatic Complexity · IRFunctionExpr · ×3
  • IRFunctionExpr::get_field (cyclomatic 197) crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:9 — IRFunctionExpr::get_field has cyclomatic complexity 197 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • IRFunctionExpr::fmt_name (cyclomatic 128) crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:877 — IRFunctionExpr::fmt_name has cyclomatic complexity 128 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • IRFunctionExpr::function_options (cyclomatic 112) crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1245 — IRFunctionExpr::function_options has cyclomatic complexity 112 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AnyValue · ×3
  • AnyValue::strict_cast (cyclomatic 77) crates/polars-core/src/datatypes/any_value.rs:423 — AnyValue::strict_cast has cyclomatic complexity 77 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • AnyValue::eq_missing (cyclomatic 58) crates/polars-core/src/datatypes/any_value.rs:1196 — AnyValue::eq_missing has cyclomatic complexity 58 (threshold 15). Of this number, 57 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • AnyValue::extract (cyclomatic 25) crates/polars-core/src/datatypes/any_value.rs:285 — AnyValue::extract has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: AnyValue::partial_cmp (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · DataFrame · ×3
  • DataFrame::fmt (cyclomatic 47) crates/polars-core/src/fmt.rs:596 — DataFrame::fmt has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • DataFrame::sort_impl (cyclomatic 25) crates/polars-core/src/frame/mod.rs:1443 — DataFrame::sort_impl has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • DataFrame::to_ndarray (cyclomatic 24) crates/polars-core/src/chunked_array/ndarray.rs:100 — DataFrame::to_ndarray has cyclomatic complexity 24 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D17 · Explicit Debt · HackComment · ×3
  • HackComment crates/polars-stream/src/physical_plan/lower_expr.rs:3102 — // Hacky work-around: append an input column with a temporary name, but — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment crates/polars-plan/src/plans/ir/tree_format.rs:25 — /// Hack UpperExpr trait to get a kind of formatting that doesn't traverse the nodes. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment crates/polars-ops/src/frame/join/hash_join/single_keys.rs:143 — // Hack to ensure we never hit this branch again. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
D2 · Cognitive Complexity · WindowExpr · ×3
  • WindowExpr::evaluate_on_groups_impl (cognitive 273) crates/polars-expr/src/expressions/window.rs:705 — WindowExpr::evaluate_on_groups_impl has cognitive complexity 273 (threshold 15). Drivers by points: if/else 67 (166 pts), loops 24 (83 pts), match/switch 6 (18 pts), boolean chains 6 (nesting depth added 170). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • WindowExpr::evaluate_impl (cognitive 42) crates/polars-expr/src/expressions/window.rs:450 — WindowExpr::evaluate_impl has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • WindowExpr::map_list_agg_by_arg_sort (cognitive 26) crates/polars-expr/src/expressions/window.rs:56 — WindowExpr::map_list_agg_by_arg_sort has cognitive complexity 26 (threshold 15). Drivers by points: loops 6 (18 pts), match/switch 3 (6 pts), if/else 2 (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Executor · ×3
  • Executor::schedule_task (cognitive 26) crates/polars-async/src/executor/mod.rs:202 — Executor::schedule_task has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Executor::runner (cognitive 25) crates/polars-async/src/executor/mod.rs:312 — Executor::runner has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Executor::try_steal_task (cognitive 21) crates/polars-async/src/executor/mod.rs:256 — Executor::try_steal_task has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (8 pts), match/switch 3 (8 pts), if/else 1 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (64 corresponding lines) · ×3
  • Edited copy of a member (64 corresponding lines) crates/polars-ops/src/frame/join/asof/groups.rs:371 — crates/polars-ops/src/frame/join/asof/groups.rs:371-470 | crates/polars-ops/src/frame/join/asof/mod.rs:328-391 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (64 corresponding lines) crates/polars-compute/src/boolean.rs:48 — crates/polars-compute/src/boolean.rs:48-112 | crates/polars-compute/src/boolean.rs:115-178 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (64 corresponding lines) py-polars/src/polars/functions/lazy.py:869 — py-polars/src/polars/functions/lazy.py:869-959 | py-polars/src/polars/functions/lazy.py:989-1052 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×3
  • Edited copy of a member (33 corresponding lines) crates/polars-ops/src/series/ops/abs.rs:4 — crates/polars-ops/src/series/ops/abs.rs:4-39 | crates/polars-ops/src/series/ops/negate.rs:3-35 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) crates/polars-ops/src/series/ops/arg_min_max.rs:51 — crates/polars-ops/src/series/ops/arg_min_max.rs:51-83 | crates/polars-ops/src/series/ops/arg_min_max.rs:85-117 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) crates/polars-expr/src/idx_table/row_encoded.rs:123 — crates/polars-expr/src/idx_table/row_encoded.rs:123-158 | crates/polars-expr/src/idx_table/row_encoded.rs:165-197 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (39 corresponding lines) · ×3
  • Edited copy of a member (39 corresponding lines) crates/polars-core/src/frame/mod.rs:1261 — crates/polars-core/src/frame/mod.rs:1261-1299 | crates/polars-core/src/frame/mod.rs:1309-1350 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) crates/polars-expr/src/idx_table/binview.rs:276 — crates/polars-expr/src/idx_table/binview.rs:276-326 | crates/polars-expr/src/idx_table/row_encoded.rs:256-294 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) py-polars/src/polars/expr/categorical.py:123 — py-polars/src/polars/expr/categorical.py:123-177 | py-polars/src/polars/expr/string.py:868-906 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×3
  • Edited copy of a member (28 corresponding lines) crates/polars-expr/src/dispatch/groups_dispatch.rs:194 — crates/polars-expr/src/dispatch/groups_dispatch.rs:194-221 | crates/polars-expr/src/dispatch/groups_dispatch.rs:229-256 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) docs/source/src/rust/user-guide/io/csv.rs:1 — docs/source/src/rust/user-guide/io/csv.rs:1-32 | docs/source/src/rust/user-guide/io/parquet.rs:3-30 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) py-polars/src/polars/dataframe/group_by.py:1013 — py-polars/src/polars/dataframe/group_by.py:1013-1040 | py-polars/src/polars/dataframe/group_by.py:1220-1251 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 16+ corresponding lines) crates/polars-buffer/src/storage.rs:157 — crates/polars-buffer/src/storage.rs:157-172 | crates/polars-buffer/src/storage.rs:216-231 | crates/polars-buffer/src/storage.rs:233-250 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) crates/polars-expr/src/dispatch/random.rs:14 — crates/polars-expr/src/dispatch/random.rs:14-30 | crates/polars-expr/src/dispatch/random.rs:37-53 | crates/polars-expr/src/dispatch/shift_and_fill.rs:112-127 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:188 — crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:188-203 | crates/polars-stream/src/nodes/io_sources/parquet/mod.rs:234-249 | crates/polars-stream/src/nodes/io_sources/shared/file_init.rs:128-144 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/polars-expr/src/dispatch/strings.rs:295 — crates/polars-expr/src/dispatch/strings.rs:295-305 | crates/polars-expr/src/dispatch/strings.rs:308-318 | crates/polars-expr/src/dispatch/strings.rs:321-331 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/polars-expr/src/reduce/first_last.rs:206 — crates/polars-expr/src/reduce/first_last.rs:206-217 | crates/polars-expr/src/reduce/first_last.rs:284-294 | crates/polars-expr/src/reduce/first_last.rs:340-350 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/polars-plan/src/dsl/dsl_resolver/python.rs:161 — crates/polars-plan/src/dsl/dsl_resolver/python.rs:161-171 | crates/polars-python/src/dataset/dataset_provider_funcs.rs:19-29 | crates/polars-stream/src/nodes/io_sources/external_python/mod.rs:89-101 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/polars-expr/src/reduce/first_last.rs:192 — crates/polars-expr/src/reduce/first_last.rs:192-199 | crates/polars-expr/src/reduce/first_last.rs:271-277 | crates/polars-expr/src/reduce/first_last.rs:327-333 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/polars-core/src/frame/group_by/aggregations/boolean.rs:11 — crates/polars-core/src/frame/group_by/aggregations/boolean.rs:11-19 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:201-208 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:241-247 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/polars-compute/src/cast/binary_to.rs:148 — crates/polars-compute/src/cast/binary_to.rs:148-157 | crates/polars-compute/src/cast/binview_to.rs:24-30 | crates/polars-compute/src/cast/utf8_to.rs:23-32 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (43 lines × 2) · ×3
  • Duplicated block (43 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:933 — crates/polars-plan/src/dsl/function_expr/mod.rs:933-975 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:953-995 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (43 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs:312 — crates/polars-plan/src/plans/aexpr/traverse.rs:312-354 | crates/polars-plan/src/plans/aexpr/traverse.rs:424-466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/traverse.rs:312` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (43 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs:379 — crates/polars-plan/src/plans/aexpr/traverse.rs:379-421 | crates/polars-plan/src/plans/aexpr/traverse.rs:494-536 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/traverse.rs:379` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×3
  • Duplicated block (35 lines × 2) crates/polars-io/src/csv/read/streaming.rs:680 — crates/polars-io/src/csv/read/streaming.rs:680-714 | crates/polars-io/src/csv/read/streaming.rs:735-769 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/streaming.rs:680` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (35 lines × 2) crates/polars-ops/src/chunked_array/array/to_struct.rs:30 — crates/polars-ops/src/chunked_array/array/to_struct.rs:30-64 | crates/polars-ops/src/chunked_array/list/to_struct.rs:26-60 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/array/to_struct.rs:30` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (35 lines × 2) crates/polars-expr/src/reduce/cov.rs:99 — crates/polars-expr/src/reduce/cov.rs:99-133 | crates/polars-expr/src/reduce/cov.rs:243-277 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×3
  • Duplicated block (31 lines × 2) crates/polars-core/src/chunked_array/comparison/mod.rs:661 — crates/polars-core/src/chunked_array/comparison/mod.rs:661-691 | crates/polars-core/src/chunked_array/comparison/mod.rs:693-723 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (31 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:659 — crates/polars-parquet/src/arrow/write/mod.rs:659-689 | crates/polars-parquet/src/arrow/write/mod.rs:1039-1069 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:659` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (31 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:703 — crates/polars-plan/src/dsl/function_expr/mod.rs:703-733 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:694-724 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-plan/src/dsl/function_expr/mod.rs:734` calls `Sql`, `hash` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:725` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×3
  • Duplicated block (27 lines × 2) crates/polars-core/src/chunked_array/ops/rolling_window.rs:110 — crates/polars-core/src/chunked_array/ops/rolling_window.rs:110-136 | crates/polars-core/src/chunked_array/ops/rolling_window.rs:177-203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/ops/rolling_window.rs:110` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27 lines × 2) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/mod.rs:155 — crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/mod.rs:155-181 | crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/mod.rs:197-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/mod.rs:155` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/csv/morsel_serializer.rs:47 — crates/polars-stream/src/nodes/io_sinks/writers/csv/morsel_serializer.rs:47-73 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/morsel_serializer.rs:46-72 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sinks/writers/csv/morsel_serializer.rs:47` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×3
  • Duplicated block (18–19 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:597 — crates/polars-parquet/src/arrow/write/mod.rs:597-614 | crates/polars-parquet/src/arrow/write/mod.rs:980-998 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:597` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–19 lines × 2) crates/polars-parquet/src/arrow/write/mod.rs:695 — crates/polars-parquet/src/arrow/write/mod.rs:695-712 | crates/polars-parquet/src/arrow/write/mod.rs:918-936 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:695` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–19 lines × 2) py-polars/src/polars/lazyframe/engine.py:507 — py-polars/src/polars/lazyframe/engine.py:507-525 | py-polars/src/polars/lazyframe/engine.py:606-623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/lazyframe/engine.py:507` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×3
  • Duplicated block (15–16 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:612 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:612-626 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:794-809 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:612` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) crates/polars-parquet/src/arrow/write/dictionary.rs:551 — crates/polars-parquet/src/arrow/write/dictionary.rs:551-565 | crates/polars-parquet/src/arrow/write/dictionary.rs:618-633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/dictionary.rs:551` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:611 — crates/polars-stream/src/physical_plan/lower_expr.rs:611-626 | crates/polars-stream/src/physical_plan/lower_expr.rs:1654-1668 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:611` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×3
  • Duplicated block (13 lines × 4) crates/polars-core/src/chunked_array/comparison/mod.rs:667 — crates/polars-core/src/chunked_array/comparison/mod.rs:667-679 | crates/polars-core/src/chunked_array/comparison/mod.rs:699-711 | crates/polars-core/src/chunked_array/comparison/mod.rs:911-923 | crates/polars-core/src/chunked_array/comparison/mod.rs:938-950 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/comparison/mod.rs:667` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 4) REDACTED:5049 — REDACTED:5049-5061 | REDACTED:5120-5132 | REDACTED:7365-7377 | crates/polars-sql/src/sql_visitors.rs:756-768 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:5049` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 4) crates/polars-sql/src/subquery_outer_select.rs:56 — crates/polars-sql/src/subquery_outer_select.rs:56-68 | crates/polars-sql/src/subquery_pull_up.rs:184-196 | crates/polars-sql/src/subquery_pull_up.rs:425-437 | crates/polars-sql/src/subquery_pull_up.rs:614-626 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-sql/src/subquery_outer_select.rs:56` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×3
  • Duplicated block (12–13 lines × 3) crates/polars-compute/src/cardinality.rs:74 — crates/polars-compute/src/cardinality.rs:74-85 | crates/polars-compute/src/cardinality.rs:130-142 | crates/polars-compute/src/cardinality.rs:147-159 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-compute/src/cardinality.rs:130` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `array` to `&dyn Array` in one and `&BinaryViewArray` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12–13 lines × 3) crates/polars-expr/src/reduce/first_last_nonnull.rs:134 — crates/polars-expr/src/reduce/first_last_nonnull.rs:134-146 | crates/polars-expr/src/reduce/first_last_nonnull.rs:214-225 | crates/polars-expr/src/reduce/first_last_nonnull.rs:282-293 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/first_last_nonnull.rs:134` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 3) docs/source/src/rust/user-guide/concepts/data-types-and-structures.rs:21 — docs/source/src/rust/user-guide/concepts/data-types-and-structures.rs:21-33 | docs/source/src/rust/user-guide/concepts/expressions.rs:6-18 | docs/source/src/rust/user-guide/getting-started.rs:7-18 — before extracting anything, compare `docs/source/src/rust/user-guide/concepts/expressions.rs` and `docs/source/src/rust/user-guide/getting-started.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/getting-started.rs:7` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×3
  • Duplicated block (12–13 lines × 2) crates/polars-plan/src/plans/optimizer/sortedness.rs:35 — crates/polars-plan/src/plans/optimizer/sortedness.rs:35-46 | crates/polars-plan/src/plans/optimizer/sortedness.rs:181-193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/sortedness.rs:35` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) crates/polars-python/src/functions/lazy.rs:188 — crates/polars-python/src/functions/lazy.rs:188-200 | crates/polars-python/src/lazyframe/general.rs:753-764 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-python/src/functions/lazy.rs:188` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–13 lines × 2) docs/source/src/rust/user-guide/transformations/pivot.rs:42 — docs/source/src/rust/user-guide/transformations/pivot.rs:42-54 | docs/source/src/rust/user-guide/transformations/pivot.rs:71-82 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/transformations/pivot.rs:42` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×3
  • Duplicated block (6–7 lines × 2) crates/polars-core/src/frame/row/dataframe.rs:84 — crates/polars-core/src/frame/row/dataframe.rs:84-90 | crates/polars-python/src/dataframe/construction.rs:83-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6–7 lines × 2) crates/polars-expr/src/expressions/cast.rs:42 — crates/polars-expr/src/expressions/cast.rs:42-47 | crates/polars-expr/src/expressions/cast.rs:73-79 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/expressions/cast.rs:73` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6–7 lines × 2) crates/polars-sql/src/catalog.rs:1180 — crates/polars-sql/src/catalog.rs:1180-1185 | crates/polars-sql/src/catalog.rs:1189-1195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-sql/src/catalog.rs:1189` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D1 · Cyclomatic Complexity · SQLFunctionVisitor · ×2
  • SQLFunctionVisitor::visit_function (cyclomatic 236) crates/polars-sql/src/functions.rs:1442 — SQLFunctionVisitor::visit_function has cyclomatic complexity 236 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • SQLFunctionVisitor::visit_window_aggregate (cyclomatic 28) crates/polars-sql/src/window_frames.rs:87 — SQLFunctionVisitor::visit_window_aggregate has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · WindowExpr · ×2
  • WindowExpr::evaluate_on_groups_impl (cyclomatic 83) crates/polars-expr/src/expressions/window.rs:705 — WindowExpr::evaluate_on_groups_impl has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • WindowExpr::evaluate_impl (cyclomatic 23) crates/polars-expr/src/expressions/window.rs:450 — WindowExpr::evaluate_impl has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ColumnSelectorBuilder · ×2
  • ColumnSelectorBuilder::attach_transforms (cyclomatic 66) crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/builder.rs:50 — ColumnSelectorBuilder::attach_transforms has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ColumnSelectorBuilder::attach_iceberg_transforms (cyclomatic 20) crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/builder.rs:484 — ColumnSelectorBuilder::attach_iceberg_transforms has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AExpr · ×2
  • AExpr::to_field_impl_inner (cyclomatic 65) crates/polars-plan/src/plans/aexpr/schema.rs:52 — AExpr::to_field_impl_inner has cyclomatic complexity 65 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • AExpr::is_fallible_top_level (cyclomatic 22) crates/polars-plan/src/plans/aexpr/mod.rs:298 — AExpr::is_fallible_top_level has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TernaryExpr · ×2
  • TernaryExpr::evaluate_on_groups_impl (cyclomatic 41) crates/polars-expr/src/expressions/ternary.rs:235 — TernaryExpr::evaluate_on_groups_impl has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TernaryExpr::evaluate_impl (cyclomatic 22) crates/polars-expr/src/expressions/ternary.rs:118 — TernaryExpr::evaluate_impl has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ParquetReadImpl · ×2
  • ParquetReadImpl::init_morsel_distributor (cyclomatic 36) crates/polars-stream/src/nodes/io_sources/parquet/init.rs:56 — ParquetReadImpl::init_morsel_distributor has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ParquetReadImpl::init_row_group_decoder (cyclomatic 16) crates/polars-stream/src/nodes/io_sources/parquet/init.rs:461 — ParquetReadImpl::init_row_group_decoder has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AggregationExpr · ×2
  • AggregationExpr::evaluate_impl (cyclomatic 35) crates/polars-expr/src/expressions/aggregation.rs:70 — AggregationExpr::evaluate_impl has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • AggregationExpr::evaluate_on_groups_impl (cyclomatic 31) crates/polars-expr/src/expressions/aggregation.rs:226 — AggregationExpr::evaluate_on_groups_impl has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · polars_json · ×2
  • polars_json::json::deserialize::_deserialize (cyclomatic 33) crates/polars-json/src/json/deserialize.rs:413 — polars_json::json::deserialize::_deserialize has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • polars_json::json::infer_schema::coerce_dtype (cyclomatic 20) crates/polars-json/src/json/infer_schema.rs:71 — polars_json::json::infer_schema::coerce_dtype has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PageDecoder · ×2
  • PageDecoder::collect_predicate_flat (cyclomatic 31) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:591 — PageDecoder::collect_predicate_flat has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PageDecoder::collect_flat (cyclomatic 17) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:800 — PageDecoder::collect_flat has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SampleState · ×2
  • SampleState::try_transition_to_build (cyclomatic 29) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:319 — SampleState::try_transition_to_build has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SampleState::try_transition_to_build (cyclomatic 22) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:246 — SampleState::try_transition_to_build has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _utils.prepare_file_arg (cyclomatic 26) · ×2
  • _utils.prepare_file_arg (cyclomatic 26) REDACTED:125 — _utils.prepare_file_arg has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_utils.prepare_file_arg) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • _utils.prepare_file_arg (cyclomatic 26) REDACTED:135 — _utils.prepare_file_arg has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_utils.prepare_file_arg) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Wrap · ×2
  • Wrap::extract (cyclomatic 25) crates/polars-python/src/conversion/mod.rs:1520 — Wrap::extract has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Wrap::extract (cyclomatic 63) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • Wrap::impl_group_by_dynamic (cyclomatic 16) crates/polars-time/src/group_by/dynamic.rs:128 — Wrap::impl_group_by_dynamic has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FunctionIR · ×2
  • FunctionIR::eq (cyclomatic 24) crates/polars-plan/src/plans/functions/equality.rs:17 — FunctionIR::eq has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FunctionIR::schema (cyclomatic 16) crates/polars-plan/src/plans/functions/schema.rs:26 — FunctionIR::schema has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ListNumericOpHelper · ×2
  • ListNumericOpHelper::_finish_impl (cyclomatic 23) crates/polars-core/src/series/arithmetic/list.rs:451 — ListNumericOpHelper::_finish_impl has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (combine_validities_list_to_list_no_broadcast, combine_validities_list_to_list_broadcast_right, check_mismatch_pos). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • ListNumericOpHelper::try_new (cyclomatic 18) crates/polars-core/src/series/arithmetic/list.rs:181 — ListNumericOpHelper::try_new has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · EvalExpr · ×2
  • EvalExpr::evaluate_on_list_chunked (cyclomatic 23) crates/polars-expr/src/expressions/eval.rs:64 — EvalExpr::evaluate_on_list_chunked has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • EvalExpr::evaluate_on_array_chunked (cyclomatic 23) crates/polars-expr/src/expressions/eval.rs:245 — EvalExpr::evaluate_on_array_chunked has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChunkedArray · ×2
  • ChunkedArray::agg_arg_max (cyclomatic 17) crates/polars-core/src/frame/group_by/aggregations/mod.rs:758 — ChunkedArray::agg_arg_max has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChunkedArray::agg_arg_min (cyclomatic 16) crates/polars-core/src/frame/group_by/aggregations/mod.rs:577 — ChunkedArray::agg_arg_min has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CloudOptions · ×2
  • CloudOptions::build_aws (cyclomatic 17) crates/polars-io/src/cloud/options.rs:432 — CloudOptions::build_aws has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CloudOptions::from_untyped_config (cyclomatic 17) crates/polars-io/src/cloud/options.rs:794 — CloudOptions::from_untyped_config has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DataFrame.to_numpy (cyclomatic 17) · ×2
  • DataFrame.to_numpy (cyclomatic 17) py-polars/src/polars/dataframe/frame.py:1945 — DataFrame.to_numpy has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (DataFrame.to_numpy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DataFrame.to_numpy (cyclomatic 17) py-polars/src/polars/dataframe/frame.py:1964 — DataFrame.to_numpy has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (DataFrame.to_numpy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SQLFunctionVisitor · ×2
  • SQLFunctionVisitor::visit_function (cognitive 158) crates/polars-sql/src/functions.rs:1442 — SQLFunctionVisitor::visit_function has cognitive complexity 158 (threshold 15). Drivers by points: match/switch 38 (81 pts), if/else 39 (72 pts), boolean chains 5 (nesting depth added 76). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • SQLFunctionVisitor::visit_window_aggregate (cognitive 17) crates/polars-sql/src/window_frames.rs:87 — SQLFunctionVisitor::visit_window_aggregate has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 8, if/else 5 (7 pts), boolean chains 2 (nesting depth added 2). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ColumnSelectorBuilder · ×2
  • ColumnSelectorBuilder::attach_transforms (cognitive 126) crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/builder.rs:50 — ColumnSelectorBuilder::attach_transforms has cognitive complexity 126 (threshold 15). Drivers by points: if/else 51 (92 pts), match/switch 8 (20 pts), boolean chains 8, loops 3 (6 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ColumnSelectorBuilder::attach_iceberg_transforms (cognitive 35) crates/polars-stream/src/nodes/io_sources/multi_scan/components/column_selector/builder.rs:484 — ColumnSelectorBuilder::attach_iceberg_transforms has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 4 (10 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MergeSortedNode · ×2
  • MergeSortedNode::spawn (cognitive 122) crates/polars-stream/src/nodes/merge_sorted.rs:251 — MergeSortedNode::spawn has cognitive complexity 122 (threshold 15). Drivers by points: if/else 29 (92 pts), loops 8 (20 pts), boolean chains 6, match/switch 2 (4 pts) (nesting depth added 77). Of this number, 120 points are the body's own statements and 2 belong to one function item inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MergeSortedNode::update_state (cognitive 16) crates/polars-stream/src/nodes/merge_sorted.rs:200 — MergeSortedNode::update_state has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · IRFunctionExpr · ×2
  • IRFunctionExpr::get_field (cognitive 105) crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:9 — IRFunctionExpr::get_field has cognitive complexity 105 (threshold 15). Drivers by points: match/switch 28 (56 pts), if/else 17 (32 pts), boolean chains 15, loops 1 (2 pts) (nesting depth added 44). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • IRFunctionExpr::function_options (cognitive 19) crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1245 — IRFunctionExpr::function_options has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SelectionWalker · ×2
  • SelectionWalker::walk_rec (cognitive 83) crates/polars-plan/src/plans/optimizer/projection_pushdown/field_pruning.rs:190 — SelectionWalker::walk_rec has cognitive complexity 83 (threshold 15). Drivers by points: if/else 23 (51 pts), match/switch 10 (20 pts), loops 4 (10 pts), boolean chains 2 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SelectionWalker::walk_as_struct (cognitive 25) crates/polars-plan/src/plans/optimizer/projection_pushdown/field_pruning.rs:832 — SelectionWalker::walk_as_struct has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PredicatePushDown · ×2
  • PredicatePushDown::push_down (cognitive 76) crates/polars-plan/src/plans/optimizer/predicate_pushdown/mod.rs:254 — PredicatePushDown::push_down has cognitive complexity 76 (threshold 15). Drivers by points: if/else 27 (52 pts), match/switch 6 (13 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 36). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • PredicatePushDown::pushdown_and_continue (cognitive 19) crates/polars-plan/src/plans/optimizer/predicate_pushdown/mod.rs:99 — PredicatePushDown::pushdown_and_continue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParquetReadImpl · ×2
  • ParquetReadImpl::init_morsel_distributor (cognitive 71) crates/polars-stream/src/nodes/io_sources/parquet/init.rs:56 — ParquetReadImpl::init_morsel_distributor has cognitive complexity 71 (threshold 15). Drivers by points: if/else 21 (41 pts), loops 11 (21 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParquetReadImpl::init_row_group_decoder (cognitive 19) crates/polars-stream/src/nodes/io_sources/parquet/init.rs:461 — ParquetReadImpl::init_row_group_decoder has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, match/switch 3 (4 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TernaryExpr · ×2
  • TernaryExpr::evaluate_on_groups_impl (cognitive 70) crates/polars-expr/src/expressions/ternary.rs:235 — TernaryExpr::evaluate_on_groups_impl has cognitive complexity 70 (threshold 15). Drivers by points: if/else 24 (44 pts), match/switch 6 (14 pts), loops 6 (8 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TernaryExpr::evaluate_impl (cognitive 22) crates/polars-expr/src/expressions/ternary.rs:118 — TernaryExpr::evaluate_impl has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, boolean chains 5, match/switch 2 (4 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SemiAntiJoinNode · ×2
  • SemiAntiJoinNode::update_state (cognitive 67) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1117 — SemiAntiJoinNode::update_state has cognitive complexity 67 (threshold 15). Drivers by points: if/else 31 (59 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemiAntiJoinNode::spawn (cognitive 18) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1286 — SemiAntiJoinNode::spawn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (8 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SplitFields · ×2
  • SplitFields::next (cognitive 66) crates/polars-io/src/csv/read/splitfields.rs:241 — SplitFields::next has cognitive complexity 66 (threshold 15). Drivers by points: if/else 21 (50 pts), loops 3 (8 pts), boolean chains 4, match/switch 1 (4 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • SplitFields::next (cognitive 26) crates/polars-io/src/csv/read/splitfields.rs:64 — SplitFields::next has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageDecoder · ×2
  • PageDecoder::collect_predicate_flat (cognitive 61) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:591 — PageDecoder::collect_predicate_flat has cognitive complexity 61 (threshold 15). Drivers by points: if/else 22 (49 pts), boolean chains 8, match/switch 2 (3 pts), loops 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PageDecoder::collect_flat (cognitive 22) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:800 — PageDecoder::collect_flat has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Shared · ×2
  • Shared::run (cognitive 61) crates/polars-stream/src/nodes/joins/equi_join/flush.rs:308 — Shared::run has cognitive complexity 61 (threshold 15). Drivers by points: if/else 19 (47 pts), match/switch 3 (9 pts), boolean chains 4, loops 1 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Shared::run (cognitive 31) crates/polars-stream/src/nodes/group_by/flush.rs:173 — Shared::run has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (5 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EquiJoinNode · ×2
  • EquiJoinNode::update_state (cognitive 57) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:707 — EquiJoinNode::update_state has cognitive complexity 57 (threshold 15). Drivers by points: if/else 27 (47 pts), boolean chains 7, loops 1 (2 pts), match/switch 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EquiJoinNode::new (cognitive 16) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:566 — EquiJoinNode::new has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AExpr · ×2
  • AExpr::to_field_impl_inner (cognitive 56) crates/polars-plan/src/plans/aexpr/schema.rs:52 — AExpr::to_field_impl_inner has cognitive complexity 56 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 9 (20 pts), loops 4 (10 pts), boolean chains 3 (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • AExpr::is_fallible_top_level (cognitive 29) crates/polars-plan/src/plans/aexpr/mod.rs:298 — AExpr::is_fallible_top_level has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 7 (21 pts), if/else 1 (6 pts), boolean chains 2 (nesting depth added 19). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MultiplexerNode · ×2
  • MultiplexerNode::spawn (cognitive 56) crates/polars-stream/src/nodes/multiplexer.rs:129 — MultiplexerNode::spawn has cognitive complexity 56 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 6 (17 pts), match/switch 2 (9 pts), boolean chains 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiplexerNode::update_state (cognitive 20) crates/polars-stream/src/nodes/multiplexer.rs:43 — MultiplexerNode::update_state has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, loops 3 (4 pts), match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ZipNode · ×2
  • ZipNode::spawn (cognitive 54) crates/polars-stream/src/nodes/zip.rs:233 — ZipNode::spawn has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (31 pts), loops 10 (19 pts), match/switch 1 (4 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ZipNode::update_state (cognitive 20) crates/polars-stream/src/nodes/zip.rs:167 — ZipNode::update_state has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SampleState · ×2
  • SampleState::try_transition_to_build (cognitive 45) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:319 — SampleState::try_transition_to_build has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 8, match/switch 3 (6 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SampleState::try_transition_to_build (cognitive 29) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:246 — SampleState::try_transition_to_build has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · polars_time · ×2
  • polars_time::windows::group_by::update_groups_and_bounds (cognitive 42) crates/polars-time/src/windows/group_by.rs:16 — polars_time::windows::group_by::update_groups_and_bounds has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 3 (5 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • polars_time::windows::group_by::group_by_values (cognitive 20) crates/polars-time/src/windows/group_by.rs:589 — polars_time::windows::group_by::group_by_values has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _utils.prepare_file_arg (cognitive 42) · ×2
  • _utils.prepare_file_arg (cognitive 42) REDACTED:125 — _utils.prepare_file_arg has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (36 pts), ternaries 4, boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_utils.prepare_file_arg) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • _utils.prepare_file_arg (cognitive 42) REDACTED:135 — _utils.prepare_file_arg has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (36 pts), ternaries 4, boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_utils.prepare_file_arg) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · EvalExpr · ×2
  • EvalExpr::evaluate_on_array_chunked (cognitive 40) crates/polars-expr/src/expressions/eval.rs:245 — EvalExpr::evaluate_on_array_chunked has cognitive complexity 40 (threshold 15). Drivers by points: if/else 22 (31 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • EvalExpr::evaluate_on_list_chunked (cognitive 37) crates/polars-expr/src/expressions/eval.rs:64 — EvalExpr::evaluate_on_list_chunked has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleKeyIdxTable · ×2
  • SingleKeyIdxTable::probe_impl (cognitive 35) crates/polars-expr/src/idx_table/single_key.rs:101 — SingleKeyIdxTable::probe_impl has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 5 (14 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SingleKeyIdxTable::insert_keys_subset (cognitive 27) crates/polars-expr/src/idx_table/single_key.rs:218 — SingleKeyIdxTable::insert_keys_subset has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (5 pts), match/switch 1 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inner · ×2
  • Inner::try_open_check_latest (cognitive 33) crates/polars-io/src/file_cache/entry.rs:86 — Inner::try_open_check_latest has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inner::try_get_metadata (cognitive 20) crates/polars-io/src/file_cache/entry.rs:242 — Inner::try_get_metadata has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CloudOptions · ×2
  • CloudOptions::build_aws (cognitive 31) crates/polars-io/src/cloud/options.rs:432 — CloudOptions::build_aws has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 2 (4 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CloudOptions::from_untyped_config (cognitive 23) crates/polars-io/src/cloud/options.rs:794 — CloudOptions::from_untyped_config has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ToArrowConverter · ×2
  • ToArrowConverter::array_to_arrow_impl (cognitive 30) crates/polars-core/src/series/arrow_export/mod.rs:155 — ToArrowConverter::array_to_arrow_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (25 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ToArrowConverter::attach_pl_field_metadata (cognitive 16) crates/polars-core/src/series/arrow_export/mod.rs:515 — ToArrowConverter::attach_pl_field_metadata has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function item inside it that branches (inner). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · RawTable · ×2
  • RawTable::try_find_or_insert_impl (cognitive 30) crates/polars-utils/src/parma/raw/mod.rs:495 — RawTable::try_find_or_insert_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (23 pts), match/switch 1 (4 pts), loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RawTable::find_impl (cognitive 22) crates/polars-utils/src/parma/raw/mod.rs:443 — RawTable::find_impl has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFrame.to_numpy (cognitive 28) · ×2
  • DataFrame.to_numpy (cognitive 28) py-polars/src/polars/dataframe/frame.py:1945 — DataFrame.to_numpy has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DataFrame.to_numpy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • DataFrame.to_numpy (cognitive 28) py-polars/src/polars/dataframe/frame.py:1964 — DataFrame.to_numpy has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DataFrame.to_numpy) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · LineBatchProducer · ×2
  • LineBatchProducer::next_batch (cognitive 26) crates/polars-stream/src/nodes/io_sources/ndjson/line_batch_distributor.rs:190 — LineBatchProducer::next_batch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LineBatchProducer::next_batch (cognitive 16) crates/polars-stream/src/nodes/io_sources/csv/line_batch_source.rs:442 — LineBatchProducer::next_batch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NumericFixedSizeListOpHelper · ×2
  • NumericFixedSizeListOpHelper::execute_op (cognitive 25) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:123 — NumericFixedSizeListOpHelper::execute_op has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, match/switch 4 (5 pts), loops 1 (nesting depth added 4). Of this number, 21 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • NumericFixedSizeListOpHelper::_finish_impl (cognitive 16) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:437 — NumericFixedSizeListOpHelper::_finish_impl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FunctionIR · ×2
  • FunctionIR::eq (cognitive 24) crates/polars-plan/src/plans/functions/equality.rs:17 — FunctionIR::eq has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 6, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FunctionIR::schema (cognitive 24) crates/polars-plan/src/plans/functions/schema.rs:26 — FunctionIR::schema has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 4 (13 pts), loops 2 (7 pts), if/else 2 (4 pts) (nesting depth added 16). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Canvas · ×2
  • Canvas::from (cognitive 22) crates/polars-plan/src/plans/ir/tree_format.rs:898 — Canvas::from has cognitive complexity 22 (threshold 15). Drivers by points: loops 8 (12 pts), if/else 4 (8 pts), boolean chains 2 (nesting depth added 8). Of this number, 19 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Canvas::draw_connections (cognitive 17) crates/polars-plan/src/plans/ir/tree_format.rs:851 — Canvas::draw_connections has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BinviewKeyIdxTable · ×2
  • BinviewKeyIdxTable::probe_impl (cognitive 21) crates/polars-expr/src/idx_table/binview.rs:63 — BinviewKeyIdxTable::probe_impl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BinviewKeyIdxTable::insert_keys_subset (cognitive 17) crates/polars-expr/src/idx_table/binview.rs:193 — BinviewKeyIdxTable::insert_keys_subset has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 2 (5 pts), loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FlushState · ×2
  • FlushState::new (cognitive 21) crates/polars-stream/src/nodes/joins/equi_join/flush.rs:128 — FlushState::new has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FlushState::next_step (cognitive 17) crates/polars-stream/src/nodes/sort/flush.rs:151 — FlushState::next_step has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BooleanUnique · ×2
  • BooleanUnique::arg_unique (cognitive 20) crates/polars-compute/src/unique/distinct.rs:204 — BooleanUnique::arg_unique has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BooleanUnique::n_unique_idx (cognitive 19) crates/polars-compute/src/unique/distinct.rs:265 — BooleanUnique::n_unique_idx has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SeriesWrap · ×2
  • SeriesWrap::agg_var (cognitive 20) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1032 — SeriesWrap::agg_var has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (7 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (SeriesWrap::agg_std) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • SeriesWrap::agg_std (cognitive 20) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1110 — SeriesWrap::agg_std has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (7 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: one other method here (SeriesWrap::agg_var) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · WindowNode · ×2
  • WindowNode::spawn (cognitive 20) crates/polars-stream/src/nodes/window/mod.rs:246 — WindowNode::spawn has cognitive complexity 20 (threshold 15). Drivers by points: loops 3 (10 pts), if/else 2 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • WindowNode::update_state (cognitive 16) crates/polars-stream/src/nodes/window/mod.rs:169 — WindowNode::update_state has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 3, loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KneeController · ×2
  • KneeController::step (cognitive 19) crates/polars-io/src/cloud/concurrency/knee.rs:645 — KneeController::step has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • KneeController::end_round (cognitive 16) crates/polars-io/src/cloud/concurrency/knee.rs:706 — KneeController::end_round has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 4). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MemoryManager · ×2
  • MemoryManager::spawn_spills (cognitive 19) crates/polars-ooc/src/memory_manager.rs:232 — MemoryManager::spawn_spills has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MemoryManager::find_spillables (cognitive 18) crates/polars-ooc/src/memory_manager.rs:383 — MemoryManager::find_spillables has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Wrap · ×2
  • Wrap::impl_group_by_dynamic (cognitive 19) crates/polars-time/src/group_by/dynamic.rs:128 — Wrap::impl_group_by_dynamic has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Wrap::extract (cognitive 16) crates/polars-python/src/conversion/mod.rs:2149 — Wrap::extract has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (7 pts), if/else 3 (6 pts), match/switch 2 (3 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · DataType · ×2
  • DataType::can_cast_to (cognitive 18) crates/polars-core/src/datatypes/dtype.rs:501 — DataType::can_cast_to has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DataType::try_to_arrow (cognitive 16) crates/polars-core/src/datatypes/dtype.rs:1316 — DataType::try_to_arrow has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 3 (5 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AggregationExpr · ×2
  • AggregationExpr::evaluate_impl (cognitive 18) crates/polars-expr/src/expressions/aggregation.rs:70 — AggregationExpr::evaluate_impl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 5 (7 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AggregationExpr::evaluate_on_groups_impl (cognitive 17) crates/polars-expr/src/expressions/aggregation.rs:226 — AggregationExpr::evaluate_on_groups_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 3 (6 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KeyRowLayout · ×2
  • KeyRowLayout::verify_columns (cognitive 16) crates/polars-expr/src/key_rows/layout.rs:279 — KeyRowLayout::verify_columns has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 3 (6 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • KeyRowLayout::write_columns_batch (cognitive 16) crates/polars-expr/src/key_rows/layout.rs:342 — KeyRowLayout::write_columns_batch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×2
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (37 shared lines) · ×2
  • Near-duplicate member pair (37 shared lines) crates/polars-expr/src/expressions/eval.rs:69 — crates/polars-expr/src/expressions/eval.rs:69-242 | crates/polars-expr/src/expressions/eval.rs:251-429 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (37 shared lines) crates/polars-mem-engine/src/executors/group_by_dynamic.rs:26 — crates/polars-mem-engine/src/executors/group_by_dynamic.rs:26-82 | crates/polars-mem-engine/src/executors/group_by_rolling.rs:69-114 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (47 corresponding lines) · ×2
  • Edited copy of a member (47 corresponding lines) crates/polars-io/src/csv/read/streaming.rs:668 — crates/polars-io/src/csv/read/streaming.rs:668-714 | crates/polars-io/src/csv/read/streaming.rs:722-769 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (47 corresponding lines) crates/polars-parquet/src/parquet/encoding/hybrid_rle/mod.rs:83 — crates/polars-parquet/src/parquet/encoding/hybrid_rle/mod.rs:83-138 | crates/polars-parquet/src/parquet/encoding/hybrid_rle/mod.rs:140-186 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (10 members, 50+ identical tokens) crates/polars-core/src/frame/group_by/aggregations/mod.rs:334 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:334-425 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:503-575 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:684-756 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:761-865 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:866-938 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:951-1030 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1035-1109 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1113-1189 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:72-137 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:139-204 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
  • Members sharing a duplicated core (10 members, 50+ identical tokens) crates/polars-sql/src/subquery.rs:2120 — crates/polars-sql/src/subquery.rs:2120-2195 | crates/polars-sql/src/subquery.rs:2919-2959 | crates/polars-sql/src/subquery.rs:3054-3199 | crates/polars-sql/src/subquery.rs:3414-3502 | crates/polars-sql/src/subquery.rs:3662-3690 | crates/polars-sql/src/subquery_group_by.rs:62-118 | crates/polars-sql/src/subquery_pull_up.rs:142-229 | crates/polars-sql/src/subquery_pull_up.rs:1279-1324 | crates/polars-sql/src/subquery_pull_up.rs:1327-1354 | crates/polars-sql/src/subquery_pull_up.rs:1422-1463 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (6 members, 50+ identical tokens) crates/polars-ops/src/chunked_array/array/dispersion.rs:6 — crates/polars-ops/src/chunked_array/array/dispersion.rs:6-39 | crates/polars-ops/src/chunked_array/array/dispersion.rs:41-74 | crates/polars-ops/src/chunked_array/array/dispersion.rs:76-111 | crates/polars-ops/src/chunked_array/list/dispersion.rs:5-48 | crates/polars-ops/src/chunked_array/list/dispersion.rs:50-84 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:224-266 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) py-polars/src/polars/io/csv/functions.py:124 — py-polars/src/polars/io/csv/functions.py:124-531 | py-polars/src/polars/lazyframe/engine.py:503-525 | py-polars/src/polars/lazyframe/engine.py:593-623 | py-polars/src/polars/lazyframe/frame.py:2480-2713 | py-polars/src/polars/lazyframe/frame.py:3597-3850 | py-polars/src/polars/lazyframe/frame.py:9542-9704 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/polars-core/src/frame/builder.rs:94 — crates/polars-core/src/frame/builder.rs:94-111 | crates/polars-core/src/frame/builder.rs:122-145 | crates/polars-core/src/frame/builder.rs:157-180 | crates/polars-core/src/frame/builder.rs:194-216 | crates/polars-core/src/frame/builder.rs:223-250 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/polars-expr/src/reduce/count.rs:59 — crates/polars-expr/src/reduce/count.rs:59-88 | crates/polars-expr/src/reduce/count.rs:96-125 | crates/polars-expr/src/reduce/count.rs:229-256 | crates/polars-expr/src/reduce/has_nulls.rs:49-78 | crates/polars-expr/src/reduce/is_empty.rs:56-84 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Edited copy of a member (77 corresponding lines) · ×2
  • Edited copy of a member (77 corresponding lines) crates/polars-ops/src/chunked_array/strings/find_many.rs:165 — crates/polars-ops/src/chunked_array/strings/find_many.rs:165-242 | crates/polars-ops/src/chunked_array/strings/find_many.rs:263-339 — These two members are one piece of code written twice and then edited apart: 77 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (77 corresponding lines) py-polars/src/polars/expr/datetime.py:1942 — py-polars/src/polars/expr/datetime.py:1942-2042 | py-polars/src/polars/expr/string.py:111-187 — These two members are one piece of code written twice and then edited apart: 77 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (45 corresponding lines) · ×2
  • Edited copy of a member (45 corresponding lines) crates/polars-expr/src/hot_groups/mod.rs:77 — crates/polars-expr/src/hot_groups/mod.rs:77-122 | crates/polars-expr/src/idx_table/mod.rs:88-132 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (45 corresponding lines) crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:105 — crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:105-152 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/mod.rs:99-143 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (62 corresponding lines) · ×2
  • Edited copy of a member (62 corresponding lines) crates/polars-ops/src/chunked_array/binary/slice.rs:108 — crates/polars-ops/src/chunked_array/binary/slice.rs:108-169 | crates/polars-ops/src/chunked_array/strings/substring.rs:238-304 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (62 corresponding lines) crates/polars-plan/src/plans/ir/inputs.rs:37 — crates/polars-plan/src/plans/ir/inputs.rs:37-98 | crates/polars-plan/src/plans/ir/inputs.rs:100-166 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (58 corresponding lines) · ×2
  • Edited copy of a member (58 corresponding lines) crates/polars-ops/src/series/ops/is_first_distinct.rs:91 — crates/polars-ops/src/series/ops/is_first_distinct.rs:91-148 | crates/polars-ops/src/series/ops/is_last_distinct.rs:12-69 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (58 corresponding lines) crates/polars-expr/src/reduce/min_max_by.rs:24 — crates/polars-expr/src/reduce/min_max_by.rs:24-81 | crates/polars-expr/src/reduce/min_max_by.rs:87-156 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (51 corresponding lines) · ×2
  • Edited copy of a member (51 corresponding lines) crates/polars-io/src/cloud/credential_provider.rs:794 — crates/polars-io/src/cloud/credential_provider.rs:794-866 | crates/polars-io/src/cloud/credential_provider.rs:979-1029 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (51 corresponding lines) crates/polars-plan/src/dsl/function_expr/list.rs:58 — crates/polars-plan/src/dsl/function_expr/list.rs:58-108 | crates/polars-plan/src/plans/aexpr/function_expr/list.rs:233-283 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (40 corresponding lines) · ×2
  • Edited copy of a member (40 corresponding lines) crates/polars-ops/src/series/ops/round.rs:330 — crates/polars-ops/src/series/ops/round.rs:330-369 | crates/polars-ops/src/series/ops/round.rs:372-411 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (40 corresponding lines) crates/polars-core/src/chunked_array/arg_min_max.rs:167 — crates/polars-core/src/chunked_array/arg_min_max.rs:167-206 | crates/polars-core/src/chunked_array/arg_min_max.rs:212-251 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 31+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 31+ corresponding lines) crates/polars-expr/src/reduce/unique.rs:238 — crates/polars-expr/src/reduce/unique.rs:238-268 | crates/polars-expr/src/reduce/unique.rs:414-448 | crates/polars-expr/src/reduce/unique.rs:509-541 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 31+ corresponding lines) crates/polars-stream/src/nodes/io_sources/csv/builder.rs:64 — crates/polars-stream/src/nodes/io_sources/csv/builder.rs:64-94 | crates/polars-stream/src/nodes/io_sources/lines.rs:52-82 | crates/polars-stream/src/nodes/io_sources/ndjson/builder.rs:59-89 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 20+ corresponding lines) crates/polars-core/src/series/arithmetic/borrowed.rs:546 — crates/polars-core/src/series/arithmetic/borrowed.rs:546-568 | crates/polars-core/src/series/arithmetic/borrowed.rs:574-596 | crates/polars-core/src/series/arithmetic/borrowed.rs:685-704 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) crates/polars-stream/src/morsel.rs:184 — crates/polars-stream/src/morsel.rs:184-203 | crates/polars-stream/src/morsel.rs:208-227 | crates/polars-stream/src/morsel.rs:233-252 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 17+ corresponding lines) crates/polars-ops/src/series/ops/fused.rs:12 — crates/polars-ops/src/series/ops/fused.rs:12-28 | crates/polars-ops/src/series/ops/fused.rs:63-79 | crates/polars-ops/src/series/ops/fused.rs:113-129 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) crates/polars-sql/src/subquery_pull_up.rs:1126 — crates/polars-sql/src/subquery_pull_up.rs:1126-1142 | crates/polars-sql/src/subquery_pull_up.rs:1146-1165 | crates/polars-sql/src/subquery_pull_up.rs:1212-1237 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 24+ corresponding lines) crates/polars-expr/src/reduce/implode.rs:88 — crates/polars-expr/src/reduce/implode.rs:88-113 | crates/polars-expr/src/reduce/implode.rs:158-181 | crates/polars-expr/src/reduce/implode.rs:227-255 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) crates/polars-core/src/frame/mod.rs:632 — crates/polars-core/src/frame/mod.rs:632-661 | crates/polars-core/src/frame/mod.rs:663-693 | crates/polars-core/src/frame/mod.rs:753-776 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 27+ corresponding lines) crates/polars-compute/src/binview_index_map.rs:181 — crates/polars-compute/src/binview_index_map.rs:181-209 | crates/polars-compute/src/binview_index_map.rs:213-243 | crates/polars-utils/src/idx_map/bytes_idx_map.rs:88-114 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 27+ corresponding lines) crates/polars-io/src/cloud/credential_provider.rs:329 — crates/polars-io/src/cloud/credential_provider.rs:329-359 | crates/polars-io/src/cloud/credential_provider.rs:362-388 | crates/polars-io/src/cloud/credential_provider.rs:391-419 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 21+ corresponding lines) crates/polars-ops/src/chunked_array/strings/strip.rs:55 — crates/polars-ops/src/chunked_array/strings/strip.rs:55-75 | crates/polars-ops/src/chunked_array/strings/strip.rs:77-97 | crates/polars-ops/src/chunked_array/strings/strip.rs:99-119 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 21+ corresponding lines) crates/polars-core/src/chunked_array/cast.rs:603 — crates/polars-core/src/chunked_array/cast.rs:603-630 | crates/polars-core/src/chunked_array/cast.rs:632-660 | crates/polars-core/src/chunked_array/cast.rs:669-689 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 22+ corresponding lines) crates/polars-expr/src/reduce/first_last_nonnull.rs:133 — crates/polars-expr/src/reduce/first_last_nonnull.rs:133-156 | crates/polars-expr/src/reduce/first_last_nonnull.rs:213-234 | crates/polars-expr/src/reduce/first_last_nonnull.rs:281-302 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 22+ corresponding lines) crates/polars-python/src/catalog/unity.rs:61 — crates/polars-python/src/catalog/unity.rs:61-82 | crates/polars-python/src/catalog/unity.rs:85-109 | crates/polars-python/src/catalog/unity.rs:117-142 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 18+ corresponding lines) crates/polars-ops/src/chunked_array/binary/namespace.rs:116 — crates/polars-ops/src/chunked_array/binary/namespace.rs:116-133 | crates/polars-ops/src/chunked_array/binary/namespace.rs:149-166 | crates/polars-ops/src/chunked_array/binary/namespace.rs:168-185 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) crates/polars-core/src/series/arithmetic/borrowed.rs:208 — crates/polars-core/src/series/arithmetic/borrowed.rs:208-225 | crates/polars-core/src/series/arithmetic/borrowed.rs:229-246 | crates/polars-core/src/series/arithmetic/borrowed.rs:250-267 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 19+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 19+ corresponding lines) crates/polars-expr/src/reduce/mean.rs:9 — crates/polars-expr/src/reduce/mean.rs:9-27 | crates/polars-expr/src/reduce/skew_kurtosis.rs:9-38 | crates/polars-expr/src/reduce/skew_kurtosis.rs:44-75 | crates/polars-expr/src/reduce/var_std.rs:13-47 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 19+ corresponding lines) crates/polars-core/src/series/any_value.rs:318 — crates/polars-core/src/series/any_value.rs:318-336 | crates/polars-core/src/series/any_value.rs:509-527 | crates/polars-core/src/series/any_value.rs:530-548 | crates/polars-core/src/series/any_value.rs:584-603 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 19+ corresponding lines) crates/polars-core/src/series/any_value.rs:256 — crates/polars-core/src/series/any_value.rs:256-274 | crates/polars-core/src/series/any_value.rs:276-295 | crates/polars-core/src/series/any_value.rs:296-316 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) crates/polars-core/src/chunked_array/ops/apply.rs:74 — crates/polars-core/src/chunked_array/ops/apply.rs:74-92 | crates/polars-core/src/chunked_array/ops/apply.rs:97-117 | crates/polars-ops/src/chunked_array/binary/namespace.rs:48-73 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (6 members, 10+ corresponding lines) crates/polars-core/src/chunked_array/comparison/scalar.rs:86 — crates/polars-core/src/chunked_array/comparison/scalar.rs:86-95 | crates/polars-core/src/chunked_array/comparison/scalar.rs:108-117 | crates/polars-core/src/chunked_array/comparison/scalar.rs:139-148 | crates/polars-core/src/chunked_array/comparison/scalar.rs:150-159 | crates/polars-core/src/chunked_array/comparison/scalar.rs:161-170 | crates/polars-core/src/chunked_array/comparison/scalar.rs:172-181 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
  • Edited copies of one member (6 members, 10+ corresponding lines) crates/polars-expr/src/reduce/any_all.rs:46 — crates/polars-expr/src/reduce/any_all.rs:46-55 | crates/polars-expr/src/reduce/any_all.rs:145-154 | crates/polars-expr/src/reduce/any_all.rs:248-260 | crates/polars-expr/src/reduce/any_all.rs:374-386 | crates/polars-expr/src/reduce/min_max.rs:441-455 | crates/polars-expr/src/reduce/min_max.rs:557-571 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 15+ corresponding lines) crates/polars-plan/src/dsl/mod.rs:489 — crates/polars-plan/src/dsl/mod.rs:489-504 | crates/polars-plan/src/dsl/mod.rs:515-529 | crates/polars-plan/src/dsl/mod.rs:540-554 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) crates/polars-plan/src/plans/visitor/expr.rs:16 — crates/polars-plan/src/plans/visitor/expr.rs:16-30 | crates/polars-plan/src/plans/visitor/expr.rs:197-211 | crates/polars-plan/src/plans/visitor/lp.rs:63-78 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (91 corresponding lines) · ×2
  • Edited copy of a member (91 corresponding lines) py-polars/src/polars/series/string.py:98 — py-polars/src/polars/series/string.py:98-188 | py-polars/src/polars/series/string.py:235-346 — These two members are one piece of code written twice and then edited apart: 91 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (91 corresponding lines) py-polars/src/polars/io/ipc/functions.py:412 — py-polars/src/polars/io/ipc/functions.py:412-504 | py-polars/src/polars/io/lines.py:151-241 — These two members are one piece of code written twice and then edited apart: 91 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 18+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 18+ corresponding lines) crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:34 — crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:34-51 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:53-70 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:208-225 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:229-246 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 18+ corresponding lines) crates/polars-python/src/series/construction.rs:150 — crates/polars-python/src/series/construction.rs:150-167 | crates/polars-python/src/series/construction.rs:179-196 | crates/polars-python/src/series/construction.rs:296-313 | crates/polars-python/src/series/construction.rs:316-333 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 10+ corresponding lines) crates/polars-time/src/series/mod.rs:24 — crates/polars-time/src/series/mod.rs:24-33 | crates/polars-time/src/series/mod.rs:37-46 | crates/polars-time/src/series/mod.rs:50-59 | crates/polars-time/src/series/mod.rs:63-72 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 10+ corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/simple.rs:655 — crates/polars-parquet/src/arrow/read/deserialize/simple.rs:655-665 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:668-678 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:681-690 | crates/polars-parquet/src/parquet/types.rs:240-252 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 9+ corresponding lines) crates/polars-ops/src/series/ops/fused.rs:34 — crates/polars-ops/src/series/ops/fused.rs:34-42 | crates/polars-ops/src/series/ops/fused.rs:85-93 | crates/polars-ops/src/series/ops/fused.rs:135-143 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) crates/polars-plan/src/dsl/scan_sources.rs:157 — crates/polars-plan/src/dsl/scan_sources.rs:157-170 | crates/polars-plan/src/plans/lit.rs:70-78 | crates/polars-plan/src/plans/lit.rs:82-90 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 11+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 11+ corresponding lines) crates/polars-json/src/json/write/serialize.rs:419 — crates/polars-json/src/json/write/serialize.rs:419-430 | crates/polars-json/src/json/write/serialize.rs:441-452 | crates/polars-json/src/json/write/serialize.rs:463-474 | crates/polars-json/src/json/write/serialize.rs:484-494 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 11+ corresponding lines) crates/polars-core/src/runtime.rs:72 — crates/polars-core/src/runtime.rs:72-87 | crates/polars-core/src/runtime.rs:92-107 | crates/polars-core/src/runtime.rs:121-131 | crates/polars-core/src/runtime.rs:133-143 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (53 corresponding lines) · ×2
  • Edited copy of a member (53 corresponding lines) py-polars/src/polars/dataframe/plotting.py:36 — py-polars/src/polars/dataframe/plotting.py:36-88 | py-polars/src/polars/dataframe/plotting.py:165-222 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (53 corresponding lines) py-polars/src/polars/expr/categorical.py:180 — py-polars/src/polars/expr/categorical.py:180-232 | py-polars/src/polars/expr/string.py:1660-1749 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 13+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 13+ corresponding lines) crates/polars-expr/src/reduce/min_max.rs:669 — crates/polars-expr/src/reduce/min_max.rs:669-681 | crates/polars-expr/src/reduce/min_max.rs:736-748 | crates/polars-expr/src/reduce/min_max_by.rs:628-642 | crates/polars-expr/src/reduce/min_max_by.rs:682-696 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 13+ corresponding lines) crates/polars-ffi/src/version_0.rs:43 — crates/polars-arrow/src/ffi/array.rs:69-86 | crates/polars-arrow/src/ffi/mmap.rs:73-90 | REDACTED:24-40 | crates/polars-ffi/src/version_0.rs:43-55 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 11+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 11+ corresponding lines) REDACTED:702 — REDACTED:702-712 | REDACTED:721-732 | REDACTED:741-751 | REDACTED:760-770 | REDACTED:780-790 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 11+ corresponding lines) crates/polars-mem-engine/src/executors/filter.rs:155 — crates/polars-mem-engine/src/executors/filter.rs:155-165 | crates/polars-mem-engine/src/executors/group_by.rs:118-131 | crates/polars-mem-engine/src/executors/group_by_dynamic.rs:92-102 | crates/polars-mem-engine/src/executors/group_by_rolling.rs:124-134 | crates/polars-mem-engine/src/executors/stack.rs:109-119 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 4+ corresponding lines) crates/polars-compute/src/cast/binary_to.rs:162 — crates/polars-compute/src/cast/binary_to.rs:162-165 | crates/polars-compute/src/cast/primitive_to.rs:342-345 | crates/polars-compute/src/cast/utf8_to.rs:11-14 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:211 — crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs:211-214 | crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:268-271 | crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:299-302 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×2
  • Edited copy of a member (3 corresponding lines) crates/polars-compute/src/rolling/no_nulls/min_max.rs:14 — crates/polars-compute/src/rolling/no_nulls/min_max.rs:14-21 | crates/polars-compute/src/rolling/no_nulls/mod.rs:159-161 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) crates/polars-core/src/frame/group_by/mod.rs:214 — crates/polars-core/src/frame/group_by/mod.rs:214-217 | crates/polars-plan/src/dsl/struct_.rs:86-88 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (41 lines × 2) · ×2
  • Duplicated block (41 lines × 2) crates/polars-plan/src/dsl/function_expr/boolean.rs:61 — crates/polars-plan/src/dsl/function_expr/boolean.rs:61-101 | crates/polars-plan/src/plans/aexpr/function_expr/boolean.rs:128-168 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/boolean.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/boolean.rs` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/boolean.rs:61` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (41 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:502 — crates/polars-plan/src/dsl/function_expr/mod.rs:502-542 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:486-526 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/mod.rs:502` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:528` calls `Fused`, `hash` and `crates/polars-plan/src/dsl/function_expr/mod.rs:544` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (40 lines × 2) · ×2
  • Duplicated block (40 lines × 2) crates/polars-core/src/frame/row/av_buffer.rs:224 — crates/polars-core/src/frame/row/av_buffer.rs:224-263 | crates/polars-core/src/frame/row/av_buffer.rs:700-739 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/row/av_buffer.rs:224` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (40 lines × 2) py-polars/src/polars/expr/binary.py:179 — py-polars/src/polars/expr/binary.py:179-225 | py-polars/src/polars/expr/string.py:1406-1445 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×2
  • Duplicated block (38 lines × 2) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1022 — crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1022-1059 | crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1169-1206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1022` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (38 lines × 2) py-polars/src/polars/dataframe/frame.py:5100 — py-polars/src/polars/dataframe/frame.py:5100-5137 | py-polars/src/polars/lazyframe/frame.py:2967-3004 — `py-polars/src/polars/dataframe/frame.py` and `py-polars/src/polars/lazyframe/frame.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 332 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×2
  • Duplicated block (30 lines × 2) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1184 — crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1184-1213 | crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1280-1309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1184` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1279` calls `temporal_range_output_type`, `clone` and `crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1183` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (30 lines × 2) crates/polars-plan/src/dsl/selector.rs:199 — crates/polars-plan/src/dsl/selector.rs:199-228 | crates/polars-plan/src/dsl/selector.rs:414-443 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21–22 lines × 2) · ×2
  • Duplicated block (21–22 lines × 2) crates/polars-parquet/src/arrow/write/binary/basic.rs:90 — crates/polars-parquet/src/arrow/write/binary/basic.rs:90-111 | crates/polars-parquet/src/arrow/write/binview/basic.rs:88-108 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/binary/basic.rs:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21–22 lines × 2) crates/polars-parquet/src/parquet/schema/io_message/from_message.rs:540 — crates/polars-parquet/src/parquet/schema/io_message/from_message.rs:540-560 | crates/polars-parquet/src/parquet/schema/io_message/from_message.rs:568-589 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/parquet/schema/io_message/from_message.rs:540` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×2
  • Duplicated block (20–21 lines × 2) crates/polars-expr/src/expressions/apply.rs:259 — crates/polars-expr/src/expressions/apply.rs:259-279 | crates/polars-expr/src/expressions/structeval.rs:79-98 — before extracting anything, compare `crates/polars-expr/src/expressions/apply.rs` and `crates/polars-expr/src/expressions/structeval.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20–21 lines × 2) crates/polars-ops/src/chunked_array/list/sets.rs:127 — crates/polars-ops/src/chunked_array/list/sets.rs:127-146 | crates/polars-ops/src/chunked_array/list/sets.rs:229-249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/list/sets.rs:127` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×2
  • Duplicated block (17–20 lines × 2) crates/polars-io/src/cloud/concurrency/admission.rs:103 — crates/polars-io/src/cloud/concurrency/admission.rs:103-122 | crates/polars-io/src/cloud/concurrency/admission.rs:330-346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/cloud/concurrency/admission.rs:103` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17–20 lines × 2) crates/polars-plan/src/plans/optimizer/predicate_pushdown/hive.rs:232 — crates/polars-plan/src/plans/optimizer/predicate_pushdown/hive.rs:232-251 | crates/polars-plan/src/plans/optimizer/predicate_pushdown/hive.rs:275-291 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/optimizer/predicate_pushdown/hive.rs:232` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-plan/src/plans/optimizer/predicate_pushdown/hive.rs:272` calls `deep_clone_ir`, `init_indexmap`, `Some` and `crates/polars-plan/src/plans/optimizer/predicate_pushdown/hive.rs:232` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×2
  • Duplicated block (16–18 lines × 2) crates/polars-ops/src/chunked_array/strings/split.rs:195 — crates/polars-ops/src/chunked_array/strings/split.rs:195-210 | crates/polars-ops/src/chunked_array/strings/split.rs:344-361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/strings/split.rs:195` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16–18 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:41 — crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:41-58 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/mod.rs:39-54 — `crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs` and `crates/polars-stream/src/nodes/io_sinks/writers/ndjson/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 78 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sinks/writers/csv/mod.rs:41` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (16 lines × 4) · ×2
  • Duplicated block (16 lines × 4) crates/polars-parquet/src/arrow/write/mod.rs:762 — crates/polars-parquet/src/arrow/write/mod.rs:762-777 | crates/polars-parquet/src/arrow/write/mod.rs:786-801 | crates/polars-parquet/src/arrow/write/mod.rs:1086-1101 | crates/polars-parquet/src/arrow/write/mod.rs:1112-1127 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (16 lines × 4) crates/polars-python/src/conversion/mod.rs:452 — crates/polars-python/src/conversion/mod.rs:452-467 | crates/polars-python/src/conversion/mod.rs:501-516 | pyo3-polars/pyo3-polars/src/types.rs:528-543 | pyo3-polars/pyo3-polars/src/types.rs:578-593 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×2
  • Duplicated block (16 lines × 3) REDACTED:5049 — REDACTED:5049-5064 | REDACTED:5120-5135 | REDACTED:7365-7380 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:5049` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 3) crates/polars-stream/src/nodes/io_sources/csv/builder.rs:76 — crates/polars-stream/src/nodes/io_sources/csv/builder.rs:76-91 | crates/polars-stream/src/nodes/io_sources/lines.rs:64-79 | crates/polars-stream/src/nodes/io_sources/ndjson/builder.rs:71-86 — before extracting anything, compare `crates/polars-stream/src/nodes/io_sources/csv/builder.rs` and `crates/polars-stream/src/nodes/io_sources/lines.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/csv/builder.rs:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×2
  • Duplicated block (12–16 lines × 2) crates/polars-ops/src/series/ops/replace.rs:253 — crates/polars-ops/src/series/ops/replace.rs:253-268 | crates/polars-ops/src/series/ops/replace.rs:295-306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–16 lines × 2) docs/source/src/rust/user-guide/expressions/folds.rs:57 — docs/source/src/rust/user-guide/expressions/folds.rs:57-72 | docs/source/src/rust/user-guide/expressions/folds.rs:73-84 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/expressions/folds.rs:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `docs/source/src/rust/user-guide/expressions/folds.rs:56` calls `clone` and `docs/source/src/rust/user-guide/expressions/folds.rs:72` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×2
  • Duplicated block (10–13 lines × 2) crates/polars-io/src/utils/byte_source.rs:343 — crates/polars-io/src/utils/byte_source.rs:343-355 | crates/polars-io/src/utils/byte_source.rs:400-409 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–13 lines × 2) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:520 — crates/polars-stream/src/nodes/joins/equi_join/mod.rs:520-529 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:525-537 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join/mod.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 131 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/joins/equi_join/mod.rs:520` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–11 lines × 3) · ×2
  • Duplicated block (10–11 lines × 3) crates/polars-core/src/frame/group_by/aggregations/mod.rs:535 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:535-544 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:716-725 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:819-829 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:535` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 3) docs/source/src/rust/user-guide/concepts/expressions.rs:69 — docs/source/src/rust/user-guide/concepts/expressions.rs:69-78 | docs/source/src/rust/user-guide/getting-started.rs:98-108 | docs/source/src/rust/user-guide/getting-started.rs:110-119 — before extracting anything, compare `docs/source/src/rust/user-guide/concepts/expressions.rs` and `docs/source/src/rust/user-guide/getting-started.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/concepts/expressions.rs:69` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×2
  • Duplicated block (9 lines × 4) crates/polars-core/src/chunked_array/ops/arity.rs:864 — crates/polars-core/src/chunked_array/ops/arity.rs:864-872 | crates/polars-core/src/chunked_array/ops/arity.rs:877-885 | crates/polars-core/src/chunked_array/ops/arity.rs:914-922 | crates/polars-core/src/chunked_array/ops/arity.rs:927-935 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/chunked_array/ops/arity.rs:864` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 4) crates/polars-json/src/json/write/serialize.rs:421 — crates/polars-json/src/json/write/serialize.rs:421-430 | crates/polars-json/src/json/write/serialize.rs:443-452 | crates/polars-json/src/json/write/serialize.rs:465-474 | crates/polars-json/src/json/write/serialize.rs:486-494 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-json/src/json/write/serialize.rs:421` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×2
  • Duplicated block (6 lines × 5) crates/polars-expr/src/reduce/any_all.rs:91 — crates/polars-expr/src/reduce/any_all.rs:91-96 | crates/polars-expr/src/reduce/any_all.rs:190-195 | crates/polars-expr/src/reduce/bitwise.rs:215-220 | crates/polars-expr/src/reduce/min_max.rs:494-499 | crates/polars-expr/src/reduce/min_max.rs:610-615 — before extracting anything, compare `crates/polars-expr/src/reduce/any_all.rs` and `crates/polars-expr/src/reduce/min_max.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/any_all.rs:91` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-expr/src/reduce/bitwise.rs:221` calls `xor_pos_unchecked`, `get_unchecked` and `crates/polars-expr/src/reduce/any_all.rs:97` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 5) crates/polars-expr/src/reduce/count.rs:60 — crates/polars-expr/src/reduce/count.rs:60-65 | crates/polars-expr/src/reduce/count.rs:97-102 | crates/polars-expr/src/reduce/count.rs:230-235 | crates/polars-expr/src/reduce/has_nulls.rs:50-55 | crates/polars-expr/src/reduce/is_empty.rs:57-62 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (4–5 lines × 3) · ×2
  • Duplicated block (4–5 lines × 3) crates/polars-expr/src/reduce/any_all.rs:148 — crates/polars-expr/src/reduce/any_all.rs:148-152 | crates/polars-expr/src/reduce/any_all.rs:375-378 | crates/polars-expr/src/reduce/min_max.rs:446-450 — before extracting anything, compare `crates/polars-expr/src/reduce/any_all.rs` and `crates/polars-expr/src/reduce/min_max.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-expr/src/reduce/any_all.rs:147` calls `dtype`, `as_materialized_series_maintain_scalar` and `crates/polars-expr/src/reduce/any_all.rs:375` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (4–5 lines × 3) crates/polars-stream/src/nodes/dynamic_slice.rs:122 — crates/polars-stream/src/nodes/dynamic_slice.rs:122-126 | crates/polars-stream/src/nodes/joins/in_memory.rs:112-115 | crates/polars-stream/src/nodes/repeat.rs:103-107 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/dynamic_slice.rs:122` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-stream/src/nodes/dynamic_slice.rs:121` calls `is_none` and `crates/polars-stream/src/nodes/repeat.rs:102` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×2
  • Duplicated block (11 lines × 4) crates/polars-ops/src/frame/join/asof/groups.rs:237 — crates/polars-ops/src/frame/join/asof/groups.rs:237-247 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:94-104 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:197-207 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:323-333 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/asof/groups.rs:237` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 4) crates/polars-io/src/csv/write/write_impl/serializer.rs:212 — crates/polars-io/src/csv/write/write_impl/serializer.rs:212-222 | crates/polars-io/src/csv/write/write_impl/serializer.rs:244-254 | crates/polars-io/src/csv/write/write_impl/serializer.rs:278-288 | crates/polars-io/src/csv/write/write_impl/serializer.rs:311-321 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/write/write_impl/serializer.rs:212` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-io/src/csv/write/write_impl/serializer.rs:275` calls `clear` and `crates/polars-io/src/csv/write/write_impl/serializer.rs:209` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D1 · Cyclomatic Complexity · ProjectionPushdownVisitor · ×1
  • ProjectionPushdownVisitor::pushdown (cyclomatic 266) crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:235 — ProjectionPushdownVisitor::pushdown has cyclomatic complexity 266 (threshold 15). Of this number, 261 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FunctionExpr · ×1
  • FunctionExpr::fmt (cyclomatic 129) crates/polars-plan/src/dsl/function_expr/mod.rs:856 — FunctionExpr::fmt has cyclomatic complexity 129 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TypeCoercionRule · ×1
  • TypeCoercionRule::optimize_expr (cyclomatic 124) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:133 — TypeCoercionRule::optimize_expr has cyclomatic complexity 124 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SimplifyIRNodeOrder · ×1
  • SimplifyIRNodeOrder::simplify_ir_node_orders (cyclomatic 118) crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs:124 — SimplifyIRNodeOrder::simplify_ir_node_orders has cyclomatic complexity 118 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IcebergScanResolver._to_dataset_scan_impl (cyclomatic 88) · ×1
  • IcebergScanResolver._to_dataset_scan_impl (cyclomatic 88) py-polars/src/polars/io/iceberg/_dataset.py:410 — IcebergScanResolver._to_dataset_scan_impl has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExprOrderSimplifier · ×1
  • ExprOrderSimplifier::rec (cyclomatic 87) crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:156 — ExprOrderSimplifier::rec has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SlicePushDown · ×1
  • SlicePushDown::pushdown (cyclomatic 80) crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:225 — SlicePushDown::pushdown has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SimplifyExprRule · ×1
  • SimplifyExprRule::optimize_expr (cyclomatic 79) crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:763 — SimplifyExprRule::optimize_expr has cyclomatic complexity 79 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · series.sequence_to_pyseries (cyclomatic 78) · ×1
  • series.sequence_to_pyseries (cyclomatic 78) py-polars/src/polars/_utils/construction/series.py:73 — series.sequence_to_pyseries has cyclomatic complexity 78 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Expr · ×1
  • Expr::fmt (cyclomatic 77) crates/polars-plan/src/dsl/format.rs:34 — Expr::fmt has cyclomatic complexity 77 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Duration · ×1
  • Duration::_parse (cyclomatic 67) crates/polars-defs/src/time/duration.rs:194 — Duration::_parse has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExprIRDisplay · ×1
  • ExprIRDisplay::fmt (cyclomatic 64) crates/polars-plan/src/plans/ir/format.rs:478 — ExprIRDisplay::fmt has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _inference.dtype_from_database_typename (cyclomatic 63) · ×1
  • _inference.dtype_from_database_typename (cyclomatic 63) py-polars/src/polars/io/database/_inference.py:42 — _inference.dtype_from_database_typename has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PredicatePushDown · ×1
  • PredicatePushDown::push_down (cyclomatic 60) crates/polars-plan/src/plans/optimizer/predicate_pushdown/mod.rs:254 — PredicatePushDown::push_down has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SelectionWalker · ×1
  • SelectionWalker::walk_rec (cyclomatic 58) crates/polars-plan/src/plans/optimizer/projection_pushdown/field_pruning.rs:190 — SelectionWalker::walk_rec has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CastColumnsPolicy · ×1
  • CastColumnsPolicy::should_cast_column (cyclomatic 55) crates/polars-plan/src/dsl/file_scan/mod.rs:1050 — CastColumnsPolicy::should_cast_column has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StringFunction · ×1
  • StringFunction::fmt (cyclomatic 52) crates/polars-plan/src/dsl/function_expr/strings.rs:143 — StringFunction::fmt has cyclomatic complexity 52 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · IRStringFunction · ×1
  • IRStringFunction::fmt (cyclomatic 51) crates/polars-plan/src/plans/aexpr/function_expr/strings.rs:331 — IRStringFunction::fmt has cyclomatic complexity 51 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · _write_utils._xl_setup_table_columns (cyclomatic 50) · ×1
  • _write_utils._xl_setup_table_columns (cyclomatic 50) py-polars/src/polars/io/spreadsheet/_write_utils.py:341 — _write_utils._xl_setup_table_columns has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DataFrameJoinOps · ×1
  • DataFrameJoinOps::_join_impl (cyclomatic 48) crates/polars-ops/src/frame/join/mod.rs:132 — DataFrameJoinOps::_join_impl has cyclomatic complexity 48 (threshold 15). Of this number, 46 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IRDotDisplay · ×1
  • IRDotDisplay::_format (cyclomatic 48) crates/polars-plan/src/plans/ir/dot.rs:76 — IRDotDisplay::_format has cyclomatic complexity 48 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DataFrame.write_database (cyclomatic 48) · ×1
  • DataFrame.write_database (cyclomatic 48) py-polars/src/polars/dataframe/frame.py:4485 — DataFrame.write_database has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IpcFileReader · ×1
  • IpcFileReader::begin_read (cyclomatic 46) crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:205 — IpcFileReader::begin_read has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · lit.lit (cyclomatic 46) · ×1
  • lit.lit (cyclomatic 46) py-polars/src/polars/functions/lit.py:39 — lit.lit has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · functions._read_spreadsheet_calamine (cyclomatic 45) · ×1
  • functions._read_spreadsheet_calamine (cyclomatic 45) py-polars/src/polars/io/spreadsheet/functions.py:1031 — functions._read_spreadsheet_calamine has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MergeSortedNode · ×1
  • MergeSortedNode::spawn (cyclomatic 44) crates/polars-stream/src/nodes/merge_sorted.rs:251 — MergeSortedNode::spawn has cyclomatic complexity 44 (threshold 15). Of this number, 43 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReaderStarter · ×1
  • ReaderStarter::run (cyclomatic 43) crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/reader_starter.rs:61 — ReaderStarter::run has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NDJsonFileReader · ×1
  • NDJsonFileReader::begin_read (cyclomatic 40) crates/polars-stream/src/nodes/io_sources/ndjson/mod.rs:90 — NDJsonFileReader::begin_read has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DataTypeSelector · ×1
  • DataTypeSelector::fmt (cyclomatic 39) crates/polars-plan/src/dsl/selector.rs:683 — DataTypeSelector::fmt has cyclomatic complexity 39 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ToArrowConverter · ×1
  • ToArrowConverter::array_to_arrow_impl (cyclomatic 37) crates/polars-core/src/series/arrow_export/mod.rs:155 — ToArrowConverter::array_to_arrow_impl has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IRListFunction · ×1
  • IRListFunction::get_field (cyclomatic 37) crates/polars-plan/src/plans/aexpr/function_expr/list.rs:74 — IRListFunction::get_field has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LazyPolarsSlice.apply (cyclomatic 37) · ×1
  • LazyPolarsSlice.apply (cyclomatic 37) py-polars/src/polars/_utils/slice.py:124 — LazyPolarsSlice.apply has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PySeries · ×1
  • PySeries::to_list::to_list_recursive (cyclomatic 36) crates/polars-python/src/series/export.rs:20 — PySeries::to_list::to_list_recursive has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Selector._by_dtype (cyclomatic 36) · ×1
  • Selector._by_dtype (cyclomatic 36) py-polars/src/polars/selectors.py:359 — Selector._by_dtype has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BinaryExpr · ×1
  • BinaryExpr::evaluate_on_groups_impl (cyclomatic 34) crates/polars-expr/src/expressions/binary.rs:373 — BinaryExpr::evaluate_on_groups_impl has cyclomatic complexity 34 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · TreeFmtNode · ×1
  • TreeFmtNode::node_data (cyclomatic 34) crates/polars-plan/src/plans/ir/tree_format.rs:197 — TreeFmtNode::node_data has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · EquiJoinNode · ×1
  • EquiJoinNode::update_state (cyclomatic 34) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:707 — EquiJoinNode::update_state has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SemiAntiJoinNode · ×1
  • SemiAntiJoinNode::update_state (cyclomatic 34) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1117 — SemiAntiJoinNode::update_state has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InstructionTranslator._expr (cyclomatic 34) · ×1
  • InstructionTranslator._expr (cyclomatic 34) py-polars/src/polars/_utils/udfs.py:740 — InstructionTranslator._expr has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · general._from_dataframe_repr (cyclomatic 34) · ×1
  • general._from_dataframe_repr (cyclomatic 34) py-polars/src/polars/convert/general.py:909 — general._from_dataframe_repr has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Series._comp (cyclomatic 34) · ×1
  • Series._comp (cyclomatic 34) py-polars/src/polars/series/series.py:734 — Series._comp has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ApplyExpr · ×1
  • ApplyExpr::evaluate_on_groups_impl (cyclomatic 33) crates/polars-expr/src/expressions/apply.rs:528 — ApplyExpr::evaluate_on_groups_impl has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DataFrame.write_excel (cyclomatic 33) · ×1
  • DataFrame.write_excel (cyclomatic 33) py-polars/src/polars/dataframe/frame.py:3398 — DataFrame.write_excel has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _partition_evolution.spec_change (cyclomatic 33) · ×1
  • _partition_evolution.spec_change (cyclomatic 33) py-polars/src/polars/io/iceberg/_partition_evolution.py:104 — _partition_evolution.spec_change has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · context._alter_catalog_table (cyclomatic 32) · ×1
  • context._alter_catalog_table (cyclomatic 32) py-polars/src/polars/sql/context.py:2172 — context._alter_catalog_table has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · dataframe.numpy_to_pydf (cyclomatic 31) · ×1
  • dataframe.numpy_to_pydf (cyclomatic 31) py-polars/src/polars/_utils/construction/dataframe.py:1305 — dataframe.numpy_to_pydf has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · functions.read_csv (cyclomatic 31) · ×1
  • functions.read_csv (cyclomatic 31) py-polars/src/polars/io/csv/functions.py:74 — functions.read_csv has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DeltaDataset.to_dataset_scan (cyclomatic 31) · ×1
  • DeltaDataset.to_dataset_scan (cyclomatic 31) REDACTED:116 — DeltaDataset.to_dataset_scan has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DeltaSinkState._commit (cyclomatic 31) · ×1
  • DeltaSinkState._commit (cyclomatic 31) py-polars/src/polars/io/delta/_sink.py:991 — DeltaSinkState._commit has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IRTemporalFunction · ×1
  • IRTemporalFunction::get_field (cyclomatic 30) crates/polars-plan/src/plans/aexpr/function_expr/datetime.rs:84 — IRTemporalFunction::get_field has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: IRTemporalFunction::fmt (cyclomatic 43) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · functions._read_spreadsheet_openpyxl (cyclomatic 30) · ×1
  • functions._read_spreadsheet_openpyxl (cyclomatic 30) py-polars/src/polars/io/spreadsheet/functions.py:1189 — functions._read_spreadsheet_openpyxl has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TreeFmtAExpr · ×1
  • TreeFmtAExpr::fmt (cyclomatic 28) crates/polars-plan/src/plans/ir/tree_format.rs:28 — TreeFmtAExpr::fmt has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DtypeVisitor · ×1
  • DtypeVisitor::visit_rec (cyclomatic 27) crates/polars-core/src/datatypes/dtype.rs:1889 — DtypeVisitor::visit_rec has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: DataType::fmt (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SinkState · ×1
  • SinkState::spawn (cyclomatic 27) crates/polars-stream/src/nodes/group_by/sink.rs:501 — SinkState::spawn has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Shared · ×1
  • Shared::run (cyclomatic 27) crates/polars-stream/src/nodes/joins/equi_join/flush.rs:308 — Shared::run has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · getitem._select_columns (cyclomatic 27) · ×1
  • getitem._select_columns (cyclomatic 27) py-polars/src/polars/_utils/getitem.py:182 — getitem._select_columns has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · eager.concat (cyclomatic 27) · ×1
  • eager.concat (cyclomatic 27) py-polars/src/polars/functions/eager.py:62 — eager.concat has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Series.__init__ (cyclomatic 27) · ×1
  • Series.__init__ (cyclomatic 27) py-polars/src/polars/series/series.py:295 — Series.__init__ has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PartitionDistributor · ×1
  • PartitionDistributor::run (cyclomatic 26) crates/polars-stream/src/nodes/io_sinks/components/partition_distributor.rs:38 — PartitionDistributor::run has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProbePartitions · ×1
  • ProbePartitions::partition_and_probe (cyclomatic 26) crates/polars-stream/src/nodes/joins/equi_join/probe.rs:410 — ProbePartitions::partition_and_probe has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · dataframe._expand_dict_values (cyclomatic 26) · ×1
  • dataframe._expand_dict_values (cyclomatic 26) py-polars/src/polars/_utils/construction/dataframe.py:386 — dataframe._expand_dict_values has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LazyFrame._filter (cyclomatic 26) · ×1
  • LazyFrame._filter (cyclomatic 26) py-polars/src/polars/lazyframe/frame.py:4506 — LazyFrame._filter has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AnyValueBufferTrusted · ×1
  • AnyValueBufferTrusted::add_physical (cyclomatic 25) crates/polars-core/src/frame/row/av_buffer.rs:500 — AnyValueBufferTrusted::add_physical has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AnyValueBuffer::add (cyclomatic 47) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · NumericFixedSizeListOpHelper · ×1
  • NumericFixedSizeListOpHelper::execute_op (cyclomatic 25) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:123 — NumericFixedSizeListOpHelper::execute_op has cyclomatic complexity 25 (threshold 15). Of this number, 21 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · SourcesToFileInfo · ×1
  • SourcesToFileInfo::infer_or_parse (cyclomatic 25) crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1814 — SourcesToFileInfo::infer_or_parse has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CsvFileReader · ×1
  • CsvFileReader::begin_read (cyclomatic 25) crates/polars-stream/src/nodes/io_sources/csv/mod.rs:92 — CsvFileReader::begin_read has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LazyFrame.describe (cyclomatic 25) · ×1
  • LazyFrame.describe (cyclomatic 25) py-polars/src/polars/lazyframe/frame.py:1060 — LazyFrame.describe has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · data.data (cyclomatic 25) · ×1
  • data.data (cyclomatic 25) py-polars/src/polars/testing/parametric/strategies/data.py:446 — data.data has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CoreReader · ×1
  • CoreReader::parse_csv (cyclomatic 24) crates/polars-io/src/csv/read/read_impl.rs:328 — CoreReader::parse_csv has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SplitFields · ×1
  • SplitFields::next (cyclomatic 24) crates/polars-io/src/csv/read/splitfields.rs:241 — SplitFields::next has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LeafRows · ×1
  • LeafRows::collect_run (cyclomatic 24) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs:350 — LeafRows::collect_run has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LineBatchSource · ×1
  • LineBatchSource::run_parallel (cyclomatic 24) crates/polars-stream/src/nodes/io_sources/csv/line_batch_source.rs:75 — LineBatchSource::run_parallel has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RowGroupDecoder · ×1
  • RowGroupDecoder::row_group_data_to_df_prefiltered (cyclomatic 24) crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:682 — RowGroupDecoder::row_group_data_to_df_prefiltered has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ZipNode · ×1
  • ZipNode::spawn (cyclomatic 24) crates/polars-stream/src/nodes/zip.rs:233 — ZipNode::spawn has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DataFrame.__init__ (cyclomatic 24) · ×1
  • DataFrame.__init__ (cyclomatic 24) py-polars/src/polars/dataframe/frame.py:379 — DataFrame.__init__ has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · eager.union (cyclomatic 24) · ×1
  • eager.union (cyclomatic 24) py-polars/src/polars/functions/eager.py:381 — eager.union has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ConnectionExecutor.execute (cyclomatic 24) · ×1
  • ConnectionExecutor.execute (cyclomatic 24) py-polars/src/polars/io/database/_executor.py:561 — ConnectionExecutor.execute has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StrpTimeState · ×1
  • StrpTimeState::parse (cyclomatic 23) crates/polars-core/src/chunked_array/temporal/string/strptime.rs:113 — StrpTimeState::parse has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConcurrencyController · ×1
  • ConcurrencyController::spawn_control_loop (cyclomatic 23) crates/polars-io/src/cloud/concurrency/mod.rs:374 — ConcurrencyController::spawn_control_loop has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PolarsTableFunctions · ×1
  • PolarsTableFunctions::read_csv (cyclomatic 23) crates/polars-sql/src/table_functions.rs:172 — PolarsTableFunctions::read_csv has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PipelineBudget · ×1
  • PipelineBudget::acquire (cyclomatic 23) crates/polars-stream/src/nodes/io_sources/shared/pipeline_budget.rs:434 — PipelineBudget::acquire has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _parse.parse_py_type_into_dtype (cyclomatic 23) · ×1
  • _parse.parse_py_type_into_dtype (cyclomatic 23) py-polars/src/polars/datatypes/_parse.py:80 — _parse.parse_py_type_into_dtype has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · IcebergSinkState.new (cyclomatic 23) · ×1
  • IcebergSinkState.new (cyclomatic 23) py-polars/src/polars/io/iceberg/_sink.py:1240 — IcebergSinkState.new has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · core.series (cyclomatic 23) · ×1
  • core.series (cyclomatic 23) py-polars/src/polars/testing/parametric/strategies/core.py:53 — core.series has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AggMinMaxByExpr · ×1
  • AggMinMaxByExpr::evaluate_on_groups_impl (cyclomatic 22) crates/polars-expr/src/expressions/aggregation.rs:549 — AggMinMaxByExpr::evaluate_on_groups_impl has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · StructEvalExpr · ×1
  • StructEvalExpr::evaluate_on_groups_impl (cyclomatic 22) crates/polars-expr/src/expressions/structeval.rs:261 — StructEvalExpr::evaluate_on_groups_impl has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Inner · ×1
  • Inner::try_open_check_latest (cyclomatic 22) crates/polars-io/src/file_cache/entry.rs:86 — Inner::try_open_check_latest has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MorselStreamReverser · ×1
  • MorselStreamReverser::run (cyclomatic 22) crates/polars-stream/src/nodes/io_sources/ndjson/negative_slice_pass.rs:35 — MorselStreamReverser::run has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LanceScanResolver.resolve_lazyframe (cyclomatic 22) · ×1
  • LanceScanResolver.resolve_lazyframe (cyclomatic 22) py-polars/src/polars/io/lance/_scan_resolver.py:63 — LanceScanResolver.resolve_lazyframe has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PolarsError · ×1
  • PolarsError::wrap_msg (cyclomatic 21) crates/polars-error/src/lib.rs:298 — PolarsError::wrap_msg has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · GatherExpr · ×1
  • GatherExpr::evaluate_on_groups_impl (cyclomatic 21) crates/polars-expr/src/expressions/gather.rs:33 — GatherExpr::evaluate_on_groups_impl has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Parser · ×1
  • Parser::parse_logical_type (cyclomatic 21) crates/polars-parquet/src/parquet/schema/io_message/from_message.rs:509 — Parser::parse_logical_type has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IRDisplay · ×1
  • IRDisplay::_format (cyclomatic 21) crates/polars-plan/src/plans/ir/format.rs:223 — IRDisplay::_format has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · MultiplexerNode · ×1
  • MultiplexerNode::spawn (cyclomatic 21) crates/polars-stream/src/nodes/multiplexer.rs:129 — MultiplexerNode::spawn has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · dataframe.iterable_to_pydf (cyclomatic 21) · ×1
  • dataframe.iterable_to_pydf (cyclomatic 21) py-polars/src/polars/_utils/construction/dataframe.py:1050 — dataframe.iterable_to_pydf has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DataFrame.write_parquet (cyclomatic 21) · ×1
  • DataFrame.write_parquet (cyclomatic 21) py-polars/src/polars/dataframe/frame.py:4219 — DataFrame.write_parquet has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Series.__array_ufunc__ (cyclomatic 21) · ×1
  • Series.__array_ufunc__ (cyclomatic 21) py-polars/src/polars/series/series.py:1523 — Series.__array_ufunc__ has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JsonReader · ×1
  • JsonReader::finish (cyclomatic 20) crates/polars-io/src/json/mod.rs:268 — JsonReader::finish has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StackOptimizer · ×1
  • StackOptimizer::optimize_loop (cyclomatic 20) crates/polars-plan/src/plans/optimizer/stack_opt.rs:19 — StackOptimizer::optimize_loop has cyclomatic complexity 20 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · PySQLContext · ×1
  • PySQLContext::catalog_statement (cyclomatic 20) crates/polars-python/src/sql.rs:141 — PySQLContext::catalog_statement has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MergeJoinNode · ×1
  • MergeJoinNode::update_state (cyclomatic 20) crates/polars-stream/src/nodes/joins/merge_join.rs:179 — MergeJoinNode::update_state has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · functions.scan_csv (cyclomatic 20) · ×1
  • functions.scan_csv (cyclomatic 20) py-polars/src/polars/io/csv/functions.py:559 — functions.scan_csv has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _partition_evolution._validate (cyclomatic 20) · ×1
  • _partition_evolution._validate (cyclomatic 20) py-polars/src/polars/io/iceberg/_partition_evolution.py:287 — _partition_evolution._validate has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · functions._get_sheet_names (cyclomatic 20) · ×1
  • functions._get_sheet_names (cyclomatic 20) py-polars/src/polars/io/spreadsheet/functions.py:784 — functions._get_sheet_names has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LazyFrame.pivot (cyclomatic 20) · ×1
  • LazyFrame.pivot (cyclomatic 20) py-polars/src/polars/lazyframe/frame.py:8229 — LazyFrame.pivot has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LazyFrame.update (cyclomatic 20) · ×1
  • LazyFrame.update (cyclomatic 20) py-polars/src/polars/lazyframe/frame.py:8976 — LazyFrame.update has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ColumnPredicateExpr · ×1
  • ColumnPredicateExpr::new (cyclomatic 19) crates/polars-io/src/predicates.rs:53 — ColumnPredicateExpr::new has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: polars_io::predicates::cast_to_parquet_scalar (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · TreeView · ×1
  • TreeView::from (cyclomatic 19) crates/polars-plan/src/plans/ir/tree_format.rs:637 — TreeView::from has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TreeTraversalImpl · ×1
  • TreeTraversalImpl::traverse_rec (cyclomatic 19) crates/polars-plan/src/traversal/tree_traversal.rs:80 — TreeTraversalImpl::traverse_rec has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BackwardFillNode · ×1
  • BackwardFillNode::spawn (cyclomatic 19) crates/polars-stream/src/nodes/backward_fill.rs:71 — BackwardFillNode::spawn has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ForwardFillNode · ×1
  • ForwardFillNode::spawn (cyclomatic 19) crates/polars-stream/src/nodes/forward_fill.rs:55 — ForwardFillNode::spawn has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · dataframe._post_apply_columns (cyclomatic 19) · ×1
  • dataframe._post_apply_columns (cyclomatic 19) py-polars/src/polars/_utils/construction/dataframe.py:328 — dataframe._post_apply_columns has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RewrittenInstructions._rewrite_functions (cyclomatic 19) · ×1
  • RewrittenInstructions._rewrite_functions (cyclomatic 19) py-polars/src/polars/_utils/udfs.py:1050 — RewrittenInstructions._rewrite_functions has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IcebergSinkState._commit (cyclomatic 19) · ×1
  • IcebergSinkState._commit (cyclomatic 19) py-polars/src/polars/io/iceberg/_sink.py:1659 — IcebergSinkState._commit has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · functions._get_read_options (cyclomatic 19) · ×1
  • functions._get_read_options (cyclomatic 19) py-polars/src/polars/io/spreadsheet/functions.py:730 — functions._get_read_options has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Series._arithmetic (cyclomatic 19) · ×1
  • Series._arithmetic (cyclomatic 19) py-polars/src/polars/series/series.py:1041 — Series._arithmetic has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · context._insert_catalog_table (cyclomatic 19) · ×1
  • context._insert_catalog_table (cyclomatic 19) py-polars/src/polars/sql/context.py:2603 — context._insert_catalog_table has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · context._assignable (cyclomatic 19) · ×1
  • context._assignable (cyclomatic 19) py-polars/src/polars/sql/context.py:2727 — context._assignable has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · KeyRowHashHotGrouper · ×1
  • KeyRowHashHotGrouper::insert_keys (cyclomatic 18) crates/polars-expr/src/hot_groups/key_rows.rs:47 — KeyRowHashHotGrouper::insert_keys has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KneeController · ×1
  • KneeController::step (cyclomatic 18) crates/polars-io/src/cloud/concurrency/knee.rs:645 — KneeController::step has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LineIndexer · ×1
  • LineIndexer::index_lines (cyclomatic 18) crates/polars-io/src/csv/read/field_index.rs:82 — LineIndexer::index_lines has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BooleanDecoder · ×1
  • BooleanDecoder::extend_filtered_with_state (cyclomatic 18) crates/polars-parquet/src/arrow/read/deserialize/boolean.rs:358 — BooleanDecoder::extend_filtered_with_state has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CategoricalDecoder · ×1
  • CategoricalDecoder::unspecialized_predicate_decode (cyclomatic 18) crates/polars-parquet/src/arrow/read/deserialize/categorical.rs:143 — CategoricalDecoder::unspecialized_predicate_decode has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConversionOptimizer · ×1
  • ConversionOptimizer::optimize_exprs (cyclomatic 18) crates/polars-plan/src/plans/conversion/stack_opt.rs:112 — ConversionOptimizer::optimize_exprs has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PhysicalPipe · ×1
  • PhysicalPipe::spawn (cyclomatic 18) crates/polars-stream/src/pipe.rs:244 — PhysicalPipe::spawn has cyclomatic complexity 18 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · GroupByDynamicWindower · ×1
  • GroupByDynamicWindower::insert (cyclomatic 18) crates/polars-time/src/windows/group_by.rs:1093 — GroupByDynamicWindower::insert has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DataFrame.to_torch (cyclomatic 18) · ×1
  • DataFrame.to_torch (cyclomatic 18) py-polars/src/polars/dataframe/frame.py:2378 — DataFrame.to_torch has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _partition_evolution.partition_source (cyclomatic 18) · ×1
  • _partition_evolution.partition_source (cyclomatic 18) py-polars/src/polars/io/iceberg/_partition_evolution.py:41 — _partition_evolution.partition_source has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _sink._partition_key_exprs (cyclomatic 18) · ×1
  • _sink._partition_key_exprs (cyclomatic 18) py-polars/src/polars/io/iceberg/_sink.py:811 — _sink._partition_key_exprs has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Ramp · ×1
  • Ramp::round (cyclomatic 17) crates/polars-io/src/cloud/concurrency/knee.rs:238 — Ramp::round has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · UnionExec · ×1
  • UnionExec::execute (cyclomatic 17) crates/polars-mem-engine/src/executors/union.rs:13 — UnionExec::execute has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Selector · ×1
  • Selector::into_columns (cyclomatic 17) crates/polars-plan/src/dsl/selector.rs:193 — Selector::into_columns has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: DataTypeSelector::matches (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · IRStructFunction · ×1
  • IRStructFunction::get_field (cyclomatic 17) crates/polars-plan/src/plans/aexpr/function_expr/struct_.rs:19 — IRStructFunction::get_field has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · OuterJoinTree · ×1
  • OuterJoinTree::covers (cyclomatic 17) crates/polars-sql/src/subquery.rs:4173 — OuterJoinTree::covers has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ApplyExtraOps · ×1
  • ApplyExtraOps::initialize (cyclomatic 17) crates/polars-stream/src/nodes/io_sources/multi_scan/components/apply_extra_ops.rs:69 — ApplyExtraOps::initialize has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProjectionBuilder · ×1
  • ProjectionBuilder::build_projection (cyclomatic 17) crates/polars-stream/src/nodes/io_sources/multi_scan/components/projection/builder.rs:136 — ProjectionBuilder::build_projection has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CrossJoinNode · ×1
  • CrossJoinNode::spawn (cyclomatic 17) crates/polars-stream/src/nodes/joins/cross_join.rs:143 — CrossJoinNode::spawn has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SortNode · ×1
  • SortNode::partition (cyclomatic 17) crates/polars-stream/src/nodes/sort/mod.rs:167 — SortNode::partition has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · polars_time · ×1
  • polars_time::windows::group_by::update_groups_and_bounds (cyclomatic 17) crates/polars-time/src/windows/group_by.rs:16 — polars_time::windows::group_by::update_groups_and_bounds has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · dataframe._unpack_schema (cyclomatic 17) · ×1
  • dataframe._unpack_schema (cyclomatic 17) py-polars/src/polars/_utils/construction/dataframe.py:172 — dataframe._unpack_schema has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · dataframe._sequence_of_sequence_to_pydf (cyclomatic 17) · ×1
  • dataframe._sequence_of_sequence_to_pydf (cyclomatic 17) py-polars/src/polars/_utils/construction/dataframe.py:601 — dataframe._sequence_of_sequence_to_pydf has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · getitem._convert_np_ndarray_to_indices (cyclomatic 17) · ×1
  • getitem._convert_np_ndarray_to_indices (cyclomatic 17) py-polars/src/polars/_utils/getitem.py:398 — getitem._convert_np_ndarray_to_indices has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · various._cast_repr_strings_with_schema (cyclomatic 17) · ×1
  • various._cast_repr_strings_with_schema (cyclomatic 17) REDACTED:314 — various._cast_repr_strings_with_schema has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · various._get_stack_locals (cyclomatic 17) · ×1
  • various._get_stack_locals (cyclomatic 17) REDACTED:474 — various._get_stack_locals has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DataFrame.write_delta (cyclomatic 17) · ×1
  • DataFrame.write_delta (cyclomatic 17) py-polars/src/polars/dataframe/frame.py:4921 — DataFrame.write_delta has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DeltaSinkState._attach_resolved_sink (cyclomatic 17) · ×1
  • DeltaSinkState._attach_resolved_sink (cyclomatic 17) py-polars/src/polars/io/delta/_sink.py:777 — DeltaSinkState._attach_resolved_sink has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _sink._check_writable (cyclomatic 17) · ×1
  • _sink._check_writable (cyclomatic 17) py-polars/src/polars/io/delta/_sink.py:225 — _sink._check_writable has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _sink._sort_key_exprs (cyclomatic 17) · ×1
  • _sink._sort_key_exprs (cyclomatic 17) py-polars/src/polars/io/iceberg/_sink.py:1039 — _sink._sort_key_exprs has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · functions._initialise_spreadsheet_parser (cyclomatic 17) · ×1
  • functions._initialise_spreadsheet_parser (cyclomatic 17) py-polars/src/polars/io/spreadsheet/functions.py:834 — functions._initialise_spreadsheet_parser has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LazyFrame.sink_delta (cyclomatic 17) · ×1
  • LazyFrame.sink_delta (cyclomatic 17) py-polars/src/polars/lazyframe/frame.py:2742 — LazyFrame.sink_delta has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PrimitiveRangedUniqueState · ×1
  • PrimitiveRangedUniqueState::append (cyclomatic 16) crates/polars-compute/src/unique/primitive.rs:89 — PrimitiveRangedUniqueState::append has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Column · ×1
  • Column::arg_sort (cyclomatic 16) crates/polars-core/src/frame/column/mod.rs:1116 — Column::arg_sort has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SliceExpr · ×1
  • SliceExpr::evaluate_on_groups_impl (cyclomatic 16) crates/polars-expr/src/expressions/slice.rs:102 — SliceExpr::evaluate_on_groups_impl has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SplitLines · ×1
  • SplitLines::next (cyclomatic 16) crates/polars-io/src/csv/read/parser.rs:550 — SplitLines::next has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MatchesToEnd · ×1
  • MatchesToEnd::parse (cyclomatic 16) crates/polars-ops/src/chunked_array/strings/namespace.rs:101 — MatchesToEnd::parse has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RoundSeries · ×1
  • RoundSeries::round (cyclomatic 16) crates/polars-ops/src/series/ops/round.rs:169 — RoundSeries::round has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IntDecoder · ×1
  • IntDecoder::evaluate_predicate (cyclomatic 16) crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:193 — IntDecoder::evaluate_predicate has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RecordBatchDataFetcher · ×1
  • RecordBatchDataFetcher::run (cyclomatic 16) crates/polars-stream/src/nodes/io_sources/ipc/record_batch_data_fetch.rs:88 — RecordBatchDataFetcher::run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DeletionFilesProvider · ×1
  • DeletionFilesProvider::spawn_row_deletions_init (cyclomatic 16) crates/polars-stream/src/nodes/io_sources/multi_scan/components/row_deletions.rs:138 — DeletionFilesProvider::spawn_row_deletions_init has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · FlushState · ×1
  • FlushState::new (cyclomatic 16) crates/polars-stream/src/nodes/joins/equi_join/flush.rs:128 — FlushState::new has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RleNode · ×1
  • RleNode::spawn (cyclomatic 16) crates/polars-stream/src/nodes/rle.rs:74 — RleNode::spawn has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · general._from_series_repr (cyclomatic 16) · ×1
  • general._from_series_repr (cyclomatic 16) py-polars/src/polars/convert/general.py:1067 — general._from_series_repr has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConnectionExecutor._from_arrow (cyclomatic 16) · ×1
  • ConnectionExecutor._from_arrow (cyclomatic 16) py-polars/src/polars/io/database/_executor.py:218 — ConnectionExecutor._from_arrow has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _sink._delta_dtype (cyclomatic 16) · ×1
  • _sink._delta_dtype (cyclomatic 16) py-polars/src/polars/io/delta/_sink.py:91 — _sink._delta_dtype has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LanceFragmentReader.collect_batches (cyclomatic 16) · ×1
  • LanceFragmentReader.collect_batches (cyclomatic 16) py-polars/src/polars/io/lance/_reader.py:143 — LanceFragmentReader.collect_batches has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D17 · Explicit Debt · XxxComment · ×1
  • XxxComment crates/polars-python/src/file.rs:397 — // XXX: we have to clear buffer here. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D2 · Cognitive Complexity · ProjectionPushdownVisitor · ×1
  • ProjectionPushdownVisitor::pushdown (cognitive 525) crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:235 — ProjectionPushdownVisitor::pushdown has cognitive complexity 525 (threshold 15). Drivers by points: if/else 163 (353 pts), loops 32 (84 pts), match/switch 16 (47 pts), boolean chains 41 (nesting depth added 273). Of this number, 518 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TypeCoercionRule · ×1
  • TypeCoercionRule::optimize_expr (cognitive 195) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:133 — TypeCoercionRule::optimize_expr has cognitive complexity 195 (threshold 15). Drivers by points: if/else 47 (105 pts), match/switch 23 (55 pts), loops 8 (21 pts), boolean chains 14 (nesting depth added 103). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · IcebergScanResolver._to_dataset_scan_impl (cognitive 177) · ×1
  • IcebergScanResolver._to_dataset_scan_impl (cognitive 177) py-polars/src/polars/io/iceberg/_dataset.py:410 — IcebergScanResolver._to_dataset_scan_impl has cognitive complexity 177 (threshold 15). Drivers by points: if/else 47 (119 pts), ternaries 13 (21 pts), boolean chains 19, error handling 3 (7 pts), loops 2 (6 pts), match/switch 1 (5 pts) (nesting depth added 92). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimplifyIRNodeOrder · ×1
  • SimplifyIRNodeOrder::simplify_ir_node_orders (cognitive 162) crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs:124 — SimplifyIRNodeOrder::simplify_ir_node_orders has cognitive complexity 162 (threshold 15). Drivers by points: if/else 44 (91 pts), boolean chains 46, match/switch 7 (14 pts), loops 4 (11 pts) (nesting depth added 61). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ExprOrderSimplifier · ×1
  • ExprOrderSimplifier::rec (cognitive 121) crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:156 — ExprOrderSimplifier::rec has cognitive complexity 121 (threshold 15). Drivers by points: if/else 50 (97 pts), match/switch 5 (9 pts), loops 4 (8 pts), boolean chains 7 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CastColumnsPolicy · ×1
  • CastColumnsPolicy::should_cast_column (cognitive 106) crates/polars-plan/src/dsl/file_scan/mod.rs:1050 — CastColumnsPolicy::should_cast_column has cognitive complexity 106 (threshold 15). Drivers by points: if/else 46 (80 pts), match/switch 5 (15 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReaderStarter · ×1
  • ReaderStarter::run (cognitive 106) crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/reader_starter.rs:61 — ReaderStarter::run has cognitive complexity 106 (threshold 15). Drivers by points: if/else 37 (92 pts), match/switch 4 (8 pts), boolean chains 5, loops 1 (nesting depth added 59). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · series.sequence_to_pyseries (cognitive 104) · ×1
  • series.sequence_to_pyseries (cognitive 104) py-polars/src/polars/_utils/construction/series.py:73 — series.sequence_to_pyseries has cognitive complexity 104 (threshold 15). Drivers by points: if/else 37 (64 pts), boolean chains 22, ternaries 5 (13 pts), error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlicePushDown · ×1
  • SlicePushDown::pushdown (cognitive 99) crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:225 — SlicePushDown::pushdown has cognitive complexity 99 (threshold 15). Drivers by points: if/else 44 (79 pts), boolean chains 9, match/switch 5 (7 pts), loops 3 (4 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Duration · ×1
  • Duration::_parse (cognitive 92) crates/polars-defs/src/time/duration.rs:194 — Duration::_parse has cognitive complexity 92 (threshold 15). Drivers by points: if/else 34 (62 pts), loops 6 (13 pts), boolean chains 11, match/switch 3 (6 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InstructionTranslator._expr (cognitive 91) · ×1
  • InstructionTranslator._expr (cognitive 91) py-polars/src/polars/_utils/udfs.py:740 — InstructionTranslator._expr has cognitive complexity 91 (threshold 15). Drivers by points: if/else 18 (58 pts), ternaries 6 (27 pts), boolean chains 6 (nesting depth added 61). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · IpcFileReader · ×1
  • IpcFileReader::begin_read (cognitive 89) crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:205 — IpcFileReader::begin_read has cognitive complexity 89 (threshold 15). Drivers by points: if/else 35 (61 pts), loops 9 (17 pts), match/switch 4 (9 pts), boolean chains 2 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProbePartitions · ×1
  • ProbePartitions::partition_and_probe (cognitive 87) crates/polars-stream/src/nodes/joins/equi_join/probe.rs:410 — ProbePartitions::partition_and_probe has cognitive complexity 87 (threshold 15). Drivers by points: if/else 20 (66 pts), loops 6 (19 pts), boolean chains 2 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SinkState · ×1
  • SinkState::spawn (cognitive 86) crates/polars-stream/src/nodes/group_by/sink.rs:501 — SinkState::spawn has cognitive complexity 86 (threshold 15). Drivers by points: if/else 20 (62 pts), loops 6 (19 pts), boolean chains 5 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _write_utils._xl_setup_table_columns (cognitive 80) · ×1
  • _write_utils._xl_setup_table_columns (cognitive 80) py-polars/src/polars/io/spreadsheet/_write_utils.py:341 — _write_utils._xl_setup_table_columns has cognitive complexity 80 (threshold 15). Drivers by points: if/else 22 (36 pts), ternaries 14 (30 pts), boolean chains 7, loops 7 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFrame.write_database (cognitive 75) · ×1
  • DataFrame.write_database (cognitive 75) py-polars/src/polars/dataframe/frame.py:4485 — DataFrame.write_database has cognitive complexity 75 (threshold 15). Drivers by points: if/else 23 (42 pts), ternaries 8 (18 pts), boolean chains 9, error handling 2 (6 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _inference.dtype_from_database_typename (cognitive 71) · ×1
  • _inference.dtype_from_database_typename (cognitive 71) py-polars/src/polars/io/database/_inference.py:42 — _inference.dtype_from_database_typename has cognitive complexity 71 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 22, ternaries 7 (17 pts), loops 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimplifyExprRule · ×1
  • SimplifyExprRule::optimize_expr (cognitive 70) crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:763 — SimplifyExprRule::optimize_expr has cognitive complexity 70 (threshold 15). Drivers by points: match/switch 13 (39 pts), if/else 16 (29 pts), boolean chains 2 (nesting depth added 39). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · IR · ×1
  • IR::is_ir_equal_shallow (cognitive 68) crates/polars-plan/src/plans/ir/equality.rs:26 — IR::is_ir_equal_shallow has cognitive complexity 68 (threshold 15). Drivers by points: if/else 26 (52 pts), boolean chains 13, match/switch 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CrossJoinNode · ×1
  • CrossJoinNode::spawn (cognitive 64) crates/polars-stream/src/nodes/joins/cross_join.rs:143 — CrossJoinNode::spawn has cognitive complexity 64 (threshold 15). Drivers by points: if/else 10 (38 pts), loops 6 (25 pts), match/switch 1 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExprIRDisplay · ×1
  • ExprIRDisplay::fmt (cognitive 62) crates/polars-plan/src/plans/ir/format.rs:478 — ExprIRDisplay::fmt has cognitive complexity 62 (threshold 15). Drivers by points: if/else 31 (54 pts), match/switch 5 (8 pts) (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · StackOptimizer · ×1
  • StackOptimizer::optimize_loop (cognitive 61) crates/polars-plan/src/plans/optimizer/stack_opt.rs:19 — StackOptimizer::optimize_loop has cognitive complexity 61 (threshold 15). Drivers by points: loops 11 (38 pts), if/else 4 (13 pts), match/switch 2 (8 pts), boolean chains 2 (nesting depth added 42). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · functions._read_spreadsheet_calamine (cognitive 61) · ×1
  • functions._read_spreadsheet_calamine (cognitive 61) py-polars/src/polars/io/spreadsheet/functions.py:1031 — functions._read_spreadsheet_calamine has cognitive complexity 61 (threshold 15). Drivers by points: if/else 26 (47 pts), boolean chains 7, loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ApplyExpr · ×1
  • ApplyExpr::evaluate_on_groups_impl (cognitive 58) crates/polars-expr/src/expressions/apply.rs:528 — ApplyExpr::evaluate_on_groups_impl has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 15, match/switch 2 (6 pts), loops 1 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Expr · ×1
  • Expr::fmt (cognitive 58) crates/polars-plan/src/dsl/format.rs:34 — Expr::fmt has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (42 pts), match/switch 9 (16 pts) (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · NDJsonFileReader · ×1
  • NDJsonFileReader::begin_read (cognitive 58) crates/polars-stream/src/nodes/io_sources/ndjson/mod.rs:90 — NDJsonFileReader::begin_read has cognitive complexity 58 (threshold 15). Drivers by points: if/else 36 (46 pts), boolean chains 6, match/switch 3 (5 pts), loops 1 (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · functions._read_spreadsheet_openpyxl (cognitive 58) · ×1
  • functions._read_spreadsheet_openpyxl (cognitive 58) py-polars/src/polars/io/spreadsheet/functions.py:1189 — functions._read_spreadsheet_openpyxl has cognitive complexity 58 (threshold 15). Drivers by points: if/else 18 (39 pts), ternaries 4 (10 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DataFrameJoinOps · ×1
  • DataFrameJoinOps::_join_impl (cognitive 55) crates/polars-ops/src/frame/join/mod.rs:132 — DataFrameJoinOps::_join_impl has cognitive complexity 55 (threshold 15). Drivers by points: if/else 30 (42 pts), boolean chains 6, match/switch 3 (6 pts), loops 1 (nesting depth added 15). Of this number, 52 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CoreReader · ×1
  • CoreReader::parse_csv (cognitive 53) crates/polars-io/src/csv/read/read_impl.rs:328 — CoreReader::parse_csv has cognitive complexity 53 (threshold 15). Drivers by points: if/else 21 (46 pts), boolean chains 6, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · general._from_dataframe_repr (cognitive 53) · ×1
  • general._from_dataframe_repr (cognitive 53) py-polars/src/polars/convert/general.py:909 — general._from_dataframe_repr has cognitive complexity 53 (threshold 15). Drivers by points: if/else 20 (32 pts), boolean chains 10, loops 5 (7 pts), ternaries 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · lit.lit (cognitive 53) · ×1
  • lit.lit (cognitive 53) py-polars/src/polars/functions/lit.py:39 — lit.lit has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 11, ternaries 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PartitionDistributor · ×1
  • PartitionDistributor::run (cognitive 52) crates/polars-stream/src/nodes/io_sinks/components/partition_distributor.rs:38 — PartitionDistributor::run has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (42 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RewrittenInstructions._rewrite_functions (cognitive 51) · ×1
  • RewrittenInstructions._rewrite_functions (cognitive 51) py-polars/src/polars/_utils/udfs.py:1050 — RewrittenInstructions._rewrite_functions has cognitive complexity 51 (threshold 15). Drivers by points: if/else 8 (28 pts), ternaries 5 (18 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · RowGroupDecoder · ×1
  • RowGroupDecoder::row_group_data_to_df_prefiltered (cognitive 49) crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:682 — RowGroupDecoder::row_group_data_to_df_prefiltered has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (27 pts), match/switch 6 (15 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeltaSinkState._commit (cognitive 49) · ×1
  • DeltaSinkState._commit (cognitive 49) py-polars/src/polars/io/delta/_sink.py:991 — DeltaSinkState._commit has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 9, error handling 3 (5 pts), ternaries 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _partition_evolution.spec_change (cognitive 49) · ×1
  • _partition_evolution.spec_change (cognitive 49) py-polars/src/polars/io/iceberg/_partition_evolution.py:104 — _partition_evolution.spec_change has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (34 pts), loops 9 (12 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dataframe._expand_dict_values (cognitive 48) · ×1
  • dataframe._expand_dict_values (cognitive 48) py-polars/src/polars/_utils/construction/dataframe.py:386 — dataframe._expand_dict_values has cognitive complexity 48 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (9 pts), ternaries 2 (9 pts), boolean chains 8 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DtypeVisitor · ×1
  • DtypeVisitor::visit_rec (cognitive 47) crates/polars-core/src/datatypes/dtype.rs:1889 — DtypeVisitor::visit_rec has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 6 (11 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 25). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · functions.read_csv (cognitive 47) · ×1
  • functions.read_csv (cognitive 47) py-polars/src/polars/io/csv/functions.py:74 — functions.read_csv has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 9, error handling 1 (2 pts), loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TreeView · ×1
  • TreeView::from (cognitive 46) crates/polars-plan/src/plans/ir/tree_format.rs:637 — TreeView::from has cognitive complexity 46 (threshold 15). Drivers by points: if/else 7 (27 pts), loops 7 (14 pts), boolean chains 5 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Series.__array_ufunc__ (cognitive 46) · ×1
  • Series.__array_ufunc__ (cognitive 46) py-polars/src/polars/series/series.py:1523 — Series.__array_ufunc__ has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (35 pts), loops 3 (6 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PrimitiveRangedUniqueState · ×1
  • PrimitiveRangedUniqueState::append (cognitive 45) crates/polars-compute/src/unique/primitive.rs:89 — PrimitiveRangedUniqueState::append has cognitive complexity 45 (threshold 15). Drivers by points: loops 6 (20 pts), if/else 4 (18 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 30). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BinaryExpr · ×1
  • BinaryExpr::evaluate_on_groups_impl (cognitive 45) crates/polars-expr/src/expressions/binary.rs:373 — BinaryExpr::evaluate_on_groups_impl has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 18, loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LineIndexer · ×1
  • LineIndexer::index_lines (cognitive 45) crates/polars-io/src/csv/read/field_index.rs:82 — LineIndexer::index_lines has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 3 (7 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IRDotDisplay · ×1
  • IRDotDisplay::_format (cognitive 44) crates/polars-plan/src/plans/ir/dot.rs:76 — IRDotDisplay::_format has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 6 (15 pts), match/switch 4 (8 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonReader · ×1
  • JsonReader::finish (cognitive 43) crates/polars-io/src/json/mod.rs:268 — JsonReader::finish has cognitive complexity 43 (threshold 15). Drivers by points: if/else 19 (34 pts), match/switch 3 (4 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProjectionBuilder · ×1
  • ProjectionBuilder::build_projection (cognitive 43) crates/polars-stream/src/nodes/io_sources/multi_scan/components/projection/builder.rs:136 — ProjectionBuilder::build_projection has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (24 pts), match/switch 4 (12 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 27). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ConcurrencyController · ×1
  • ConcurrencyController::spawn_control_loop (cognitive 42) crates/polars-io/src/cloud/concurrency/mod.rs:374 — ConcurrencyController::spawn_control_loop has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (24 pts), match/switch 5 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SourcesToFileInfo · ×1
  • SourcesToFileInfo::infer_or_parse (cognitive 42) crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1814 — SourcesToFileInfo::infer_or_parse has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (38 pts), match/switch 2 (4 pts) (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · GroupByDynamicWindower · ×1
  • GroupByDynamicWindower::insert (cognitive 42) crates/polars-time/src/windows/group_by.rs:1093 — GroupByDynamicWindower::insert has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 5 (12 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dataframe.numpy_to_pydf (cognitive 42) · ×1
  • dataframe.numpy_to_pydf (cognitive 42) py-polars/src/polars/_utils/construction/dataframe.py:1305 — dataframe.numpy_to_pydf has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (28 pts), boolean chains 8, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFrame.write_excel (cognitive 42) · ×1
  • DataFrame.write_excel (cognitive 42) py-polars/src/polars/dataframe/frame.py:3398 — DataFrame.write_excel has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 8, loops 4 (8 pts), ternaries 2 (3 pts) (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LineBatchSource · ×1
  • LineBatchSource::run_parallel (cognitive 41) crates/polars-stream/src/nodes/io_sources/csv/line_batch_source.rs:75 — LineBatchSource::run_parallel has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 4 (6 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LazyFrame.describe (cognitive 40) · ×1
  • LazyFrame.describe (cognitive 40) py-polars/src/polars/lazyframe/frame.py:1060 — LazyFrame.describe has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 8 (18 pts), if/else 7 (12 pts), boolean chains 7, loops 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SplitLines · ×1
  • SplitLines::next (cognitive 39) crates/polars-io/src/csv/read/parser.rs:550 — SplitLines::next has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 2 (4 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BackwardFillNode · ×1
  • BackwardFillNode::spawn (cognitive 39) crates/polars-stream/src/nodes/backward_fill.rs:71 — BackwardFillNode::spawn has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (31 pts), loops 5 (8 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KeyRowHashHotGrouper · ×1
  • KeyRowHashHotGrouper::insert_keys (cognitive 38) crates/polars-expr/src/hot_groups/key_rows.rs:47 — KeyRowHashHotGrouper::insert_keys has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 6 (13 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnionExec · ×1
  • UnionExec::execute (cognitive 38) crates/polars-mem-engine/src/executors/union.rs:13 — UnionExec::execute has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConversionOptimizer · ×1
  • ConversionOptimizer::optimize_exprs (cognitive 38) crates/polars-plan/src/plans/conversion/stack_opt.rs:112 — ConversionOptimizer::optimize_exprs has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 5 (12 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PhysicalPipe · ×1
  • PhysicalPipe::spawn (cognitive 38) crates/polars-stream/src/pipe.rs:244 — PhysicalPipe::spawn has cognitive complexity 38 (threshold 15). Drivers by points: loops 8 (19 pts), if/else 5 (18 pts), match/switch 1 (nesting depth added 24). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · _partition_evolution._validate (cognitive 38) · ×1
  • _partition_evolution._validate (cognitive 38) py-polars/src/polars/io/iceberg/_partition_evolution.py:287 — _partition_evolution._validate has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 4 (8 pts), boolean chains 4, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context._alter_catalog_table (cognitive 38) · ×1
  • context._alter_catalog_table (cognitive 38) py-polars/src/polars/sql/context.py:2172 — context._alter_catalog_table has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (28 pts), boolean chains 6, error handling 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleKeyHashHotGrouper · ×1
  • SingleKeyHashHotGrouper::insert_keys (cognitive 37) crates/polars-expr/src/hot_groups/single_key.rs:108 — SingleKeyHashHotGrouper::insert_keys has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 4 (12 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ForwardFillNode · ×1
  • ForwardFillNode::spawn (cognitive 37) crates/polars-stream/src/nodes/forward_fill.rs:55 — ForwardFillNode::spawn has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeletionFilesProvider · ×1
  • DeletionFilesProvider::spawn_row_deletions_init (cognitive 37) crates/polars-stream/src/nodes/io_sources/multi_scan/components/row_deletions.rs:138 — DeletionFilesProvider::spawn_row_deletions_init has cognitive complexity 37 (threshold 15). Drivers by points: loops 5 (17 pts), if/else 6 (15 pts), match/switch 3 (5 pts) (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MorselStreamReverser · ×1
  • MorselStreamReverser::run (cognitive 37) crates/polars-stream/src/nodes/io_sources/ndjson/negative_slice_pass.rs:35 — MorselStreamReverser::run has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (34 pts), loops 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RleNode · ×1
  • RleNode::spawn (cognitive 37) crates/polars-stream/src/nodes/rle.rs:74 — RleNode::spawn has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 3 (9 pts), boolean chains 3, match/switch 1 (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · StrptimeInferNode · ×1
  • StrptimeInferNode::spawn (cognitive 37) crates/polars-stream/src/nodes/strptime_infer.rs:168 — StrptimeInferNode::spawn has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 3 (7 pts), match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · functions._get_sheet_names (cognitive 37) · ×1
  • functions._get_sheet_names (cognitive 37) py-polars/src/polars/io/spreadsheet/functions.py:784 — functions._get_sheet_names has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 7, ternaries 3 (7 pts), loops 2 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ApplyExtraOps · ×1
  • ApplyExtraOps::initialize (cognitive 35) crates/polars-stream/src/nodes/io_sources/multi_scan/components/apply_extra_ops.rs:69 — ApplyExtraOps::initialize has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 4 (10 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 17). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LazyPolarsSlice.apply (cognitive 35) · ×1
  • LazyPolarsSlice.apply (cognitive 35) py-polars/src/polars/_utils/slice.py:124 — LazyPolarsSlice.apply has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 18, ternaries 5 (10 pts), if/else 5 (7 pts) (nesting depth added 7). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · DeltaDataset.to_dataset_scan (cognitive 35) · ×1
  • DeltaDataset.to_dataset_scan (cognitive 35) REDACTED:116 — DeltaDataset.to_dataset_scan has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 11, ternaries 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LeafRows · ×1
  • LeafRows::collect_run (cognitive 34) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs:350 — LeafRows::collect_run has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 4 (7 pts), boolean chains 6, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFrame.write_parquet (cognitive 34) · ×1
  • DataFrame.write_parquet (cognitive 34) py-polars/src/polars/dataframe/frame.py:4219 — DataFrame.write_parquet has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5, ternaries 2 (5 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Series._comp (cognitive 34) · ×1
  • Series._comp (cognitive 34) py-polars/src/polars/series/series.py:734 — Series._comp has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 13, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GatherExpr · ×1
  • GatherExpr::evaluate_on_groups_impl (cognitive 33) crates/polars-expr/src/expressions/gather.rs:33 — GatherExpr::evaluate_on_groups_impl has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CategoricalDecoder · ×1
  • CategoricalDecoder::unspecialized_predicate_decode (cognitive 33) crates/polars-parquet/src/arrow/read/deserialize/categorical.rs:143 — CategoricalDecoder::unspecialized_predicate_decode has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 4 (10 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LazyFrame._filter (cognitive 32) · ×1
  • LazyFrame._filter (cognitive 32) py-polars/src/polars/lazyframe/frame.py:4506 — LazyFrame._filter has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 11, ternaries 5 (8 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Selector._by_dtype (cognitive 32) · ×1
  • Selector._by_dtype (cognitive 32) py-polars/src/polars/selectors.py:359 — Selector._by_dtype has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 4 (14 pts), boolean chains 2, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CsvFileReader · ×1
  • CsvFileReader::begin_read (cognitive 31) crates/polars-stream/src/nodes/io_sources/csv/mod.rs:92 — CsvFileReader::begin_read has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 6 (7 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PipelineBudget · ×1
  • PipelineBudget::acquire (cognitive 31) crates/polars-stream/src/nodes/io_sources/shared/pipeline_budget.rs:434 — PipelineBudget::acquire has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, match/switch 2 (7 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dataframe.iterable_to_pydf (cognitive 31) · ×1
  • dataframe.iterable_to_pydf (cognitive 31) py-polars/src/polars/_utils/construction/dataframe.py:1050 — dataframe.iterable_to_pydf has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StructEvalExpr · ×1
  • StructEvalExpr::evaluate_on_groups_impl (cognitive 30) crates/polars-expr/src/expressions/structeval.rs:261 — StructEvalExpr::evaluate_on_groups_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 9, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StackExec · ×1
  • StackExec::execute_impl (cognitive 30) crates/polars-mem-engine/src/executors/stack.rs:17 — StackExec::execute_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 1 (6 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PartitionMorselSender · ×1
  • PartitionMorselSender::send_morsels (cognitive 30) crates/polars-stream/src/nodes/io_sinks/components/partition_morsel_sender.rs:34 — PartitionMorselSender::send_morsels has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RecordBatchDataFetcher · ×1
  • RecordBatchDataFetcher::run (cognitive 30) crates/polars-stream/src/nodes/io_sources/ipc/record_batch_data_fetch.rs:88 — RecordBatchDataFetcher::run has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SortNode · ×1
  • SortNode::partition (cognitive 30) crates/polars-stream/src/nodes/sort/mod.rs:167 — SortNode::partition has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 10 (15 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Shuffle · ×1
  • Shuffle::run (cognitive 30) crates/polars-stream/src/nodes/window/evaluate.rs:416 — Shuffle::run has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 3 (5 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConnectionExecutor.execute (cognitive 30) · ×1
  • ConnectionExecutor.execute (cognitive 30) py-polars/src/polars/io/database/_executor.py:561 — ConnectionExecutor.execute has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 10, ternaries 3 (5 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LazyFrame.update (cognitive 30) · ×1
  • LazyFrame.update (cognitive 30) py-polars/src/polars/lazyframe/frame.py:8976 — LazyFrame.update has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StrpTimeState · ×1
  • StrpTimeState::parse (cognitive 29) crates/polars-core/src/chunked_array/temporal/string/strptime.rs:113 — StrpTimeState::parse has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (24 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parser · ×1
  • Parser::parse_logical_type (cognitive 29) crates/polars-parquet/src/parquet/schema/io_message/from_message.rs:509 — Parser::parse_logical_type has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (28 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Graph · ×1
  • Graph::update_all_states (cognitive 29) crates/polars-stream/src/graph.rs:99 — Graph::update_all_states has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InterpolateNode · ×1
  • InterpolateNode::spawn (cognitive 29) crates/polars-stream/src/nodes/interpolate.rs:85 — InterpolateNode::spawn has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dataframe._unpack_schema (cognitive 29) · ×1
  • dataframe._unpack_schema (cognitive 29) py-polars/src/polars/_utils/construction/dataframe.py:172 — dataframe._unpack_schema has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 4 (9 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · general._from_series_repr (cognitive 29) · ×1
  • general._from_series_repr (cognitive 29) py-polars/src/polars/convert/general.py:1067 — general._from_series_repr has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 1 (3 pts), ternaries 3, boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeltaSinkState._add_actions (cognitive 29) · ×1
  • DeltaSinkState._add_actions (cognitive 29) py-polars/src/polars/io/delta/_sink.py:878 — DeltaSinkState._add_actions has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (6 pts), boolean chains 4, ternaries 1 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _write_utils._xl_apply_conditional_formats (cognitive 29) · ×1
  • _write_utils._xl_apply_conditional_formats (cognitive 29) py-polars/src/polars/io/spreadsheet/_write_utils.py:116 — _write_utils._xl_apply_conditional_formats has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (16 pts), ternaries 3 (10 pts), loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · core.series (cognitive 29) · ×1
  • core.series (cognitive 29) py-polars/src/polars/testing/parametric/strategies/core.py:53 — core.series has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RoundSeries · ×1
  • RoundSeries::round (cognitive 28) crates/polars-ops/src/series/ops/round.rs:169 — RoundSeries::round has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dataframe._sequence_of_sequence_to_pydf (cognitive 28) · ×1
  • dataframe._sequence_of_sequence_to_pydf (cognitive 28) py-polars/src/polars/_utils/construction/dataframe.py:601 — dataframe._sequence_of_sequence_to_pydf has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 2 (5 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · getitem._convert_series_to_indices (cognitive 28) · ×1
  • getitem._convert_series_to_indices (cognitive 28) py-polars/src/polars/_utils/getitem.py:342 — getitem._convert_series_to_indices has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 2 (8 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eager.concat (cognitive 28) · ×1
  • eager.concat (cognitive 28) py-polars/src/polars/functions/eager.py:62 — eager.concat has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (22 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IcebergSinkState._commit (cognitive 28) · ×1
  • IcebergSinkState._commit (cognitive 28) py-polars/src/polars/io/iceberg/_sink.py:1659 — IcebergSinkState._commit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 3 (6 pts), error handling 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IRStructFunction · ×1
  • IRStructFunction::get_field (cognitive 27) crates/polars-plan/src/plans/aexpr/function_expr/struct_.rs:19 — IRStructFunction::get_field has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 6 (9 pts), loops 1 (4 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · IRDisplay · ×1
  • IRDisplay::_format (cognitive 27) crates/polars-plan/src/plans/ir/format.rs:223 — IRDisplay::_format has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4 (8 pts), match/switch 3 (6 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BuildState · ×1
  • BuildState::finalize (cognitive 27) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:690 — BuildState::finalize has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 6 (11 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShiftNode · ×1
  • ShiftNode::update_state (cognitive 27) crates/polars-stream/src/nodes/shift.rs:173 — ShiftNode::update_state has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SortedUnique · ×1
  • SortedUnique::spawn (cognitive 27) crates/polars-stream/src/nodes/sorted_unique.rs:67 — SortedUnique::spawn has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 5 (9 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eager.union (cognitive 27) · ×1
  • eager.union (cognitive 27) py-polars/src/polars/functions/eager.py:381 — eager.union has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (21 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConnectionExecutor._from_arrow (cognitive 27) · ×1
  • ConnectionExecutor._from_arrow (cognitive 27) py-polars/src/polars/io/database/_executor.py:218 — ConnectionExecutor._from_arrow has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 4 (8 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _partition_evolution.partition_source (cognitive 27) · ×1
  • _partition_evolution.partition_source (cognitive 27) py-polars/src/polars/io/iceberg/_partition_evolution.py:41 — _partition_evolution.partition_source has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 5, ternaries 1 (4 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IcebergSinkState.new (cognitive 27) · ×1
  • IcebergSinkState.new (cognitive 27) py-polars/src/polars/io/iceberg/_sink.py:1240 — IcebergSinkState.new has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 8, ternaries 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Series._arithmetic (cognitive 27) · ×1
  • Series._arithmetic (cognitive 27) py-polars/src/polars/series/series.py:1041 — Series._arithmetic has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BlockUnion · ×1
  • BlockUnion::get (cognitive 26) crates/polars-compute/src/rolling/quantile_filter.rs:457 — BlockUnion::get has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 2 (5 pts), loops 2, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · getitem._select_columns (cognitive 26) · ×1
  • getitem._select_columns (cognitive 26) py-polars/src/polars/_utils/getitem.py:182 — getitem._select_columns has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IcebergSinkState._commit_create (cognitive 26) · ×1
  • IcebergSinkState._commit_create (cognitive 26) py-polars/src/polars/io/iceberg/_sink.py:1822 — IcebergSinkState._commit_create has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 3 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LanceScanResolver.resolve_lazyframe (cognitive 26) · ×1
  • LanceScanResolver.resolve_lazyframe (cognitive 26) py-polars/src/polars/io/lance/_scan_resolver.py:63 — LanceScanResolver.resolve_lazyframe has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 4 (5 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AnyValueBufferTrusted · ×1
  • AnyValueBufferTrusted::add_physical (cognitive 25) crates/polars-core/src/frame/row/av_buffer.rs:500 — AnyValueBufferTrusted::add_physical has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BinviewHashGrouper · ×1
  • BinviewHashGrouper::insert_keys_subset (cognitive 25) crates/polars-expr/src/groups/binview.rs:120 — BinviewHashGrouper::insert_keys_subset has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (25 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleKeyHashGrouper · ×1
  • SingleKeyHashGrouper::insert_impl (cognitive 25) crates/polars-expr/src/groups/single_key.rs:59 — SingleKeyHashGrouper::insert_impl has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (5 pts), match/switch 1 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _sink._check_writable (cognitive 25) · ×1
  • _sink._check_writable (cognitive 25) py-polars/src/polars/io/delta/_sink.py:225 — _sink._check_writable has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _sink._added_conflicting_deletes (cognitive 25) · ×1
  • _sink._added_conflicting_deletes (cognitive 25) py-polars/src/polars/io/iceberg/_sink.py:386 — _sink._added_conflicting_deletes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ListNumericOpHelper · ×1
  • ListNumericOpHelper::_finish_impl (cognitive 24) crates/polars-core/src/series/arithmetic/list.rs:451 — ListNumericOpHelper::_finish_impl has cognitive complexity 24 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 6 (9 pts), match/switch 4 (5 pts) (nesting depth added 10). Most of this is not in the body itself: 7 of the 24 points are its own statements and the rest belongs to 3 function items inside it that branch (check_mismatch_pos, combine_validities_list_to_list_no_broadcast, combine_validities_list_to_list_broadcast_right). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · AggMinMaxByExpr · ×1
  • AggMinMaxByExpr::evaluate_on_groups_impl (cognitive 24) crates/polars-expr/src/expressions/aggregation.rs:549 — AggMinMaxByExpr::evaluate_on_groups_impl has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 9, match/switch 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · EvictionManager · ×1
  • EvictionManager::run_in_background (cognitive 24) crates/polars-io/src/file_cache/eviction.rs:153 — EvictionManager::run_in_background has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (6 pts), match/switch 2 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimpleProjectionAndCollapse · ×1
  • SimpleProjectionAndCollapse::optimize_plan (cognitive 24) crates/polars-plan/src/plans/optimizer/collapse_and_project.rs:33 — SimpleProjectionAndCollapse::optimize_plan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TreeTraversalImpl · ×1
  • TreeTraversalImpl::traverse_rec (cognitive 24) crates/polars-plan/src/traversal/tree_traversal.rs:80 — TreeTraversalImpl::traverse_rec has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 4 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ProbeOutput · ×1
  • ProbeOutput::probe (cognitive 24) crates/polars-stream/src/nodes/joins/equi_join/probe.rs:271 — ProbeOutput::probe has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (8 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BufferedStream · ×1
  • BufferedStream::reinsert (cognitive 24) crates/polars-stream/src/nodes/joins/mod.rs:204 — BufferedStream::reinsert has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (6 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dataframe._post_apply_columns (cognitive 24) · ×1
  • dataframe._post_apply_columns (cognitive 24) py-polars/src/polars/_utils/construction/dataframe.py:328 — dataframe._post_apply_columns has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 6, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RewrittenInstructions._rewrite_methods (cognitive 24) · ×1
  • RewrittenInstructions._rewrite_methods (cognitive 24) py-polars/src/polars/_utils/udfs.py:1152 — RewrittenInstructions._rewrite_methods has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · various._get_stack_locals (cognitive 24) · ×1
  • various._get_stack_locals (cognitive 24) REDACTED:474 — various._get_stack_locals has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · polars_json · ×1
  • polars_json::json::deserialize::deserialize_struct (cognitive 23) crates/polars-json/src/json/deserialize.rs:219 — polars_json::json::deserialize::deserialize_struct has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MergeJoinNode · ×1
  • MergeJoinNode::update_state (cognitive 23) crates/polars-stream/src/nodes/joins/merge_join.rs:179 — MergeJoinNode::update_state has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, loops 1 (3 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ScalarWindowNode · ×1
  • ScalarWindowNode::spawn (cognitive 23) crates/polars-stream/src/nodes/scalar_window.rs:256 — ScalarWindowNode::spawn has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (12 pts), loops 4 (10 pts), match/switch 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ShiftState · ×1
  • ShiftState::shift_positive (cognitive 23) crates/polars-stream/src/nodes/shift.rs:37 — ShiftState::shift_positive has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · functions.scan_csv (cognitive 23) · ×1
  • functions.scan_csv (cognitive 23) py-polars/src/polars/io/csv/functions.py:559 — functions.scan_csv has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · _sink._sort_key_exprs (cognitive 23) · ×1
  • _sink._sort_key_exprs (cognitive 23) py-polars/src/polars/io/iceberg/_sink.py:1039 — _sink._sort_key_exprs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IdentityTransformedPartitionValuesBuilder.__init__ (cognitive 23) · ×1
  • IdentityTransformedPartitionValuesBuilder.__init__ (cognitive 23) py-polars/src/polars/io/iceberg/_utils.py:809 — IdentityTransformedPartitionValuesBuilder.__init__ has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 6, loops 4 (6 pts), error handling 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IdentityTransformedPartitionValuesBuilder.finish (cognitive 23) · ×1
  • IdentityTransformedPartitionValuesBuilder.finish (cognitive 23) py-polars/src/polars/io/iceberg/_utils.py:927 — IdentityTransformedPartitionValuesBuilder.finish has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 3 (10 pts), if/else 4 (9 pts), error handling 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _write_utils._xl_setup_workbook (cognitive 23) · ×1
  • _write_utils._xl_setup_workbook (cognitive 23) py-polars/src/polars/io/spreadsheet/_write_utils.py:585 — _write_utils._xl_setup_workbook has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 2 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context._insert_catalog_table (cognitive 23) · ×1
  • context._insert_catalog_table (cognitive 23) py-polars/src/polars/sql/context.py:2603 — context._insert_catalog_table has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, error handling 2, loops 2, ternaries 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FixedIndexTable · ×1
  • FixedIndexTable::insert_key (cognitive 22) crates/polars-expr/src/hot_groups/fixed_index_table.rs:71 — FixedIndexTable::insert_key has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (22 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PythonScanExec · ×1
  • PythonScanExec::execute (cognitive 22) crates/polars-mem-engine/src/executors/scan/python_scan.rs:54 — PythonScanExec::execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 4 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Levels · ×1
  • Levels::extend (cognitive 22) crates/polars-parquet/src/arrow/write/nested/dremel/mod.rs:75 — Levels::extend has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OuterJoinTree · ×1
  • OuterJoinTree::covers (cognitive 22) crates/polars-sql/src/subquery.rs:4173 — OuterJoinTree::covers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 3, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MorselResizePipeline · ×1
  • MorselResizePipeline::run (cognitive 22) crates/polars-stream/src/nodes/io_sinks/components/morsel_resize_pipeline.rs:30 — MorselResizePipeline::run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnorderedUnionNode · ×1
  • UnorderedUnionNode::spawn (cognitive 22) crates/polars-stream/src/nodes/unordered_union.rs:52 — UnorderedUnionNode::spawn has cognitive complexity 22 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 3 (10 pts) (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · dataframe._establish_dataclass_or_model_schema (cognitive 22) · ×1
  • dataframe._establish_dataclass_or_model_schema (cognitive 22) py-polars/src/polars/_utils/construction/dataframe.py:993 — dataframe._establish_dataclass_or_model_schema has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · getitem._convert_np_ndarray_to_indices (cognitive 22) · ×1
  • getitem._convert_np_ndarray_to_indices (cognitive 22) py-polars/src/polars/_utils/getitem.py:398 — getitem._convert_np_ndarray_to_indices has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFrame.to_torch (cognitive 22) · ×1
  • DataFrame.to_torch (cognitive 22) py-polars/src/polars/dataframe/frame.py:2378 — DataFrame.to_torch has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (6 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFrame.write_delta (cognitive 22) · ×1
  • DataFrame.write_delta (cognitive 22) py-polars/src/polars/dataframe/frame.py:4921 — DataFrame.write_delta has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · functions.read_ipc (cognitive 22) · ×1
  • functions.read_ipc (cognitive 22) py-polars/src/polars/io/ipc/functions.py:57 — functions.read_ipc has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LazyFrame.sink_delta (cognitive 22) · ×1
  • LazyFrame.sink_delta (cognitive 22) py-polars/src/polars/lazyframe/frame.py:2742 — LazyFrame.sink_delta has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Utf8Field · ×1
  • Utf8Field::parse_bytes (cognitive 21) crates/polars-io/src/csv/read/builder.rs:199 — Utf8Field::parse_bytes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataTypeSelector · ×1
  • DataTypeSelector::fmt (cognitive 21) crates/polars-plan/src/dsl/selector.rs:683 — DataTypeSelector::fmt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 2 (7 pts), match/switch 4 (7 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FusedArithmetic · ×1
  • FusedArithmetic::optimize_expr (cognitive 21) crates/polars-plan/src/plans/optimizer/fused.rs:52 — FusedArithmetic::optimize_expr has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Collector · ×1
  • Collector::collect (cognitive 21) crates/polars-plan/src/plans/optimizer/join_order/cluster.rs:496 — Collector::collect has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (6 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroupByNode · ×1
  • GroupByNode::spawn (cognitive 21) crates/polars-stream/src/nodes/group_by/mod.rs:474 — GroupByNode::spawn has cognitive complexity 21 (threshold 15). Drivers by points: loops 3 (11 pts), if/else 2 (9 pts), match/switch 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · KeyFilter · ×1
  • KeyFilter::from_builders (cognitive 21) crates/polars-stream/src/nodes/joins/runtime_filter.rs:343 — KeyFilter::from_builders has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 2 (7 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RollingGroupBy · ×1
  • RollingGroupBy::spawn (cognitive 21) crates/polars-stream/src/nodes/rolling_group_by.rs:251 — RollingGroupBy::spawn has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamingQuery · ×1
  • StreamingQuery::execute (cognitive 21) crates/polars-stream/src/skeleton.rs:214 — StreamingQuery::execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Expr.__array_ufunc__ (cognitive 21) · ×1
  • Expr.__array_ufunc__ (cognitive 21) py-polars/src/polars/expr/expr.py:502 — Expr.__array_ufunc__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (2 pts), boolean chains 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeltaSinkState._attach_resolved_sink (cognitive 21) · ×1
  • DeltaSinkState._attach_resolved_sink (cognitive 21) py-polars/src/polars/io/delta/_sink.py:777 — DeltaSinkState._attach_resolved_sink has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, ternaries 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · functions._csv_buffer_to_frame (cognitive 21) · ×1
  • functions._csv_buffer_to_frame (cognitive 21) py-polars/src/polars/io/spreadsheet/functions.py:904 — functions._csv_buffer_to_frame has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context._create_catalog_table (cognitive 21) · ×1
  • context._create_catalog_table (cognitive 21) py-polars/src/polars/sql/context.py:2335 — context._create_catalog_table has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, ternaries 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Sender · ×1
  • Sender::send (cognitive 20) crates/polars-async/src/primitives/distributor_channel.rs:120 — Sender::send has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (5 pts), match/switch 2 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SliceExpr · ×1
  • SliceExpr::evaluate_on_groups_impl (cognitive 20) crates/polars-expr/src/expressions/slice.rs:102 — SliceExpr::evaluate_on_groups_impl has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 5 (7 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Regime · ×1
  • Regime::step (cognitive 20) crates/polars-io/src/cloud/concurrency/regime.rs:70 — Regime::step has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CountLines · ×1
  • CountLines::count (cognitive 20) crates/polars-io/src/csv/read/parser.rs:904 — CountLines::count has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PyLazyFrame · ×1
  • PyLazyFrame::match_to_schema (cognitive 20) crates/polars-python/src/lazyframe/general.rs:1269 — PyLazyFrame::match_to_schema has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, loops 4 (8 pts) (nesting depth added 4). None of this is in the body itself: all 20 points belong to 4 function items inside it that branch (parse_missing_columns, parse_missing_struct_fields, parse_extra_struct_fields, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · PolarsTableFunctions · ×1
  • PolarsTableFunctions::read_csv (cognitive 20) crates/polars-sql/src/table_functions.rs:172 — PolarsTableFunctions::read_csv has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17, match/switch 2, boolean chains 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · polars_utils · ×1
  • polars_utils::levenshtein::levenshtein (cognitive 20) crates/polars-utils/src/levenshtein.rs:3 — polars_utils::levenshtein::levenshtein has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · functions.read_parquet (cognitive 20) · ×1
  • functions.read_parquet (cognitive 20) py-polars/src/polars/io/parquet/functions.py:87 — functions.read_parquet has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (20 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · functions._initialise_spreadsheet_parser (cognitive 20) · ×1
  • functions._initialise_spreadsheet_parser (cognitive 20) py-polars/src/polars/io/spreadsheet/functions.py:834 — functions._initialise_spreadsheet_parser has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Series.__init__ (cognitive 20) · ×1
  • Series.__init__ (cognitive 20) py-polars/src/polars/series/series.py:295 — Series.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context._drop_catalog_table (cognitive 20) · ×1
  • context._drop_catalog_table (cognitive 20) py-polars/src/polars/sql/context.py:1089 — context._drop_catalog_table has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, error handling 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · data.data (cognitive 20) · ×1
  • data.data (cognitive 20) py-polars/src/polars/testing/parametric/strategies/data.py:446 — data.data has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EwmCovState · ×1
  • EwmCovState::update_iter (cognitive 19) crates/polars-compute/src/ewm/cov.rs:56 — EwmCovState::update_iter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnyValue · ×1
  • AnyValue::strict_cast (cognitive 19) crates/polars-core/src/datatypes/any_value.rs:423 — AnyValue::strict_cast has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 6 (9 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Ramp · ×1
  • Ramp::round (cognitive 19) crates/polars-io/src/cloud/concurrency/knee.rs:238 — Ramp::round has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PolarsObjectStore · ×1
  • PolarsObjectStore::get_ranges_sort (cognitive 19) crates/polars-io/src/cloud/polars_object_store.rs:510 — PolarsObjectStore::get_ranges_sort has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ColumnConstraints · ×1
  • ColumnConstraints::resolve_deferred (cognitive 19) crates/polars-plan/src/plans/aexpr/filter_constraint.rs:409 — ColumnConstraints::resolve_deferred has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExprIR · ×1
  • ExprIR::from_node (cognitive 19) crates/polars-plan/src/plans/expr_ir.rs:123 — ExprIR::from_node has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommonSubExprOptimizer · ×1
  • CommonSubExprOptimizer::find_cse (cognitive 19) crates/polars-plan/src/plans/optimizer/cse/csee.rs:440 — CommonSubExprOptimizer::find_cse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ColumnarFunctionNode · ×1
  • ColumnarFunctionNode::update_state (cognitive 19) crates/polars-stream/src/nodes/columnar_function.rs:50 — ColumnarFunctionNode::update_state has cognitive complexity 19 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 5 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · BatchFnReader · ×1
  • BatchFnReader::begin_read (cognitive 19) crates/polars-stream/src/nodes/io_sources/batch.rs:173 — BatchFnReader::begin_read has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PythonFileReader · ×1
  • PythonFileReader::begin_read (cognitive 19) crates/polars-stream/src/nodes/io_sources/external_python/mod.rs:331 — PythonFileReader::begin_read has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PeakMinMaxNode · ×1
  • PeakMinMaxNode::spawn (cognitive 19) crates/polars-stream/src/nodes/peak_minmax.rs:78 — PeakMinMaxNode::spawn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (6 pts), loops 1 (2 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SelectNode · ×1
  • SelectNode::spawn (cognitive 19) crates/polars-stream/src/nodes/select.rs:52 — SelectNode::spawn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BottomKWithPayload · ×1
  • BottomKWithPayload::add_df (cognitive 19) crates/polars-stream/src/nodes/top_k.rs:129 — BottomKWithPayload::add_df has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BytecodeParser.to_expression (cognitive 19) · ×1
  • BytecodeParser.to_expression (cognitive 19) py-polars/src/polars/_utils/udfs.py:524 — BytecodeParser.to_expression has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IcebergTableWrap._get (cognitive 19) · ×1
  • IcebergTableWrap._get (cognitive 19) py-polars/src/polars/io/iceberg/_dataset.py:158 — IcebergTableWrap._get has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (9 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _utils.filter_for_truncate_overflow (cognitive 19) · ×1
  • _utils.filter_for_truncate_overflow (cognitive 19) py-polars/src/polars/io/iceberg/_utils.py:640 — _utils.filter_for_truncate_overflow has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 pts), error handling 1 (4 pts), ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · core.dataframes (cognitive 19) · ×1
  • core.dataframes (cognitive 19) py-polars/src/polars/testing/parametric/strategies/core.py:297 — core.dataframes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · dtype._parse_dtype_restrictions (cognitive 19) · ×1
  • dtype._parse_dtype_restrictions (cognitive 19) py-polars/src/polars/testing/parametric/strategies/dtype.py:173 — dtype._parse_dtype_restrictions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dtype._instantiate_dtype (cognitive 19) · ×1
  • dtype._instantiate_dtype (cognitive 19) py-polars/src/polars/testing/parametric/strategies/dtype.py:383 — dtype._instantiate_dtype has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KeyRowIdxTable · ×1
  • KeyRowIdxTable::probe_impl (cognitive 18) crates/polars-expr/src/idx_table/key_rows.rs:86 — KeyRowIdxTable::probe_impl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (7 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValueDisplay · ×1
  • ValueDisplay::fmt (cognitive 18) crates/polars-io/src/ndjson/buffer.rs:389 — ValueDisplay::fmt has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (10 pts), match/switch 2 (5 pts), if/else 1 (3 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ListNameSpaceImpl · ×1
  • ListNameSpaceImpl::lst_gather_every (cognitive 18) crates/polars-ops/src/chunked_array/list/namespace.rs:323 — ListNameSpaceImpl::lst_gather_every has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 4 (6 pts), boolean chains 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AsofJoinNearestState · ×1
  • AsofJoinNearestState::next (cognitive 18) crates/polars-ops/src/frame/join/asof/mod.rs:152 — AsofJoinNearestState::next has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3, boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Decoder · ×1
  • Decoder::unspecialized_predicate_decode (cognitive 18) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs:356 — Decoder::unspecialized_predicate_decode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TreeFmtNode · ×1
  • TreeFmtNode::node_data (cognitive 18) crates/polars-plan/src/plans/ir/tree_format.rs:197 — TreeFmtNode::node_data has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (6 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TimeUnitSet · ×1
  • TimeUnitSet::fmt (cognitive 18) crates/polars-plan/src/dsl/selector.rs:75 — TimeUnitSet::fmt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (18 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroupingSets · ×1
  • GroupingSets::aggregate (cognitive 18) crates/polars-sql/src/grouping_sets.rs:243 — GroupingSets::aggregate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · KeyFilterBuilder · ×1
  • KeyFilterBuilder::extend (cognitive 18) crates/polars-stream/src/nodes/joins/runtime_filter.rs:300 — KeyFilterBuilder::extend has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NegativeSliceNode · ×1
  • NegativeSliceNode::update_state (cognitive 18) crates/polars-stream/src/nodes/negative_slice.rs:54 — NegativeSliceNode::update_state has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 2 (6 pts), boolean chains 3, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BytecodeParser._inject_nesting (cognitive 18) · ×1
  • BytecodeParser._inject_nesting (cognitive 18) py-polars/src/polars/_utils/udfs.py:440 — BytecodeParser._inject_nesting has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · InstructionTranslator._containment_kind (cognitive 18) · ×1
  • InstructionTranslator._containment_kind (cognitive 18) py-polars/src/polars/_utils/udfs.py:678 — InstructionTranslator._containment_kind has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · various._cast_repr_strings_with_schema (cognitive 18) · ×1
  • various._cast_repr_strings_with_schema (cognitive 18) REDACTED:314 — various._cast_repr_strings_with_schema has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFrame.row (cognitive 18) · ×1
  • DataFrame.row (cognitive 18) py-polars/src/polars/dataframe/frame.py:11904 — DataFrame.row has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConnectionExecutor._from_rows (cognitive 18) · ×1
  • ConnectionExecutor._from_rows (cognitive 18) py-polars/src/polars/io/database/_executor.py:285 — ConnectionExecutor._from_rows has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _plugin._catalog_storage_options (cognitive 18) · ×1
  • _plugin._catalog_storage_options (cognitive 18) py-polars/src/polars/io/iceberg/_plugin.py:325 — _plugin._catalog_storage_options has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _sink._partition_key_exprs (cognitive 18) · ×1
  • _sink._partition_key_exprs (cognitive 18) py-polars/src/polars/io/iceberg/_sink.py:811 — _sink._partition_key_exprs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _write_utils._xl_inject_dummy_table_columns (cognitive 18) · ×1
  • _write_utils._xl_inject_dummy_table_columns (cognitive 18) py-polars/src/polars/io/spreadsheet/_write_utils.py:232 — _write_utils._xl_inject_dummy_table_columns has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 4 (7 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · functions._get_read_options (cognitive 18) · ×1
  • functions._get_read_options (cognitive 18) py-polars/src/polars/io/spreadsheet/functions.py:730 — functions._get_read_options has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.expr_dispatch (cognitive 18) · ×1
  • utils.expr_dispatch (cognitive 18) py-polars/src/polars/series/utils.py:28 — utils.expr_dispatch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · context._drop_catalog_namespace (cognitive 18) · ×1
  • context._drop_catalog_namespace (cognitive 18) py-polars/src/polars/sql/context.py:2105 — context._drop_catalog_namespace has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 4, boolean chains 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context._assignable (cognitive 18) · ×1
  • context._assignable (cognitive 18) py-polars/src/polars/sql/context.py:2727 — context._assignable has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · DecimalFmtBuffer · ×1
  • DecimalFmtBuffer::format_dec128 (cognitive 17) crates/polars-compute/src/decimal.rs:1226 — DecimalFmtBuffer::format_dec128 has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TimeZone · ×1
  • TimeZone::new_impl (cognitive 17) crates/polars-core/src/datatypes/temporal/time_zone.rs:47 — TimeZone::new_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · RollingExpr · ×1
  • RollingExpr::evaluate_on_groups_impl (cognitive 17) crates/polars-expr/src/expressions/rolling.rs:81 — RollingExpr::evaluate_on_groups_impl has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 3 (5 pts), match/switch 3, boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SortByExpr · ×1
  • SortByExpr::evaluate_on_groups_impl (cognitive 17) crates/polars-expr/src/expressions/sortby.rs:292 — SortByExpr::evaluate_on_groups_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RowEncodedHashGrouper · ×1
  • RowEncodedHashGrouper::probe_partitioned_groupers (cognitive 17) crates/polars-expr/src/groups/row_encoded.rs:121 — RowEncodedHashGrouper::probe_partitioned_groupers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PackedKeys · ×1
  • PackedKeys::escape (cognitive 17) crates/polars-expr/src/packed_keys.rs:632 — PackedKeys::escape has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (4 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CachingResolver · ×1
  • CachingResolver::resolve (cognitive 17) crates/polars-io/src/cloud/dns.rs:137 — CachingResolver::resolve has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 2 (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AdaptiveRateController · ×1
  • AdaptiveRateController::settle_lazy_tick (cognitive 17) crates/polars-io/src/cloud/http_rate_limit.rs:791 — AdaptiveRateController::settle_lazy_tick has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PolarsObjectStoreBuilder · ×1
  • PolarsObjectStoreBuilder::build (cognitive 17) crates/polars-io/src/cloud/object_store_setup.rs:391 — PolarsObjectStoreBuilder::build has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IpcReader · ×1
  • IpcReader::finish (cognitive 17) crates/polars-io/src/ipc/ipc_file.rs:291 — IpcReader::finish has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CoreJsonReader · ×1
  • CoreJsonReader::parse_json (cognitive 17) crates/polars-io/src/ndjson/core.rs:80 — CoreJsonReader::parse_json has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (17 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpillCleaner · ×1
  • SpillCleaner::run (cognitive 17) crates/polars-ooc/src/spill_file.rs:77 — SpillCleaner::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (14 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpillTokenInner · ×1
  • SpillTokenInner::try_spill (cognitive 17) crates/polars-ooc/src/spill_token.rs:713 — SpillTokenInner::try_spill has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (17 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · BinViewDecoder · ×1
  • BinViewDecoder::initialize_predicate_equals_one_of (cognitive 17) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:103 — BinViewDecoder::initialize_predicate_equals_one_of has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IntDecoder · ×1
  • IntDecoder::evaluate_predicate (cognitive 17) crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:193 — IntDecoder::evaluate_predicate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileWriter · ×1
  • FileWriter::end (cognitive 17) crates/polars-parquet/src/parquet/write/file.rs:341 — FileWriter::end has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (8 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Reader · ×1
  • Reader::value (cognitive 17) crates/polars-plan/src/dsl/options/iceberg_properties.rs:228 — Reader::value has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (17 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RecordBatchDecoder · ×1
  • RecordBatchDecoder::record_batch_data_to_df (cognitive 17) crates/polars-stream/src/nodes/io_sources/ipc/record_batch_decode.rs:41 — RecordBatchDecoder::record_batch_data_to_df has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ApplyRowIndexOrLimit · ×1
  • ApplyRowIndexOrLimit::run (cognitive 17) crates/polars-stream/src/nodes/io_sources/ndjson/row_index_limit_pass.rs:22 — ApplyRowIndexOrLimit::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SortedGroupBy · ×1
  • SortedGroupBy::spawn (cognitive 17) crates/polars-stream/src/nodes/sorted_group_by.rs:144 — SortedGroupBy::spawn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RollingWindower · ×1
  • RollingWindower::insert (cognitive 17) crates/polars-time/src/windows/group_by.rs:868 — RollingWindower::insert has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · series.arrow_to_pyseries (cognitive 17) · ×1
  • series.arrow_to_pyseries (cognitive 17) py-polars/src/polars/_utils/construction/series.py:467 — series.arrow_to_pyseries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 1 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · general.from_arrow (cognitive 17) · ×1
  • general.from_arrow (cognitive 17) py-polars/src/polars/convert/general.py:459 — general.from_arrow has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (6 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFrame.__setitem__ (cognitive 17) · ×1
  • DataFrame.__setitem__ (cognitive 17) py-polars/src/polars/dataframe/frame.py:1407 — DataFrame.__setitem__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFrame.to_jax (cognitive 17) · ×1
  • DataFrame.to_jax (cognitive 17) py-polars/src/polars/dataframe/frame.py:2164 — DataFrame.to_jax has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DataFrame.iter_rows (cognitive 17) · ×1
  • DataFrame.iter_rows (cognitive 17) py-polars/src/polars/dataframe/frame.py:12274 — DataFrame.iter_rows has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 4 (6 pts), boolean chains 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Col.__getattr__ (cognitive 17) · ×1
  • Col.__getattr__ (cognitive 17) py-polars/src/polars/functions/col.py:350 — Col.__getattr__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · col._create_col (cognitive 17) · ×1
  • col._create_col (cognitive 17) py-polars/src/polars/functions/col.py:36 — col._create_col has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _utils.predicate_to_pyiceberg_delete_filter (cognitive 17) · ×1
  • _utils.predicate_to_pyiceberg_delete_filter (cognitive 17) py-polars/src/polars/io/iceberg/_utils.py:1423 — _utils.predicate_to_pyiceberg_delete_filter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · functions.scan_iceberg (cognitive 17) · ×1
  • functions.scan_iceberg (cognitive 17) py-polars/src/polars/io/iceberg/functions.py:31 — functions.scan_iceberg has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LanceFragmentReader.collect_batches (cognitive 17) · ×1
  • LanceFragmentReader.collect_batches (cognitive 17) py-polars/src/polars/io/lance/_reader.py:143 — LanceFragmentReader.collect_batches has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 3, loops 2, boolean chains 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · functions._read_parquet_with_pyarrow (cognitive 17) · ×1
  • functions._read_parquet_with_pyarrow (cognitive 17) py-polars/src/polars/io/parquet/functions.py:324 — functions._read_parquet_with_pyarrow has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, ternaries 1 (3 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · functions._sources (cognitive 17) · ×1
  • functions._sources (cognitive 17) py-polars/src/polars/io/spreadsheet/functions.py:53 — functions._sources has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · functions._drop_null_data (cognitive 17) · ×1
  • functions._drop_null_data (cognitive 17) py-polars/src/polars/io/spreadsheet/functions.py:972 — functions._drop_null_data has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · selectors._combine_as_selector (cognitive 17) · ×1
  • selectors._combine_as_selector (cognitive 17) py-polars/src/polars/selectors.py:274 — selectors._combine_as_selector has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context._merge_key_filter (cognitive 17) · ×1
  • context._merge_key_filter (cognitive 17) py-polars/src/polars/sql/context.py:1741 — context._merge_key_filter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (3 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Column · ×1
  • Column::arg_sort (cognitive 16) crates/polars-core/src/frame/column/mod.rs:1116 — Column::arg_sort has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 2). Of this number, 8 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · NumericOp · ×1
  • NumericOp::apply_array_to_scalar (cognitive 16) crates/polars-core/src/series/arithmetic/list_utils.rs:123 — NumericOp::apply_array_to_scalar has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · CovGroupedReduction · ×1
  • CovGroupedReduction::update_groups_while_evicting (cognitive 16) crates/polars-expr/src/reduce/cov.rs:92 — CovGroupedReduction::update_groups_while_evicting has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PearsonCorrGroupedReduction::update_groups_while_evicting) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PearsonCorrGroupedReduction · ×1
  • PearsonCorrGroupedReduction::update_groups_while_evicting (cognitive 16) crates/polars-expr/src/reduce/cov.rs:236 — PearsonCorrGroupedReduction::update_groups_while_evicting has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CovGroupedReduction::update_groups_while_evicting) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · NumSumReducer · ×1
  • NumSumReducer::reduce_ca (cognitive 16) crates/polars-expr/src/reduce/sum.rs:99 — NumSumReducer::reduce_ca has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (10 pts), if/else 4 (6 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · EvictionCandidate · ×1
  • EvictionCandidate::try_evict (cognitive 16) crates/polars-io/src/file_cache/eviction.rs:73 — EvictionCandidate::try_evict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Decompress · ×1
  • Decompress::read_copy (cognitive 16) crates/polars-parquet/src/parquet/snappy.rs:189 — Decompress::read_copy has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MetadataPerSource · ×1
  • MetadataPerSource::gather_reindex (cognitive 16) crates/polars-plan/src/dsl/file_scan/mod.rs:225 — MetadataPerSource::gather_reindex has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (5 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Selector · ×1
  • Selector::into_columns (cognitive 16) crates/polars-plan/src/dsl/selector.rs:193 — Selector::into_columns has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PyDataFrame · ×1
  • PyDataFrame::from_dicts (cognitive 16) crates/polars-python/src/dataframe/construction.rs:94 — PyDataFrame::from_dicts has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (8 pts), if/else 2 (5 pts), match/switch 2, boolean chains 1 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · TargetSinkMorselSize · ×1
  • TargetSinkMorselSize::build_part_sizes_iter (cognitive 16) crates/polars-stream/src/nodes/io_sinks/components/size.rs:256 — TargetSinkMorselSize::build_part_sizes_iter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ParquetFileReader · ×1
  • ParquetFileReader::begin_read (cognitive 16) crates/polars-stream/src/nodes/io_sources/parquet/mod.rs:251 — ParquetFileReader::begin_read has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RowGroupDataFetcher · ×1
  • RowGroupDataFetcher::next (cognitive 16) crates/polars-stream/src/nodes/io_sources/parquet/row_group_data_fetch.rs:195 — RowGroupDataFetcher::next has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 1 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Pass · ×1
  • Pass::decode (cognitive 16) crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:570 — Pass::decode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 5 (6 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsOfJoinNode · ×1
  • AsOfJoinNode::update_state (cognitive 16) crates/polars-stream/src/nodes/joins/asof_join.rs:171 — AsOfJoinNode::update_state has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProbeState · ×1
  • ProbeState::partition_and_probe (cognitive 16) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:872 — ProbeState::partition_and_probe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · polars_testing · ×1
  • polars_testing::asserts::utils::assert_series_values_equal (cognitive 16) crates/polars-testing/src/asserts/utils.rs:296 — polars_testing::asserts::utils::assert_series_values_equal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DataFrame.glimpse (cognitive 16) · ×1
  • DataFrame.glimpse (cognitive 16) py-polars/src/polars/dataframe/frame.py:5861 — DataFrame.glimpse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 1 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _sink._delta_dtype (cognitive 16) · ×1
  • _sink._delta_dtype (cognitive 16) py-polars/src/polars/io/delta/_sink.py:91 — _sink._delta_dtype has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 2, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · LazyFrame.join_asof (cognitive 16) · ×1
  • LazyFrame.join_asof (cognitive 16) py-polars/src/polars/lazyframe/frame.py:5651 — LazyFrame.join_asof has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, ternaries 3 (6 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D3 · God Classes · TooManyFields · ×1
  • TooManyFields: Config crates/polars-config/src/lib.rs:259 — TooManyFields — 50 stored fields beside 54 methods. The bar is 30 stored fields; this is 20 over it, 1.67× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (4 members, 8 shared lines) · ×1
  • Near-duplicate member family (4 members, 8 shared lines) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:25 — crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:25-130 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:138-233 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:241-359 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:366-449 — These 4 members are variants of one another: a block of 8 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 50 shared lines) · ×1
  • Near-duplicate member family (3 members, 50 shared lines) crates/polars-plan/src/plans/aexpr/traverse.rs:14 — crates/polars-plan/src/plans/aexpr/traverse.rs:14-97 | crates/polars-plan/src/plans/aexpr/traverse.rs:107-193 | crates/polars-plan/src/plans/aexpr/traverse.rs:228-309 — These 3 members are variants of one another: a block of 50 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 16 shared lines) · ×1
  • Near-duplicate member family (3 members, 16 shared lines) crates/polars-parquet/src/arrow/read/deserialize/binview/predicate.rs:58 — crates/polars-parquet/src/arrow/read/deserialize/binview/predicate.rs:58-103 | crates/polars-parquet/src/arrow/read/deserialize/binview/predicate.rs:134-181 | crates/polars-parquet/src/arrow/read/deserialize/binview/predicate.rs:188-213 — These 3 members are variants of one another: a block of 16 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 13 shared lines) · ×1
  • Near-duplicate member family (3 members, 13 shared lines) docs/source/src/rust/user-guide/concepts/data-types-and-structures.rs:1 — docs/source/src/rust/user-guide/concepts/data-types-and-structures.rs:1-62 | docs/source/src/rust/user-guide/concepts/expressions.rs:1-137 | docs/source/src/rust/user-guide/getting-started.rs:1-195 — These 3 members are variants of one another: a block of 13 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 5 shared lines) · ×1
  • Near-duplicate member family (3 members, 5 shared lines) crates/polars-ops/src/series/ops/fused.rs:44 — crates/polars-ops/src/series/ops/fused.rs:44-56 | crates/polars-ops/src/series/ops/fused.rs:95-107 | crates/polars-ops/src/series/ops/fused.rs:145-157 — These 3 members are variants of one another: a block of 5 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (298 shared lines) · ×1
  • Near-duplicate member pair (298 shared lines) crates/polars-plan/src/dsl/function_expr/mod.rs:499 — crates/polars-plan/src/dsl/function_expr/mod.rs:499-852 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:483-845 — These two members are variants of one another: 298 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (245 shared lines) · ×1
  • Near-duplicate member pair (245 shared lines) py-polars/src/polars/functions/eager.py:70 — py-polars/src/polars/functions/eager.py:70-378 | py-polars/src/polars/functions/eager.py:387-687 — These two members are variants of one another: 245 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (215 shared lines) · ×1
  • Near-duplicate member pair (215 shared lines) crates/polars-plan/src/dsl/function_expr/mod.rs:856 — crates/polars-plan/src/dsl/function_expr/mod.rs:856-1091 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:877-1114 — These two members are variants of one another: 215 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (188 shared lines) · ×1
  • Near-duplicate member pair (188 shared lines) crates/polars-parquet/src/arrow/write/mod.rs:369 — crates/polars-parquet/src/arrow/write/mod.rs:369-813 | crates/polars-parquet/src/arrow/write/mod.rs:821-1133 — These two members are variants of one another: 188 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (131 shared lines) · ×1
  • Near-duplicate member pair (131 shared lines) crates/polars-io/src/csv/read/streaming.rs:38 — crates/polars-io/src/csv/read/streaming.rs:38-198 | crates/polars-io/src/csv/read/streaming.rs:221-383 — These two members are variants of one another: 131 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (98 shared lines) · ×1
  • Near-duplicate member pair (98 shared lines) crates/polars-plan/src/plans/aexpr/traverse.rs:311 — crates/polars-plan/src/plans/aexpr/traverse.rs:311-421 | crates/polars-plan/src/plans/aexpr/traverse.rs:423-536 — These two members are variants of one another: 98 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (97 shared lines) · ×1
  • Near-duplicate member pair (97 shared lines) crates/polars-plan/src/dsl/function_expr/strings.rs:143 — crates/polars-plan/src/dsl/function_expr/strings.rs:143-249 | crates/polars-plan/src/plans/aexpr/function_expr/strings.rs:331-431 — These two members are variants of one another: 97 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (63 shared lines) · ×1
  • Near-duplicate member pair (63 shared lines) crates/polars-ops/src/chunked_array/list/sets.rs:119 — crates/polars-ops/src/chunked_array/list/sets.rs:119-212 | crates/polars-ops/src/chunked_array/list/sets.rs:222-313 — These two members are variants of one another: 63 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (48 shared lines) · ×1
  • Near-duplicate member pair (48 shared lines) crates/polars-ops/src/series/ops/is_in/mod.rs:344 — crates/polars-ops/src/series/ops/is_in/mod.rs:344-420 | crates/polars-ops/src/series/ops/is_in/mod.rs:432-508 — These two members are variants of one another: 48 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (44 shared lines) · ×1
  • Near-duplicate member pair (44 shared lines) crates/polars-core/src/frame/group_by/aggregations/mod.rs:580 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:580-682 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:761-865 — These two members are variants of one another: 44 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (42 shared lines) · ×1
  • Near-duplicate member pair (42 shared lines) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:222 — crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:222-341 | crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:353-505 — These two members are variants of one another: 42 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (39 shared lines) · ×1
  • Near-duplicate member pair (39 shared lines) crates/polars-expr/src/expressions/apply.rs:254 — crates/polars-expr/src/expressions/apply.rs:254-345 | crates/polars-expr/src/expressions/structeval.rs:74-158 — These two members are variants of one another: 39 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (36 shared lines) · ×1
  • Near-duplicate member pair (36 shared lines) crates/polars-core/src/chunked_array/comparison/mod.rs:658 — crates/polars-core/src/chunked_array/comparison/mod.rs:658-732 | crates/polars-core/src/chunked_array/comparison/mod.rs:902-966 — These two members are variants of one another: 36 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (35 shared lines) · ×1
  • Near-duplicate member pair (35 shared lines) crates/polars-ops/src/chunked_array/list/namespace.rs:409 — crates/polars-ops/src/chunked_array/list/namespace.rs:409-465 | crates/polars-ops/src/chunked_array/list/namespace.rs:474-541 — These two members are variants of one another: 35 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (33 shared lines) · ×1
  • Near-duplicate member pair (33 shared lines) crates/polars-ops/src/series/ops/ewm.rs:65 — crates/polars-ops/src/series/ops/ewm.rs:65-113 | crates/polars-ops/src/series/ops/ewm.rs:115-163 — These two members are variants of one another: 33 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (26 shared lines) · ×1
  • Near-duplicate member pair (26 shared lines) crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:219 — crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:219-302 | crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:322-378 — These two members are variants of one another: 26 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (25 shared lines) · ×1
  • Near-duplicate member pair (25 shared lines) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1310 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1310-1353 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1354-1398 — These two members are variants of one another: 25 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (23 shared lines) · ×1
  • Near-duplicate member pair (23 shared lines) crates/polars-expr/src/dispatch/groups_dispatch.rs:83 — crates/polars-expr/src/dispatch/groups_dispatch.rs:83-133 | crates/polars-expr/src/dispatch/groups_dispatch.rs:140-186 — These two members are variants of one another: 23 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (8 members, 50+ identical tokens) crates/polars-expr/src/reduce/any_all.rs:90 — crates/polars-expr/src/reduce/any_all.rs:90-101 | crates/polars-expr/src/reduce/any_all.rs:189-200 | crates/polars-expr/src/reduce/any_all.rs:301-314 | crates/polars-expr/src/reduce/any_all.rs:427-440 | crates/polars-expr/src/reduce/bitwise.rs:214-227 | crates/polars-expr/src/reduce/is_empty.rs:91-102 | crates/polars-expr/src/reduce/min_max.rs:493-506 | crates/polars-expr/src/reduce/min_max.rs:609-622 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (7 members, 50+ identical tokens) crates/polars-expr/src/reduce/any_all.rs:63 — crates/polars-expr/src/reduce/any_all.rs:63-83 | crates/polars-expr/src/reduce/any_all.rs:162-182 | crates/polars-expr/src/reduce/any_all.rs:268-294 | crates/polars-expr/src/reduce/any_all.rs:394-420 | crates/polars-expr/src/reduce/bitwise.rs:184-207 | crates/polars-expr/src/reduce/min_max.rs:463-486 | crates/polars-expr/src/reduce/min_max.rs:579-602 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Edited copy of a member (236 corresponding lines) · ×1
  • Edited copy of a member (236 corresponding lines) crates/polars-plan/src/dsl/serializable_plan.rs:208 — crates/polars-plan/src/dsl/serializable_plan.rs:208-443 | crates/polars-plan/src/dsl/serializable_plan.rs:497-735 — These two members are one piece of code written twice and then edited apart: 236 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (159 corresponding lines) · ×1
  • Edited copy of a member (159 corresponding lines) crates/polars-python/src/conversion/mod.rs:250 — crates/polars-python/src/conversion/mod.rs:250-418 | pyo3-polars/pyo3-polars/src/types.rs:338-496 — These two members are one piece of code written twice and then edited apart: 159 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (111 corresponding lines) · ×1
  • Edited copy of a member (111 corresponding lines) crates/polars-core/src/frame/row/av_buffer.rs:168 — crates/polars-core/src/frame/row/av_buffer.rs:168-278 | crates/polars-core/src/frame/row/av_buffer.rs:673-792 — These two members are one piece of code written twice and then edited apart: 111 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (132 corresponding lines) · ×1
  • Edited copy of a member (132 corresponding lines) crates/polars-ops/src/chunked_array/gather/chunked.rs:490 — crates/polars-ops/src/chunked_array/gather/chunked.rs:490-621 | crates/polars-ops/src/chunked_array/gather/chunked.rs:694-841 — These two members are one piece of code written twice and then edited apart: 132 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (150 corresponding lines) · ×1
  • Edited copy of a member (150 corresponding lines) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:712 — crates/polars-stream/src/nodes/joins/equi_join/mod.rs:712-861 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1122-1273 — These two members are one piece of code written twice and then edited apart: 150 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (94 corresponding lines) · ×1
  • Edited copy of a member (94 corresponding lines) crates/polars-ops/src/chunked_array/gather/chunked.rs:158 — crates/polars-ops/src/chunked_array/gather/chunked.rs:158-251 | crates/polars-ops/src/chunked_array/gather/chunked.rs:258-351 — These two members are one piece of code written twice and then edited apart: 94 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (123 corresponding lines) · ×1
  • Edited copy of a member (123 corresponding lines) crates/polars-io/src/csv/read/streaming.rs:402 — crates/polars-io/src/csv/read/streaming.rs:402-524 | crates/polars-io/src/csv/read/streaming.rs:538-661 — These two members are one piece of code written twice and then edited apart: 123 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×1
  • Edited copy of a member (52 corresponding lines) crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:43 — crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:43-94 | crates/polars-ops/src/frame/join/hash_join/sort_merge.rs:127-178 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (71 corresponding lines) · ×1
  • Edited copy of a member (71 corresponding lines) crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:92 — crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:92-162 | crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs:174-264 — These two members are one piece of code written twice and then edited apart: 71 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (63 corresponding lines) · ×1
  • Edited copy of a member (63 corresponding lines) crates/polars-ops/src/chunked_array/strings/split.rs:164 — crates/polars-ops/src/chunked_array/strings/split.rs:164-226 | crates/polars-ops/src/chunked_array/strings/split.rs:309-392 — These two members are one piece of code written twice and then edited apart: 63 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (54 corresponding lines) · ×1
  • Edited copy of a member (54 corresponding lines) crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:369 — crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:369-422 | crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:425-480 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (56 corresponding lines) · ×1
  • Edited copy of a member (56 corresponding lines) crates/polars-ops/src/series/ops/cut.rs:13 — crates/polars-ops/src/series/ops/cut.rs:13-68 | crates/polars-ops/src/series/ops/cut.rs:76-133 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (246 corresponding lines) · ×1
  • Edited copy of a member (246 corresponding lines) py-polars/src/polars/dataframe/frame.py:4933 — py-polars/src/polars/dataframe/frame.py:4933-5178 | py-polars/src/polars/lazyframe/frame.py:2756-3051 — These two members are one piece of code written twice and then edited apart: 246 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 28+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 28+ corresponding lines) crates/polars-ops/src/chunked_array/array/sum_mean.rs:33 — crates/polars-ops/src/chunked_array/array/sum_mean.rs:33-61 | crates/polars-ops/src/chunked_array/list/min_max.rs:46-74 | crates/polars-ops/src/chunked_array/list/min_max.rs:164-192 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:43-71 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:195-222 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (57 corresponding lines) · ×1
  • Edited copy of a member (57 corresponding lines) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:346 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:346-402 | crates/polars-core/src/series/arithmetic/list.rs:338-416 — These two members are one piece of code written twice and then edited apart: 57 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (49 corresponding lines) · ×1
  • Edited copy of a member (49 corresponding lines) crates/polars-expr/src/dispatch/strings.rs:643 — crates/polars-expr/src/dispatch/strings.rs:643-701 | crates/polars-expr/src/dispatch/strings.rs:709-757 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 42+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 42+ corresponding lines) crates/polars-time/src/windows/group_by.rs:291 — crates/polars-time/src/windows/group_by.rs:291-334 | crates/polars-time/src/windows/group_by.rs:349-390 | crates/polars-time/src/windows/group_by.rs:422-465 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 42 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (50 corresponding lines) · ×1
  • Edited copy of a member (50 corresponding lines) crates/polars-io/src/cloud/options.rs:629 — crates/polars-io/src/cloud/options.rs:629-683 | crates/polars-io/src/cloud/options.rs:704-753 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 40+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 40+ corresponding lines) crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:106 — crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:106-164 | crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:189-228 | crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:587-643 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 40 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 38+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 38+ corresponding lines) crates/polars-stream/src/nodes/io_sources/csv/builder.rs:105 — crates/polars-stream/src/nodes/io_sources/csv/builder.rs:105-144 | crates/polars-stream/src/nodes/io_sources/lines.rs:97-142 | crates/polars-stream/src/nodes/io_sources/ndjson/builder.rs:104-141 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 38 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (44 corresponding lines) · ×1
  • Edited copy of a member (44 corresponding lines) crates/polars-expr/src/dispatch/groups_dispatch.rs:982 — crates/polars-expr/src/dispatch/groups_dispatch.rs:982-1031 | crates/polars-expr/src/dispatch/groups_dispatch.rs:1039-1082 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 23+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 23+ corresponding lines) crates/polars-ops/src/chunked_array/binary/slice.rs:171 — crates/polars-ops/src/chunked_array/binary/slice.rs:171-193 | crates/polars-ops/src/chunked_array/binary/slice.rs:195-217 | crates/polars-ops/src/chunked_array/strings/substring.rs:306-331 | crates/polars-ops/src/chunked_array/strings/substring.rs:333-359 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (8 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (8 members, 15+ corresponding lines) crates/polars-core/src/series/comparison.rs:422 — crates/polars-core/src/series/comparison.rs:422-436 | crates/polars-core/src/series/comparison.rs:438-456 | crates/polars-core/src/series/comparison.rs:458-472 | crates/polars-core/src/series/comparison.rs:474-488 | crates/polars-core/src/series/comparison.rs:494-510 | crates/polars-core/src/series/comparison.rs:512-528 | crates/polars-core/src/series/comparison.rs:530-546 | crates/polars-core/src/series/comparison.rs:548-564 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 34+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 34+ corresponding lines) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:360 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:360-393 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:397-433 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:441-474 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:478-514 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 26+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 26+ corresponding lines) py-polars/src/polars/dataframe/group_by.py:170 — py-polars/src/polars/dataframe/group_by.py:170-221 | py-polars/src/polars/dataframe/group_by.py:955-980 | py-polars/src/polars/dataframe/group_by.py:1156-1183 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 33+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 33+ corresponding lines) crates/polars-core/src/chunked_array/mod.rs:283 — crates/polars-core/src/chunked_array/mod.rs:283-315 | crates/polars-core/src/chunked_array/mod.rs:318-350 | crates/polars-core/src/chunked_array/mod.rs:353-385 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 33 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 21+ corresponding lines) crates/polars-stream/src/nodes/dynamic_group_by.rs:284 — crates/polars-stream/src/nodes/dynamic_group_by.rs:284-308 | crates/polars-stream/src/nodes/peak_minmax.rs:56-76 | crates/polars-stream/src/nodes/rolling_group_by.rs:225-249 | crates/polars-stream/src/nodes/sorted_group_by.rs:119-142 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 25+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 25+ corresponding lines) crates/polars-core/src/chunked_array/comparison/mod.rs:24 — crates/polars-core/src/chunked_array/comparison/mod.rs:24-48 | crates/polars-core/src/chunked_array/comparison/mod.rs:50-74 | crates/polars-core/src/chunked_array/comparison/mod.rs:76-100 | crates/polars-core/src/chunked_array/comparison/mod.rs:102-126 | crates/polars-core/src/chunked_array/comparison/mod.rs:136-160 | crates/polars-core/src/chunked_array/comparison/mod.rs:162-186 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 30+ corresponding lines) crates/polars-compute/src/rolling/moment.rs:323 — crates/polars-compute/src/rolling/moment.rs:323-352 | crates/polars-compute/src/rolling/sum.rs:184-213 | crates/polars-compute/src/rolling/window.rs:148-177 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 21+ corresponding lines) crates/polars-parquet/src/arrow/write/fixed_size_binary/mod.rs:36 — crates/polars-parquet/src/arrow/write/fixed_size_binary/mod.rs:36-56 | crates/polars-parquet/src/arrow/write/fixed_size_binary/mod.rs:62-87 | crates/polars-parquet/src/arrow/write/fixed_size_binary/mod.rs:99-125 | crates/polars-parquet/src/arrow/write/fixed_size_binary/mod.rs:132-158 | crates/polars-parquet/src/arrow/write/fixed_size_binary/mod.rs:165-191 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 16+ corresponding lines) crates/polars-core/src/datatypes/dtype.rs:795 — crates/polars-core/src/datatypes/dtype.rs:795-810 | crates/polars-core/src/datatypes/dtype.rs:812-830 | crates/polars-core/src/datatypes/dtype.rs:832-848 | crates/polars-core/src/datatypes/dtype.rs:850-866 | crates/polars-core/src/datatypes/dtype.rs:884-902 | crates/polars-core/src/datatypes/dtype.rs:904-919 | crates/polars-core/src/datatypes/dtype.rs:921-942 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 54+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 54+ corresponding lines) py-polars/src/polars/dataframe/frame.py:519 — py-polars/src/polars/dataframe/frame.py:519-575 | py-polars/src/polars/expr/expr.py:574-627 | py-polars/src/polars/lazyframe/frame.py:500-560 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 54 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (95 corresponding lines) · ×1
  • Edited copy of a member (95 corresponding lines) py-polars/src/polars/io/spreadsheet/functions.py:273 — py-polars/src/polars/io/spreadsheet/functions.py:273-435 | py-polars/src/polars/io/spreadsheet/functions.py:554-648 — These two members are one piece of code written twice and then edited apart: 95 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 14+ corresponding lines) crates/polars-core/src/chunked_array/ops/arity.rs:257 — crates/polars-core/src/chunked_array/ops/arity.rs:257-270 | crates/polars-core/src/chunked_array/ops/arity.rs:334-347 | crates/polars-core/src/chunked_array/ops/arity.rs:700-715 | crates/polars-core/src/chunked_array/ops/arity.rs:741-756 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (172 corresponding lines) · ×1
  • Edited copy of a member (172 corresponding lines) py-polars/src/polars/lazyframe/frame.py:3308 — py-polars/src/polars/lazyframe/frame.py:3308-3487 | py-polars/src/polars/lazyframe/frame.py:3918-4089 — These two members are one piece of code written twice and then edited apart: 172 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (76 corresponding lines) · ×1
  • Edited copy of a member (76 corresponding lines) py-polars/src/polars/selectors.py:1017 — py-polars/src/polars/selectors.py:1017-1092 | py-polars/src/polars/selectors.py:1200-1289 — These two members are one piece of code written twice and then edited apart: 76 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (42 corresponding lines) · ×1
  • Edited copy of a member (42 corresponding lines) py-polars/src/polars/dataframe/group_by.py:1047 — py-polars/src/polars/dataframe/group_by.py:1047-1088 | py-polars/src/polars/dataframe/group_by.py:1258-1302 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 1+ corresponding lines) crates/polars-io/src/catalog/unity/client.rs:361 — crates/polars-io/src/catalog/unity/client.rs:361-361 | crates/polars-io/src/catalog/unity/client.rs:364-364 | crates/polars-io/src/catalog/unity/client.rs:367-367 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (61 corresponding lines) · ×1
  • Edited copy of a member (61 corresponding lines) py-polars/src/polars/expr/expr.py:11410 — py-polars/src/polars/expr/expr.py:11410-11471 | py-polars/src/polars/expr/list.py:203-263 — These two members are one piece of code written twice and then edited apart: 61 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (72 corresponding lines) · ×1
  • Edited copy of a member (72 corresponding lines) py-polars/src/polars/expr/expr.py:3108 — py-polars/src/polars/expr/expr.py:3108-3181 | py-polars/src/polars/lazyframe/frame.py:6523-6594 — These two members are one piece of code written twice and then edited apart: 72 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 6+ corresponding lines) crates/polars-expr/src/reduce/bitwise.rs:238 — crates/polars-expr/src/reduce/bitwise.rs:238-243 | crates/polars-expr/src/reduce/min_max.rs:517-522 | crates/polars-expr/src/reduce/min_max.rs:633-638 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 8+ corresponding lines) crates/polars-compute/src/filter/avx512.rs:54 — crates/polars-compute/src/filter/avx512.rs:54-63 | crates/polars-compute/src/filter/avx512.rs:74-81 | crates/polars-compute/src/filter/avx512.rs:91-98 | crates/polars-compute/src/filter/avx512.rs:108-115 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 9+ corresponding lines) crates/polars-sql/src/functions.rs:2658 — crates/polars-sql/src/functions.rs:2658-2667 | crates/polars-sql/src/functions.rs:3019-3029 | crates/polars-sql/src/functions.rs:3032-3040 | crates/polars-sql/src/functions.rs:3195-3203 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 58+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 58+ corresponding lines) py-polars/src/polars/functions/lazy.py:1555 — py-polars/src/polars/functions/lazy.py:1555-1628 | py-polars/src/polars/functions/lazy.py:1640-1711 | py-polars/src/polars/functions/lazy.py:1721-1778 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 58 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (146 corresponding lines) · ×1
  • Edited copy of a member (146 corresponding lines) py-polars/src/polars/lazyframe/frame.py:4602 — py-polars/src/polars/lazyframe/frame.py:4602-4769 | py-polars/src/polars/lazyframe/frame.py:4782-4927 — These two members are one piece of code written twice and then edited apart: 146 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 10+ corresponding lines) crates/polars-core/src/series/mod.rs:311 — crates/polars-core/src/series/mod.rs:311-320 | crates/polars-core/src/series/mod.rs:325-334 | crates/polars-core/src/series/mod.rs:344-353 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (69 corresponding lines) · ×1
  • Edited copy of a member (69 corresponding lines) py-polars/src/polars/testing/asserts/frame.py:172 — py-polars/src/polars/testing/asserts/frame.py:172-240 | py-polars/src/polars/testing/asserts/series.py:160-228 — These two members are one piece of code written twice and then edited apart: 69 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 5+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 5+ corresponding lines) crates/polars-plan/src/dsl/functions/concat.rs:108 — crates/polars-plan/src/dsl/functions/concat.rs:108-117 | crates/polars-plan/src/dsl/functions/concat.rs:120-129 | crates/polars-plan/src/dsl/functions/concat.rs:146-150 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 14+ corresponding lines) crates/polars-utils/src/clmul.rs:42 — crates/polars-utils/src/clmul.rs:42-55 | crates/polars-utils/src/clmul.rs:64-77 | crates/polars-utils/src/clmul.rs:89-102 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 7+ corresponding lines) crates/polars-core/src/frame/mod.rs:120 — crates/polars-core/src/frame/mod.rs:120-129 | crates/polars-core/src/frame/mod.rs:131-137 | crates/polars-core/src/frame/mod.rs:142-151 | crates/polars-core/src/frame/mod.rs:153-159 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 7+ corresponding lines) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:233 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:233-239 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:244-255 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:326-337 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:341-352 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:522-535 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:539-552 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 12+ corresponding lines) crates/polars-stream/src/physical_plan/lower_expr.rs:2975 — crates/polars-stream/src/physical_plan/lower_expr.rs:2975-2986 | crates/polars-stream/src/physical_plan/lower_expr.rs:2996-3007 | crates/polars-stream/src/physical_plan/lower_expr.rs:3281-3292 | crates/polars-stream/src/physical_plan/lower_ir.rs:101-112 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (86 corresponding lines) · ×1
  • Edited copy of a member (86 corresponding lines) py-polars/src/polars/expr/expr.py:2967 — py-polars/src/polars/expr/expr.py:2967-3100 | py-polars/src/polars/functions/lazy.py:1932-2017 — These two members are one piece of code written twice and then edited apart: 86 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (145 corresponding lines) · ×1
  • Edited copy of a member (145 corresponding lines) py-polars/src/polars/dataframe/frame.py:12947 — py-polars/src/polars/dataframe/frame.py:12947-13091 | py-polars/src/polars/dataframe/frame.py:13343-13488 — These two members are one piece of code written twice and then edited apart: 145 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 1+ corresponding lines) crates/polars-mem-engine/src/lib.rs:16 — crates/polars-mem-engine/src/lib.rs:16-16 | crates/polars-ops/src/lib.rs:16-16 | crates/polars-plan/src/lib.rs:22-22 | crates/polars-sql/src/lib.rs:44-44 | crates/polars-stream/src/lib.rs:56-56 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (84 corresponding lines) · ×1
  • Edited copy of a member (84 corresponding lines) py-polars/src/polars/dataframe/frame.py:6309 — py-polars/src/polars/dataframe/frame.py:6309-6398 | py-polars/src/polars/lazyframe/frame.py:1685-1768 — These two members are one piece of code written twice and then edited apart: 84 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 71+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 71+ corresponding lines) py-polars/src/polars/functions/range/date_range.py:63 — py-polars/src/polars/functions/range/date_range.py:63-183 | py-polars/src/polars/functions/range/datetime_range.py:71-226 | py-polars/src/polars/functions/range/datetime_range.py:278-370 | py-polars/src/polars/functions/range/linear_space.py:241-311 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 71 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 72+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 72+ corresponding lines) py-polars/src/polars/functions/range/date_range.py:227 — py-polars/src/polars/functions/range/date_range.py:227-303 | py-polars/src/polars/functions/range/int_range.py:277-348 | py-polars/src/polars/functions/range/linear_space.py:69-193 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 72 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (68 corresponding lines) · ×1
  • Edited copy of a member (68 corresponding lines) py-polars/src/polars/expr/array.py:1074 — py-polars/src/polars/expr/array.py:1074-1168 | py-polars/src/polars/expr/list.py:1326-1393 — These two members are one piece of code written twice and then edited apart: 68 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (97 lines × 2) · ×1
  • Duplicated block (97 lines × 2) crates/polars-io/src/csv/read/streaming.rs:420 — crates/polars-io/src/csv/read/streaming.rs:420-516 | crates/polars-io/src/csv/read/streaming.rs:557-653 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/streaming.rs:420` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (89 lines × 2) · ×1
  • Duplicated block (89 lines × 2) crates/polars-io/src/csv/read/streaming.rs:110 — crates/polars-io/src/csv/read/streaming.rs:110-198 | crates/polars-io/src/csv/read/streaming.rs:295-383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-io/src/csv/read/streaming.rs:110` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (77 lines × 2) · ×1
  • Duplicated block (77 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:617 — crates/polars-plan/src/dsl/function_expr/mod.rs:617-693 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:606-682 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-plan/src/dsl/function_expr/mod.rs:614` calls `hash` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:605` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (73 lines × 2) · ×1
  • Duplicated block (73 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:747 — crates/polars-plan/src/dsl/function_expr/mod.rs:747-819 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:735-807 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (70–71 lines × 2) · ×1
  • Duplicated block (70–71 lines × 2) crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:711 — crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:711-780 | crates/polars-stream/src/nodes/io_sources/parquet/init.rs:382-452 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:711` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (66 lines × 2) · ×1
  • Duplicated block (66 lines × 2) crates/polars-plan/src/dsl/function_expr/strings.rs:184 — crates/polars-plan/src/dsl/function_expr/strings.rs:184-249 | crates/polars-plan/src/plans/aexpr/function_expr/strings.rs:366-431 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/strings.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/strings.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 97 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/strings.rs:184` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (62 lines × 2) · ×1
  • Duplicated block (62 lines × 2) crates/polars-plan/src/dsl/function_expr/datetime.rs:87 — crates/polars-plan/src/dsl/function_expr/datetime.rs:87-148 | crates/polars-plan/src/plans/aexpr/function_expr/datetime.rs:218-279 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/datetime.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/datetime.rs` as WHOLE FILES: 94% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/datetime.rs:87` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (59–60 lines × 2) · ×1
  • Duplicated block (59–60 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:543 — crates/polars-plan/src/dsl/function_expr/mod.rs:543-601 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:529-588 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:528` calls `Fused`, `hash` and `crates/polars-plan/src/dsl/function_expr/mod.rs:542` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (52 lines × 2) · ×1
  • Duplicated block (52 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:858 — crates/polars-plan/src/dsl/function_expr/mod.rs:858-909 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:879-930 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/mod.rs:858` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (49 lines × 2) · ×1
  • Duplicated block (49 lines × 2) crates/polars-stream/src/nodes/io_sources/csv/mod.rs:176 — crates/polars-stream/src/nodes/io_sources/csv/mod.rs:176-224 | crates/polars-stream/src/nodes/io_sources/ndjson/mod.rs:382-430 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/csv/mod.rs:176` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (44 lines × 2) · ×1
  • Duplicated block (44 lines × 2) crates/polars-plan/src/dsl/function_expr/list.rs:65 — crates/polars-plan/src/dsl/function_expr/list.rs:65-108 | crates/polars-plan/src/plans/aexpr/function_expr/list.rs:240-283 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/list.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/list.rs` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/dsl/function_expr/list.rs:65` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (35–40 lines × 2) · ×1
  • Duplicated block (35–40 lines × 2) crates/polars-time/src/windows/group_by.rs:712 — crates/polars-time/src/windows/group_by.rs:712-746 | crates/polars-time/src/windows/group_by.rs:748-787 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-time/src/windows/group_by.rs:748` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (39 lines × 2) · ×1
  • Duplicated block (39 lines × 2) crates/polars-stream/src/physical_plan/to_graph.rs:1191 — crates/polars-stream/src/physical_plan/to_graph.rs:1191-1229 | crates/polars-stream/src/physical_plan/to_graph.rs:2067-2105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/to_graph.rs:1191` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×1
  • Duplicated block (33 lines × 2) crates/polars-expr/src/dispatch/array.rs:201 — crates/polars-expr/src/dispatch/array.rs:201-233 | crates/polars-plan/src/plans/aexpr/function_expr/array.rs:253-285 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (32–33 lines × 2) · ×1
  • Duplicated block (32–33 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:1024 — crates/polars-plan/src/dsl/function_expr/mod.rs:1024-1055 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1045-1077 — before extracting anything, compare `crates/polars-plan/src/dsl/function_expr/mod.rs` and `crates/polars-plan/src/plans/aexpr/function_expr/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 515 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (28–31 lines × 2) · ×1
  • Duplicated block (28–31 lines × 2) crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:60 — crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:60-90 | crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:125-152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/agg_list.rs:60` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (27–30 lines × 2) · ×1
  • Duplicated block (27–30 lines × 2) crates/polars-compute/src/decimal.rs:420 — crates/polars-compute/src/decimal.rs:420-449 | crates/polars-compute/src/decimal.rs:452-478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (54 lines × 2) · ×1
  • Duplicated block (54 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs:118 — crates/polars-plan/src/plans/aexpr/traverse.rs:118-171 | crates/polars-plan/src/plans/aexpr/traverse.rs:239-292 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/traverse.rs:118` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) crates/polars-stream/src/nodes/joins/equi_join/mod.rs:894 — crates/polars-stream/src/nodes/joins/equi_join/mod.rs:894-921 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1306-1333 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join/mod.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 131 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (25–26 lines × 2) · ×1
  • Duplicated block (25–26 lines × 2) docs/source/src/rust/user-guide/concepts/expressions.rs:53 — docs/source/src/rust/user-guide/concepts/expressions.rs:53-77 | docs/source/src/rust/user-guide/getting-started.rs:82-107 — before extracting anything, compare `docs/source/src/rust/user-guide/concepts/expressions.rs` and `docs/source/src/rust/user-guide/getting-started.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/concepts/expressions.rs:53` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) crates/polars-plan/src/plans/aexpr/filter_constraint.rs:898 — crates/polars-plan/src/plans/aexpr/filter_constraint.rs:898-922 | crates/polars-plan/src/plans/aexpr/filter_constraint.rs:1110-1133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/filter_constraint.rs:898` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23–24 lines × 2) · ×1
  • Duplicated block (23–24 lines × 2) crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:114 — crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:114-136 | crates/polars-stream/src/nodes/io_sources/parquet/mod.rs:151-174 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:114` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (21–23 lines × 2) · ×1
  • Duplicated block (21–23 lines × 2) crates/polars-expr/src/dispatch/strings.rs:681 — crates/polars-expr/src/dispatch/strings.rs:681-701 | crates/polars-expr/src/dispatch/strings.rs:735-757 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/dispatch/strings.rs:681` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–23 lines × 2) · ×1
  • Duplicated block (18–23 lines × 2) crates/polars-ops/src/series/ops/replace.rs:78 — crates/polars-ops/src/series/ops/replace.rs:78-100 | crates/polars-ops/src/series/ops/replace.rs:137-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–22 lines × 2) · ×1
  • Duplicated block (12–22 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs:73 — crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs:73-94 | crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required.rs:33-44 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs:73` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–21 lines × 4) · ×1
  • Duplicated block (20–21 lines × 4) crates/polars-ops/src/chunked_array/array/join.rs:18 — crates/polars-ops/src/chunked_array/array/join.rs:18-37 | crates/polars-ops/src/chunked_array/array/join.rs:61-80 | crates/polars-ops/src/chunked_array/list/namespace.rs:81-101 | crates/polars-ops/src/chunked_array/list/namespace.rs:120-140 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `separator` to `&str` in one and `&StringChunked` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-ops/src/chunked_array/array/join.rs:82` calls `append_null` and `crates/polars-ops/src/chunked_array/array/join.rs:38` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17–21 lines × 3) · ×1
  • Duplicated block (17–21 lines × 3) crates/polars-time/src/windows/group_by.rs:629 — crates/polars-time/src/windows/group_by.rs:629-645 | crates/polars-time/src/windows/group_by.rs:714-730 | crates/polars-time/src/windows/group_by.rs:750-770 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-time/src/windows/group_by.rs:629` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20 lines × 3) · ×1
  • Duplicated block (20 lines × 3) crates/polars-plan/src/plans/to_description.rs:257 — crates/polars-plan/src/plans/to_description.rs:257-276 | crates/polars-stream/src/physical_plan/to_description.rs:690-709 | crates/polars-stream/src/physical_plan/to_description.rs:772-791 — before extracting anything, compare `crates/polars-plan/src/plans/to_description.rs` and `crates/polars-stream/src/physical_plan/to_description.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/to_description.rs:257` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16–20 lines × 2) · ×1
  • Duplicated block (16–20 lines × 2) crates/polars-parquet/src/parquet/schema/io_message/from_message.rs:483 — crates/polars-parquet/src/parquet/schema/io_message/from_message.rs:483-502 | crates/polars-parquet/src/parquet/schema/io_message/from_message.rs:515-530 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18–20 lines × 2) · ×1
  • Duplicated block (18–20 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/csv/io_writer.rs:59 — crates/polars-stream/src/nodes/io_sinks/writers/csv/io_writer.rs:59-78 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/io_writer.rs:44-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/io_sinks/writers/csv/io_writer.rs:59` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) crates/polars-core/src/frame/column/scalar.rs:250 — crates/polars-core/src/frame/column/scalar.rs:250-268 | crates/polars-core/src/frame/column/scalar.rs:298-314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/column/scalar.rs:250` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) crates/polars-plan/src/plans/aexpr/traverse.rs:51 — crates/polars-plan/src/plans/aexpr/traverse.rs:51-68 | crates/polars-plan/src/plans/aexpr/traverse.rs:144-161 | crates/polars-plan/src/plans/aexpr/traverse.rs:265-282 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/aexpr/traverse.rs:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–18 lines × 3) · ×1
  • Duplicated block (17–18 lines × 3) crates/polars-time/src/windows/group_by.rs:315 — crates/polars-time/src/windows/group_by.rs:315-332 | crates/polars-time/src/windows/group_by.rs:372-388 | crates/polars-time/src/windows/group_by.rs:447-463 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-time/src/windows/group_by.rs:315` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–18 lines × 2) · ×1
  • Duplicated block (14–18 lines × 2) crates/polars-core/src/frame/mod.rs:1163 — crates/polars-core/src/frame/mod.rs:1163-1180 | crates/polars-core/src/frame/mod.rs:1195-1208 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/mod.rs:1163` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×1
  • Duplicated block (17–18 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:296 — crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:296-312 | crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:453-470 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:296` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (17 lines × 4) · ×1
  • Duplicated block (17 lines × 4) crates/polars-stream/src/nodes/dynamic_group_by.rs:355 — crates/polars-stream/src/nodes/dynamic_group_by.rs:355-371 | crates/polars-stream/src/nodes/rolling_fixed_window.rs:204-220 | crates/polars-stream/src/nodes/rolling_group_by.rs:295-311 | crates/polars-stream/src/nodes/sorted_group_by.rs:180-196 — before extracting anything, compare `crates/polars-stream/src/nodes/dynamic_group_by.rs` and `crates/polars-stream/src/nodes/rolling_group_by.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/dynamic_group_by.rs:355` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-stream/src/nodes/dynamic_group_by.rs:352` calls `clear` and `crates/polars-stream/src/nodes/rolling_fixed_window.rs:200` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–17 lines × 3) · ×1
  • Duplicated block (16–17 lines × 3) crates/polars-parquet/src/arrow/read/deserialize/binview/predicate.rs:64 — crates/polars-parquet/src/arrow/read/deserialize/binview/predicate.rs:64-79 | crates/polars-parquet/src/arrow/read/deserialize/binview/predicate.rs:137-153 | crates/polars-parquet/src/arrow/read/deserialize/binview/predicate.rs:190-205 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/binview/predicate.rs:64` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15–16 lines × 3) · ×1
  • Duplicated block (15–16 lines × 3) crates/polars-core/src/chunked_array/object/mod.rs:238 — crates/polars-arrow/src/array/boolean/mod.rs:416-431 | crates/polars-arrow/src/array/primitive/mod.rs:525-540 | crates/polars-core/src/chunked_array/object/mod.rs:238-252 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-arrow/src/array/boolean/mod.rs:416` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–16 lines × 2) · ×1
  • Duplicated block (10–16 lines × 2) crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:319 — crates/polars-core/src/frame/group_by/aggregations/dispatch.rs:319-334 | crates/polars-expr/src/dispatch/groups_dispatch.rs:877-886 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (4–15 lines × 3) · ×1
  • Duplicated block (4–15 lines × 3) crates/polars-core/src/frame/builder.rs:101 — crates/polars-core/src/frame/builder.rs:101-104 | crates/polars-core/src/frame/builder.rs:131-145 | crates/polars-core/src/frame/builder.rs:166-180 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/builder.rs:101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13–15 lines × 2) · ×1
  • Duplicated block (13–15 lines × 2) crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1404 — crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1404-1418 | crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1722-1734 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) crates/polars-parquet/src/arrow/read/deserialize/simple.rs:174 — crates/polars-parquet/src/arrow/read/deserialize/simple.rs:174-187 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:205-218 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:399-412 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:431-444 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/simple.rs:174` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×1
  • Duplicated block (13–14 lines × 3) crates/polars-stream/src/physical_plan/lower_expr.rs:1049 — crates/polars-stream/src/physical_plan/lower_expr.rs:1049-1061 | crates/polars-stream/src/physical_plan/lower_expr.rs:1264-1277 | crates/polars-stream/src/physical_plan/lower_expr.rs:1396-1409 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:1049` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) crates/polars-stream/src/nodes/top_k.rs:394 — crates/polars-stream/src/nodes/top_k.rs:394-407 | crates/polars-stream/src/nodes/top_k.rs:534-545 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/top_k.rs:394` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13 lines × 5) · ×1
  • Duplicated block (13 lines × 5) docs/source/src/rust/user-guide/transformations/joins.rs:69 — docs/source/src/rust/user-guide/transformations/joins.rs:69-81 | docs/source/src/rust/user-guide/transformations/joins.rs:83-95 | docs/source/src/rust/user-guide/transformations/joins.rs:97-109 | docs/source/src/rust/user-guide/transformations/joins.rs:149-161 | docs/source/src/rust/user-guide/transformations/joins.rs:163-175 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `docs/source/src/rust/user-guide/transformations/joins.rs:69` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×1
  • Duplicated block (11–13 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:314 — crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:314-324 | crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:475-487 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs:314` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12 lines × 6) · ×1
  • Duplicated block (12 lines × 6) crates/polars-parquet/src/arrow/read/deserialize/simple.rs:173 — crates/polars-parquet/src/arrow/read/deserialize/simple.rs:173-184 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:204-215 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:253-264 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:280-291 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:398-409 | crates/polars-parquet/src/arrow/read/deserialize/simple.rs:430-441 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/read/deserialize/simple.rs:173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–12 lines × 6) · ×1
  • Duplicated block (11–12 lines × 6) crates/polars-parquet/src/arrow/write/mod.rs:638 — crates/polars-parquet/src/arrow/write/mod.rs:638-649 | crates/polars-parquet/src/arrow/write/mod.rs:671-681 | crates/polars-parquet/src/arrow/write/mod.rs:737-748 | crates/polars-parquet/src/arrow/write/mod.rs:957-968 | crates/polars-parquet/src/arrow/write/mod.rs:1018-1029 | crates/polars-parquet/src/arrow/write/mod.rs:1051-1061 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-parquet/src/arrow/write/mod.rs:638` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×1
  • Duplicated block (12 lines × 4) crates/polars-time/src/chunkedarray/datetime.rs:48 — crates/polars-time/src/chunkedarray/datetime.rs:48-59 | crates/polars-time/src/chunkedarray/datetime.rs:69-80 | crates/polars-time/src/chunkedarray/datetime.rs:107-118 | crates/polars-time/src/chunkedarray/datetime.rs:176-187 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-time/src/chunkedarray/datetime.rs:48` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–12 lines × 3) · ×1
  • Duplicated block (8–12 lines × 3) crates/polars-core/src/utils/supertype.rs:229 — crates/polars-core/src/utils/supertype.rs:229-236 | crates/polars-core/src/utils/supertype.rs:250-257 | crates/polars-core/src/utils/supertype.rs:309-320 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11 lines × 9) · ×1
  • Duplicated block (11 lines × 9) crates/polars-sql/src/subquery.rs:2927 — crates/polars-sql/src/subquery.rs:2927-2937 | crates/polars-sql/src/subquery.rs:3066-3076 | crates/polars-sql/src/subquery.rs:3110-3120 | crates/polars-sql/src/subquery.rs:3427-3437 | crates/polars-sql/src/subquery.rs:3669-3679 | crates/polars-sql/src/subquery_pull_up.rs:151-161 | crates/polars-sql/src/subquery_pull_up.rs:1287-1297 | crates/polars-sql/src/subquery_pull_up.rs:1333-1343 | crates/polars-sql/src/subquery_pull_up.rs:1429-1439 — there are 9 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 9 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:867 — crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:867-875 | crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:894-903 | crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:954-964 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:867` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (10 lines × 11) · ×1
  • Duplicated block (10 lines × 11) crates/polars-sql/src/subquery.rs:2136 — crates/polars-sql/src/subquery.rs:2136-2145 | crates/polars-sql/src/subquery.rs:2930-2939 | crates/polars-sql/src/subquery.rs:3069-3078 | crates/polars-sql/src/subquery.rs:3113-3122 | crates/polars-sql/src/subquery.rs:3430-3439 | crates/polars-sql/src/subquery.rs:3672-3681 | crates/polars-sql/src/subquery_group_by.rs:84-93 | crates/polars-sql/src/subquery_pull_up.rs:154-163 | crates/polars-sql/src/subquery_pull_up.rs:1290-1299 | crates/polars-sql/src/subquery_pull_up.rs:1336-1345 | crates/polars-sql/src/subquery_pull_up.rs:1432-1441 — there are 11 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 11 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-sql/src/subquery.rs:2136` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-sql/src/subquery.rs:2134` calls `push`, `clone` and `crates/polars-sql/src/subquery.rs:2929` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–12 lines × 7) · ×1
  • Duplicated block (11–12 lines × 7) crates/polars-expr/src/reduce/any_all.rs:64 — crates/polars-expr/src/reduce/any_all.rs:64-74 | crates/polars-expr/src/reduce/any_all.rs:163-173 | crates/polars-expr/src/reduce/any_all.rs:269-280 | crates/polars-expr/src/reduce/any_all.rs:395-406 | crates/polars-expr/src/reduce/bitwise.rs:185-195 | crates/polars-expr/src/reduce/min_max.rs:464-474 | crates/polars-expr/src/reduce/min_max.rs:580-590 — before extracting anything, compare `crates/polars-expr/src/reduce/any_all.rs` and `crates/polars-expr/src/reduce/min_max.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/any_all.rs:64` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–10 lines × 5) · ×1
  • Duplicated block (8–10 lines × 5) crates/polars-stream/src/physical_plan/lower_expr.rs:652 — crates/polars-stream/src/physical_plan/lower_expr.rs:652-659 | crates/polars-stream/src/physical_plan/lower_expr.rs:699-708 | crates/polars-stream/src/physical_plan/lower_expr.rs:730-737 | crates/polars-stream/src/physical_plan/lower_expr.rs:2373-2380 | crates/polars-stream/src/physical_plan/lower_expr.rs:2511-2518 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:652` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) crates/polars-stream/src/physical_plan/lower_expr.rs:1066 — crates/polars-stream/src/physical_plan/lower_expr.rs:1066-1074 | crates/polars-stream/src/physical_plan/lower_expr.rs:1250-1259 | crates/polars-stream/src/physical_plan/lower_expr.rs:1422-1430 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:1066` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (4–10 lines × 3) · ×1
  • Duplicated block (4–10 lines × 3) crates/polars-ops/src/series/ops/clip.rs:61 — crates/polars-ops/src/series/ops/clip.rs:61-64 | crates/polars-ops/src/series/ops/clip.rs:91-100 | crates/polars-ops/src/series/ops/clip.rs:127-136 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/clip.rs:61` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-ops/src/series/ops/clip.rs:100` calls `dtype` and `crates/polars-ops/src/series/ops/clip.rs:64` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–10 lines × 2) · ×1
  • Duplicated block (6–10 lines × 2) crates/polars-parquet/src/parquet/write/compression.rs:153 — crates/polars-parquet/src/parquet/write/compression.rs:153-162 | crates/polars-parquet/src/parquet/write/compression.rs:178-183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:645 — crates/polars-stream/src/physical_plan/lower_expr.rs:645-652 | crates/polars-stream/src/physical_plan/lower_expr.rs:685-694 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–9 lines × 4) · ×1
  • Duplicated block (3–9 lines × 4) crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:30 — crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:30-38 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:149-151 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:246-254 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:371-379 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:30` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:39` calls `binary`, `unwrap` and `crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:152` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (2–9 lines × 4) · ×1
  • Duplicated block (2–9 lines × 4) crates/polars-core/src/frame/group_by/aggregations/mod.rs:363 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:363-365 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1138-1139 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:98-106 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:165-173 — before extracting anything, compare `crates/polars-core/src/frame/group_by/aggregations/mod.rs` and `crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:98` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-core/src/frame/group_by/aggregations/mod.rs:1139` calls `values`, `as_slice` and `crates/polars-core/src/frame/group_by/aggregations/mod.rs:365` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) crates/polars-expr/src/expressions/slice.rs:166 — crates/polars-expr/src/expressions/slice.rs:166-172 | crates/polars-expr/src/expressions/slice.rs:209-215 | crates/polars-expr/src/expressions/slice.rs:252-259 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (2–8 lines × 3) · ×1
  • Duplicated block (2–8 lines × 3) crates/polars-ops/src/series/ops/is_in/mod.rs:402 — crates/polars-ops/src/series/ops/is_in/mod.rs:402-409 | crates/polars-ops/src/series/ops/is_in/mod.rs:490-497 | crates/polars-ops/src/series/ops/is_in/mod.rs:752-753 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/is_in/mod.rs:402` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–7 lines × 5) · ×1
  • Duplicated block (6–7 lines × 5) crates/polars-stream/src/physical_plan/lower_expr.rs:1066 — crates/polars-stream/src/physical_plan/lower_expr.rs:1066-1071 | crates/polars-stream/src/physical_plan/lower_expr.rs:1250-1255 | crates/polars-stream/src/physical_plan/lower_expr.rs:1285-1290 | crates/polars-stream/src/physical_plan/lower_expr.rs:1316-1321 | crates/polars-stream/src/physical_plan/lower_expr.rs:1421-1427 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/physical_plan/lower_expr.rs:1066` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×1
  • Duplicated block (7 lines × 4) crates/polars-ops/src/series/ops/log.rs:80 — crates/polars-ops/src/series/ops/log.rs:80-86 | crates/polars-ops/src/series/ops/log.rs:103-109 | crates/polars-ops/src/series/ops/log.rs:126-132 | crates/polars-ops/src/series/ops/log.rs:157-163 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-ops/src/series/ops/log.rs:80` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (3–7 lines × 4) · ×1
  • Duplicated block (3–7 lines × 4) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:737 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:737-739 | crates/polars-core/src/series/arithmetic/list.rs:586-592 | crates/polars-core/src/series/arithmetic/list.rs:687-693 | crates/polars-core/src/series/arithmetic/list.rs:939-941 — before extracting anything, compare `crates/polars-core/src/series/arithmetic/fixed_size_list.rs` and `crates/polars-core/src/series/arithmetic/list.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/series/arithmetic/fixed_size_list.rs:737` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-core/src/series/arithmetic/list.rs:585` calls `Some`, `clone`, `make_mut` and `crates/polars-core/src/series/arithmetic/fixed_size_list.rs:737` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) crates/polars-core/src/frame/group_by/aggregations/mod.rs:539 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:539-544 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:720-725 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:824-829 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:898-904 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:991-997 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1056-1062 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/group_by/aggregations/mod.rs:539` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (4–6 lines × 3) · ×1
  • Duplicated block (4–6 lines × 3) crates/polars-expr/src/reduce/any_all.rs:48 — crates/polars-expr/src/reduce/any_all.rs:48-53 | crates/polars-expr/src/reduce/any_all.rs:249-252 | crates/polars-expr/src/reduce/min_max.rs:561-566 — before extracting anything, compare `crates/polars-expr/src/reduce/any_all.rs` and `crates/polars-expr/src/reduce/min_max.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/polars-expr/src/reduce/any_all.rs:48` calls `dtype` and `crates/polars-expr/src/reduce/any_all.rs:249` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 8) · ×1
  • Duplicated block (5 lines × 8) crates/polars-expr/src/reduce/any_all.rs:91 — crates/polars-expr/src/reduce/any_all.rs:91-95 | crates/polars-expr/src/reduce/any_all.rs:190-194 | crates/polars-expr/src/reduce/any_all.rs:302-306 | crates/polars-expr/src/reduce/any_all.rs:428-432 | crates/polars-expr/src/reduce/bitwise.rs:215-219 | crates/polars-expr/src/reduce/is_empty.rs:92-96 | crates/polars-expr/src/reduce/min_max.rs:494-498 | crates/polars-expr/src/reduce/min_max.rs:610-614 — before extracting anything, compare `crates/polars-expr/src/reduce/any_all.rs` and `crates/polars-expr/src/reduce/min_max.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-expr/src/reduce/any_all.rs:91` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/polars-expr/src/reduce/bitwise.rs:221` calls `xor_pos_unchecked`, `get_unchecked` and `crates/polars-expr/src/reduce/any_all.rs:97` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) crates/polars-core/src/frame/builder.rs:95 — crates/polars-core/src/frame/builder.rs:95-99 | crates/polars-core/src/frame/builder.rs:123-127 | crates/polars-core/src/frame/builder.rs:158-162 | crates/polars-core/src/frame/builder.rs:195-199 | crates/polars-core/src/frame/builder.rs:225-229 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-core/src/frame/builder.rs:95` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 11) · ×1
  • Duplicated block (5 lines × 11) crates/polars-stream/src/nodes/cum_agg.rs:54 — crates/polars-stream/src/nodes/cum_agg.rs:54-59 | crates/polars-stream/src/nodes/ewm.rs:33-37 | crates/polars-stream/src/nodes/filter.rs:31-35 | crates/polars-stream/src/nodes/forward_fill.rs:49-53 | crates/polars-stream/src/nodes/gather_every.rs:42-46 | crates/polars-stream/src/nodes/map.rs:28-32 | crates/polars-stream/src/nodes/rle_id.rs:40-44 | crates/polars-stream/src/nodes/select.rs:46-50 | crates/polars-stream/src/nodes/simple_projection.rs:41-45 | crates/polars-stream/src/nodes/sorted_unique.rs:61-65 | crates/polars-stream/src/nodes/with_row_index.rs:38-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 11 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-stream/src/nodes/cum_agg.rs:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:375 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:375-384 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:456-465 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:496-505 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:665-674 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:375` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (202–203 lines × 2) · ×1
  • Duplicated block (202–203 lines × 2) py-polars/src/polars/functions/eager.py:70 — py-polars/src/polars/functions/eager.py:70-272 | py-polars/src/polars/functions/eager.py:387-588 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (100–141 lines × 2) · ×1
  • Duplicated block (100–141 lines × 2) py-polars/src/polars/dataframe/frame.py:7257 — py-polars/src/polars/dataframe/frame.py:7257-7397 | py-polars/src/polars/lazyframe/frame.py:5052-5151 — `py-polars/src/polars/dataframe/frame.py` and `py-polars/src/polars/lazyframe/frame.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 332 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (82–85 lines × 2) · ×1
  • Duplicated block (82–85 lines × 2) py-polars/src/polars/functions/range/time_range.py:64 — py-polars/src/polars/functions/range/time_range.py:64-145 | py-polars/src/polars/functions/range/time_range.py:196-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (58–76 lines × 2) · ×1
  • Duplicated block (58–76 lines × 2) py-polars/src/polars/functions/lazy.py:869 — py-polars/src/polars/functions/lazy.py:869-944 | py-polars/src/polars/functions/lazy.py:989-1046 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (63 lines × 2) · ×1
  • Duplicated block (63 lines × 2) py-polars/src/polars/functions/lazy.py:1426 — py-polars/src/polars/functions/lazy.py:1426-1537 | py-polars/src/polars/functions/lazy.py:1640-1702 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/functions/lazy.py:1426` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (49–53 lines × 2) · ×1
  • Duplicated block (49–53 lines × 2) py-polars/src/polars/dataframe/frame.py:519 — py-polars/src/polars/dataframe/frame.py:519-567 | py-polars/src/polars/lazyframe/frame.py:500-552 — `py-polars/src/polars/dataframe/frame.py` and `py-polars/src/polars/lazyframe/frame.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 332 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (51 lines × 2) · ×1
  • Duplicated block (51 lines × 2) py-polars/src/polars/dataframe/plotting.py:99 — py-polars/src/polars/dataframe/plotting.py:99-150 | py-polars/src/polars/dataframe/plotting.py:165-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/dataframe/plotting.py:99` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (41–46 lines × 2) · ×1
  • Duplicated block (41–46 lines × 2) py-polars/src/polars/config.py:962 — py-polars/src/polars/config.py:962-1002 | py-polars/src/polars/config.py:1006-1051 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (38–42 lines × 4) · ×1
  • Duplicated block (38–42 lines × 4) py-polars/src/polars/expr/list.py:1542 — py-polars/src/polars/expr/list.py:1542-1581 | py-polars/src/polars/expr/list.py:1584-1625 | py-polars/src/polars/expr/list.py:1628-1665 | py-polars/src/polars/expr/list.py:1668-1707 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (23–26 lines × 2) · ×1
  • Duplicated block (23–26 lines × 2) py-polars/src/polars/testing/parametric/strategies/dtype.py:320 — py-polars/src/polars/testing/parametric/strategies/dtype.py:320-342 | py-polars/src/polars/testing/parametric/strategies/dtype.py:429-454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/testing/parametric/strategies/dtype.py:320` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (16 lines × 6) · ×1
  • Duplicated block (16 lines × 6) py-polars/src/polars/lazyframe/engine.py:506 — py-polars/src/polars/lazyframe/engine.py:506-521 | py-polars/src/polars/lazyframe/engine.py:596-611 | py-polars/src/polars/lazyframe/frame.py:2676-2691 | py-polars/src/polars/lazyframe/frame.py:2695-2710 | py-polars/src/polars/lazyframe/frame.py:3797-3812 | py-polars/src/polars/lazyframe/frame.py:3824-3839 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (15 lines × 5) · ×1
  • Duplicated block (15 lines × 5) py-polars/src/polars/io/csv/functions.py:492 — py-polars/src/polars/io/csv/functions.py:492-506 | py-polars/src/polars/lazyframe/frame.py:2698-2712 | py-polars/src/polars/lazyframe/frame.py:3807-3821 | py-polars/src/polars/lazyframe/frame.py:3835-3849 | py-polars/src/polars/lazyframe/frame.py:9690-9704 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/io/csv/functions.py:492` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–12 lines × 3) · ×1
  • Duplicated block (9–12 lines × 3) py-polars/src/polars/dataframe/group_by.py:212 — py-polars/src/polars/dataframe/group_by.py:212-220 | py-polars/src/polars/dataframe/group_by.py:968-979 | py-polars/src/polars/dataframe/group_by.py:1173-1182 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/dataframe/group_by.py:212` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (953 lines × 2) · ×1
  • Duplicated block (953 lines × 2) py-polars/src/polars/series/array.py:23 — py-polars/src/polars/series/array.py:23-975 | py-polars/src/polars/series/list.py:28-1218 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (53 lines × 2) · ×1
  • Duplicated block (53 lines × 2) py-polars/src/polars/dataframe/frame.py:686 — py-polars/src/polars/dataframe/frame.py:686-778 | py-polars/src/polars/series/series.py:449-501 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (47 lines × 2) · ×1
  • Duplicated block (47 lines × 2) py-polars/src/polars/dataframe/frame.py:2855 — py-polars/src/polars/dataframe/frame.py:2855-2911 | py-polars/src/polars/expr/meta.py:449-495 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/expr/meta.py:449` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (70 lines × 2) · ×1
  • Duplicated block (70 lines × 2) py-polars/src/polars/dataframe/frame.py:7180 — py-polars/src/polars/dataframe/frame.py:7180-7249 | py-polars/src/polars/lazyframe/frame.py:7252-7328 — `py-polars/src/polars/dataframe/frame.py` and `py-polars/src/polars/lazyframe/frame.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 332 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) py-polars/src/polars/expr/binary.py:228 — py-polars/src/polars/expr/binary.py:228-271 | py-polars/src/polars/expr/string.py:1448-1484 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D5 · Coupling · Unstable project polars-python · ×1
  • Unstable project polars-python — polars-python has instability 0.87 with 4 dependents.
D5 · Coupling · Unstable project polars-sql · ×1
  • Unstable project polars-sql — polars-sql has instability 0.90 with 1 dependents.
D5 · Coupling · Unstable project polars-stream · ×1
  • Unstable project polars-stream — polars-stream has instability 0.91 with 2 dependents.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×1
  • Sync-over-async blocking crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1268 — `csv_file_info` is async and calls block_on — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs.
X21 · Side-effecting pattern guard · Pattern guard mutates state while matching · ×1
  • Pattern guard mutates state while matching crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:374 — The `if` guard on line 374 (`(Scan { sources, file_info, hive_parts, output_schema, mut unified_scan_args, predicate, predicate_file_skip_applied, scan_type, maintain_order, }, Some(state),) if predicate.is_none() && match &*scan_type { [cfg(feature = " ")] FileScanIR::Parquet { .. } => true, [cfg(feature = " ")] FileScanIR::Ipc { .. } => true, [cfg(feature = " ")] FileScanIR::Csv { .. } => true, [cfg(feature = " ")] FileScanIR::NDJson { .. } => true, [cfg(feature = " ")] FileScanIR::PythonDataset { .. } => true, [cfg(feature = " ")] FileScanIR::Lines { .. } => true, FileScanIR::ExpandedPaths { .. } => false, FileScanIR::ExternalReaderBuilder { .. } => true, FileScanIR::Anonymous { .. } => state.offset == 0, } =>`) changes `feature` with `feature = …` while the `match` is deciding whether that arm applies. Rust tests a guard during PATTERN MATCHING — after the arm's pattern has matched and before the arm is chosen, going on to the next arm when it is false — so the change lands whenever this arm is merely TESTED, whether or not it is then chosen, and never once an earlier arm has matched. And `&&` can skip it, so it does not happen at all whenever what decides first already answers the guard. The accounting therefore depends on evaluation order and on how many arms the subject was tested against, not on any statement a reader can point at: a counter kept this way misses exactly the path the deciding operand rules out, so it cannot reach a limit it is checked against on that path. Move the change out of the guard — leave it reading only (`if feature + 1 >= limit`) and put the assignment in the arm's BODY, where it runs precisely when the arm is chosen, or hoist it above the `match` if it must happen for every subject.
Minor — 131 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×62
  • Orphaned file py-polars/src/polars/_utils/getitem.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file py-polars/src/polars/functions/whenthen.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-expr/src/dispatch/range/linear_space.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-compute/src/comparisons/list.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file py-polars/src/polars/functions/range/datetime_range.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-compute/src/comparisons/array.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file py-polars/src/polars/datatype_expr/datatype_expr.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file py-polars/src/polars/functions/range/linear_space.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-compute/src/hyperloglogplus.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file py-polars/src/polars/functions/range/date_range.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-expr/src/dispatch/range/utils.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file py-polars/src/polars/functions/range/int_range.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-row/src/fixed/decimal.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required_masked_dense.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file py-polars/src/polars/functions/range/time_range.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-row/src/variable/binary.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-compute/src/unique/primitive.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file py-polars/src/polars/functions/aggregation/vertical.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-expr/src/dispatch/trigonometry.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-stream/src/nodes/peak_minmax.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-plan/src/plans/conversion/type_coercion/datetime.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-ops/src/chunked_array/array/dispersion.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-python/src/series/arithmetic.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/polars-row/src/widths.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • + 37 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×40
  • Duplicated predicate py-polars/src/polars/expr/expr.py:3176 — `_check_for_numpy(indices) and isinstance(indices, np.ndarray)` appears character-identically in 2 files — py-polars/src/polars/expr/expr.py, py-polars/src/polars/lazyframe/frame.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate py-polars/src/polars/_utils/getitem.py:85 — `_check_for_numpy(key) and isinstance(key, np.ndarray)` appears character-identically in 2 files — py-polars/src/polars/_utils/getitem.py, py-polars/src/polars/series/series.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate py-polars/src/polars/expr/array.py:377 — `_check_for_numpy(other) and isinstance(other, np.ndarray)` appears character-identically in 2 files — py-polars/src/polars/expr/array.py, py-polars/src/polars/series/series.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate py-polars/src/polars/dataframe/frame.py:5114 — `credential_provider is not None and credential_provider != "auto"` appears character-identically in 5 files — py-polars/src/polars/dataframe/frame.py, py-polars/src/polars/io/delta/_sink.py, py-polars/src/polars/io/delta/functions.py, py-polars/src/polars/io/lance/api.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate py-polars/src/polars/dataframe/frame.py:1037 — `dtype is not None and dtype != arr.dtype` appears character-identically in 2 files — py-polars/src/polars/dataframe/frame.py, py-polars/src/polars/series/series.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:148 — `existing_resolved_version_key is not None and existing_resolved_version_key == version_key` appears character-identically in 2 files — REDACTED, py-polars/src/polars/io/lance/_scan_resolver.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate py-polars/src/polars/expr/expr.py:3175 — `isinstance(indices, Sequence) and not isinstance(indices, str)` appears character-identically in 2 files — py-polars/src/polars/expr/expr.py, py-polars/src/polars/lazyframe/frame.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate py-polars/src/polars/_utils/construction/dataframe.py:298 — `isinstance(source, Struct) and isinstance(target, Struct)` appears character-identically in 2 files — py-polars/src/polars/_utils/construction/dataframe.py, py-polars/src/polars/sql/context.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate py-polars/src/polars/dataframe/frame.py:775 — `not _ALTAIR_AVAILABLE or parse_version(altair.__version__) < (5, 4, 0)` appears character-identically in 2 files — py-polars/src/polars/dataframe/frame.py, py-polars/src/polars/series/series.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate py-polars/src/polars/dataframe/frame.py:2668 — `not _PYARROW_AVAILABLE or parse_version(pa.__version__) < (8, 0)` appears character-identically in 2 files — py-polars/src/polars/dataframe/frame.py, py-polars/src/polars/series/series.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:368 — `self.storage_options is not None or self.credential_provider_builder is not None` appears character-identically in 2 files — REDACTED, py-polars/src/polars/io/lance/_scan_resolver.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate py-polars/src/polars/dataframe/frame.py:5135 — `storage_options is not None or credential_provider_builder is not None` appears character-identically in 2 files — py-polars/src/polars/dataframe/frame.py, py-polars/src/polars/lazyframe/frame.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-ops/src/series/ops/interpolation/interpolate.rs:47 — `!chunked_arr.has_nulls() || chunked_arr.null_count() == chunked_arr.len()` appears character-identically in 2 files — crates/polars-ops/src/series/ops/interpolation/interpolate.rs, crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-expr/src/dispatch/range/linear_space.rs:53 — `!dt1.is_primitive_numeric() || !dt2.is_primitive_numeric()` appears character-identically in 2 files — crates/polars-expr/src/dispatch/range/linear_space.rs, crates/polars-plan/src/plans/aexpr/function_expr/range.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-stream/src/nodes/joins/equi_join/mod.rs:71 — `!self.runtime_filters.is_empty() && !self.runtime_filters.is_set() && self.left_is_build == self.planned_build_left()` appears character-identically in 2 files — crates/polars-stream/src/nodes/joins/equi_join/mod.rs, crates/polars-stream/src/nodes/joins/semi_anti_join.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-expr/src/idx_table/binview.rs:92 — `MARK_MATCHES && !self.nulls_marked.load()` appears character-identically in 2 files — crates/polars-expr/src/idx_table/binview.rs, crates/polars-expr/src/idx_table/single_key.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-plan/src/plans/stats/node.rs:250 — `apply.is_some() || options.is_rolling() || options.is_dynamic()` appears character-identically in 2 files — crates/polars-plan/src/plans/stats/node.rs, crates/polars-plan/src/plans/stats/value_range.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-io/src/predicates.rs:65 — `dtype.is_categorical() || dtype.is_enum()` appears character-identically in 3 files — crates/polars-io/src/predicates.rs, crates/polars-plan/src/plans/aexpr/function_expr/schema.rs, crates/polars-plan/src/plans/aexpr/predicates/column_expr.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-core/src/fmt.rs:815 — `dtype.is_primitive_numeric() || dtype.is_decimal()` appears character-identically in 2 files — crates/polars-core/src/fmt.rs, crates/polars-sql/src/sql_expr.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-expr/src/reduce/approx_n_unique.rs:16 — `dtype.is_primitive_numeric() || dtype.is_temporal()` appears character-identically in 3 files — crates/polars-expr/src/reduce/approx_n_unique.rs, crates/polars-expr/src/reduce/mean.rs, crates/polars-ops/src/chunked_array/binary/namespace.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-expr/src/reduce/first_last.rs:34 — `dtype.is_primitive_numeric() || dtype.is_temporal() || dtype.is_decimal() || dtype.is_categorical() || dtype.is_enum()` appears character-identically in 3 files — crates/polars-expr/src/reduce/first_last.rs, crates/polars-expr/src/reduce/first_last_nonnull.rs, crates/polars-expr/src/reduce/implode.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-expr/src/expressions/apply.rs:674 — `elementwise_must_aggregate && has_not_agg_with_overlapping_groups` appears character-identically in 3 files — crates/polars-expr/src/expressions/apply.rs, crates/polars-expr/src/expressions/binary.rs, crates/polars-expr/src/expressions/structeval.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-sql/src/catalog.rs:1179 — `expr_references_any_column(left) && expr_references_any_column(right)` appears character-identically in 2 files — crates/polars-sql/src/catalog.rs, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-core/src/chunked_array/temporal/date.rs:36 — `format == "iso" || format == "iso:strict"` appears character-identically in 2 files — crates/polars-core/src/chunked_array/temporal/date.rs, crates/polars-core/src/chunked_array/temporal/time.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/polars-expr/src/expressions/apply.rs:646 — `has_agg_list || has_agg_scalar || has_not_agg` appears character-identically in 3 files — crates/polars-expr/src/expressions/apply.rs, crates/polars-expr/src/expressions/binary.rs, crates/polars-expr/src/expressions/structeval.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • + 15 more in this group — see findings.md.
P10 · Library API & versioning · Implementation type on the public API · ×8
  • Implementation type on the public API crates/polars-compute/src/arithmetic/mod.rs:90 — 1 public type in `polars_compute.arithmetic` is marked as implementation by its own namespace, folder or name: `PrimitiveArithmeticKernelImpl` (crates/polars-compute/src/arithmetic/mod.rs:90, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API crates/polars-compute/src/cast/mod.rs:37 — 1 public type in `polars_compute.cast` is marked as implementation by its own namespace, folder or name: `CastOptionsImpl` (crates/polars-compute/src/cast/mod.rs:37, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API crates/polars-core/src/datatypes/extension/mod.rs:26 — 1 public type in `polars_core.datatypes.extension` is marked as implementation by its own namespace, folder or name: `ExtensionTypeImpl` (crates/polars-core/src/datatypes/extension/mod.rs:26, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API crates/polars-core/src/series/implementations/null.rs:19 — 1 public type in `polars_core.series.implementations.null` is marked as implementation by its own namespace, folder or name: `NullChunked` (crates/polars-core/src/series/implementations/null.rs:19, `implementations`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API crates/polars-ops/src/chunked_array/list/namespace.rs:53 — 1 public type in `polars_ops.chunked_array.list.namespace` is marked as implementation by its own namespace, folder or name: `ListNameSpaceImpl` (crates/polars-ops/src/chunked_array/list/namespace.rs:53, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API crates/polars-ops/src/chunked_array/strings/json_path.rs:42 — 1 public type in `polars_ops.chunked_array.strings.json_path` is marked as implementation by its own namespace, folder or name: `Utf8JsonPathImpl` (crates/polars-ops/src/chunked_array/strings/json_path.rs:42, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API crates/polars-ops/src/chunked_array/strings/namespace.rs:333 — 1 public type in `polars_ops.chunked_array.strings.namespace` is marked as implementation by its own namespace, folder or name: `StringNameSpaceImpl` (crates/polars-ops/src/chunked_array/strings/namespace.rs:333, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API crates/polars-plan/src/traversal/tree_traversal.rs:57 — 1 public type in `polars_plan.traversal.tree_traversal` is marked as implementation by its own namespace, folder or name: `TreeTraversalImpl` (crates/polars-plan/src/traversal/tree_traversal.rs:57, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
D16 · Bus Factor · Off-boarding risk · ×7
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 38 significant file(s) lose their only recent owner: crates/polars-arrow/src/io/avro/write/serialize.rs, crates/polars-arrow/src/bitmap/iterator.rs, crates/polars-buffer/src/storage.rs, crates/polars-arrow/src/array/union/mod.rs, crates/polars-dtype/src/categorical/mod.rs, crates/polars-arrow/src/array/builder.rs, crates/polars-stream/src/nodes/joins/cross_join.rs, crates/polars-stream/src/pipe.rs (+30 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 24 significant file(s) lose their only recent owner: crates/polars-plan/src/plans/optimizer/join_order/cluster.rs, crates/polars-stream/src/nodes/joins/runtime_filter.rs, crates/polars-plan/src/plans/optimizer/join_pushthrough.rs, crates/polars-plan/src/plans/optimizer/extract_window.rs, crates/polars-parquet/src/arrow/write/nested/dremel/tests.rs, crates/polars-sql/src/group_context.rs, crates/polars-plan/src/plans/optimizer/join_order/enumerate.rs, crates/polars-expr/src/key_rows/map.rs (+16 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 15 significant file(s) lose their only recent owner: crates/polars-stream/src/nodes/io_sources/multi_scan/components/apply_extra_ops.rs, py-polars/src/polars/io/lance/_reader.py, py-polars/src/polars/io/lance/_scan_resolver.py, crates/polars-io/src/cloud/cloud_writer/bufferer.rs, crates/polars-io/src/scan_lines.rs, crates/polars-plan/src/plans/optimizer/projection_pushdown/edge.rs, crates/polars-io/src/file_cache/cache.rs, crates/polars-utils/src/row_counter.rs (+7 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 14 significant file(s) lose their only recent owner: crates/polars-io/src/cloud/concurrency/mod.rs, crates/polars-stream/src/nodes/io_sources/shared/pipeline_budget.rs, py-polars/src/polars/io/iceberg/_cache.py, crates/polars-io/src/cloud/concurrency/admission.rs, crates/polars-sql/src/table_function_args.rs, crates/polars-parquet/src/arrow/read/deserialize/primitive/fixed_len_decimal.rs, crates/polars-io/src/cloud/dns.rs, crates/polars-compute/src/gather/list.rs (+6 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 7 significant file(s) lose their only recent owner: crates/polars-core/src/chunked_array/logical/map.rs, crates/polars-plan/src/plans/aexpr/canonical.rs, py-polars/src/polars/expr/map.py, crates/polars-plan/src/plans/ir/canonical.rs, py-polars/src/polars/series/map.py, crates/polars-expr/src/dispatch/membership.rs, crates/polars-plan/src/plans/aexpr/function_expr/map.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 4 significant file(s) lose their only recent owner: crates/polars-parquet/src/parquet/encryption/encrypt.rs, crates/polars-parquet/src/parquet/encryption/ciphers.rs, crates/polars-python/src/io/parquet_encryption.rs, crates/polars-parquet/src/parquet/encryption/modules.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #7 — If anonymized user #7 becomes unavailable, 4 significant file(s) lose their only recent owner: crates/polars-expr/src/reduce/approx_quantile.rs, crates/polars-plan/src/plans/aexpr/function_expr/struct_.rs, crates/polars-plan/src/plans/optimizer/collapse_sort.rs, py-polars/src/polars/_utils/expired.py. Pair on, review, or document these before any departure.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 2 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (109 single-owned of 1573 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1573 of the 2290 production source files in this repository met that bar). They are anonymized user #8 (2 file(s)), anonymized user #9 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: crates/polars-defs/src/time/group_by.rs, crates/polars-time/src/windows/index_space.rs, crates/polars-arrow/src/compute/utils.rs.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found crates/polars-plan/src/bin/dsl-schema.rs:1 — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `crates/polars-plan/src/bin/dsl-schema.rs` makes this repository a deployable product (line 1).
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 11 of 43 project(s) overshoot their size bounds, lowering Project Cohesion to 4.9/10. The most over is `py-polars` (111978 LoC, 407 module-visible types across 44 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 62 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: py-polars/src/polars/_utils/getitem.py, py-polars/src/polars/functions/whenthen.py, crates/polars-expr/src/dispatch/range/linear_space.rs, crates/polars-compute/src/comparisons/list.rs, py-polars/src/polars/functions/range/datetime_range.py, crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs, crates/polars-compute/src/comparisons/array.rs, py-polars/src/polars/datatype_expr/datatype_expr.py (and 54 more) (63 orphaned of 1573 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1573 of the 2290 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 1/6 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/polars-cli`, `crates/polars-plan`, `docs/source`, `docs/source/src/rust`, `py-polars`.
X6 · Hand-rolled structured-format parsing · Hand-rolled JSON/XML parsing via regex · ×1
  • Hand-rolled JSON/XML parsing via regex REDACTED:45 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
X7 · Silent fallback defaults · Silent fallback default on Err · ×1
  • Silent fallback default on Err REDACTED:511 — `catalog_tables` turns every `Err` into `Ok(Vec::new())` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Minor — 31 finding(s)
D12 · Dependency Hygiene · Outdated · ×31
  • Outdated: arboard — `arboard` is locked at 3.6.1 but 3.7.0 is the current stable release on crates.io, and it already satisfies the `"3.4.0"` requirement declared in crates/polars-python/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arboard` and commit the updated REDACTED.
  • Outdated: argminmax — `argminmax` is locked at 0.7.0 but 0.7.1 is the current stable release on crates.io, and it already satisfies the `"0.7.0"` requirement declared in crates/polars-ops/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p argminmax` and commit the updated REDACTED.
  • Outdated: aws-config — `aws-config` is locked at 1.10.1 but 1.13.2 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in docs/source/src/rust/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-config` and commit the updated REDACTED.
  • Outdated: aws-lc-rs — `aws-lc-rs` is locked at 1.18.0 but 1.19.0 is the current stable release on crates.io, and it already satisfies the `"1.15"` requirement declared in crates/polars-parquet/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-lc-rs` and commit the updated REDACTED.
  • Outdated: aws-sdk-s3 — `aws-sdk-s3` is locked at 1.142.0 but 1.159.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in docs/source/src/rust/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-s3` and commit the updated REDACTED.
  • Outdated: aws-smithy-checksums — `aws-smithy-checksums` is locked at 0.65.0 but 0.65.1 is the current stable release on crates.io, and it already satisfies the `"0.65.0"` requirement declared in docs/source/src/rust/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-smithy-checksums` and commit the updated REDACTED.
  • Outdated: bitflags — `bitflags` is locked at 2.13.1 but 2.13.2 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in crates/polars-arrow/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bitflags` and commit the updated REDACTED.
  • Outdated: blake3 — `blake3` is locked at 1.8.6 but 1.8.7 is the current stable release on crates.io, and it already satisfies the `"1.8.2"` requirement declared in crates/polars-io/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p blake3` and commit the updated REDACTED.
  • Outdated: crossbeam-channel — `crossbeam-channel` is locked at 0.5.16 but 0.5.17 is the current stable release on crates.io, and it already satisfies the `"0.5.15"` requirement declared in crates/polars-async/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-channel` and commit the updated REDACTED.
  • Outdated: crossbeam-deque — `crossbeam-deque` is locked at 0.8.7 but 0.8.8 is the current stable release on crates.io, and it already satisfies the `"0.8.5"` requirement declared in crates/polars-async/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-deque` and commit the updated REDACTED.
  • Outdated: crossbeam-queue — `crossbeam-queue` is locked at 0.3.13 but 0.3.14 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in crates/polars-io/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-queue` and commit the updated REDACTED.
  • Outdated: crossbeam-utils — `crossbeam-utils` is locked at 0.8.22 but 0.8.23 is the current stable release on crates.io, and it already satisfies the `"0.8.20"` requirement declared in crates/polars-async/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-utils` and commit the updated REDACTED.
  • Outdated: either — `either` is locked at 1.17.0 but 1.19.0 is the current stable release on crates.io, and it already satisfies the `"1.14"` requirement declared in crates/polars-arrow/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p either` and commit the updated REDACTED.
  • Outdated: flate2 — `flate2` is locked at 1.1.9 but 1.1.11 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/polars-io/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p flate2` and commit the updated REDACTED.
  • Outdated: hwlocality-sys — `hwlocality-sys` is locked at 0.7.1 but 0.7.2 is the current stable release on crates.io, and it already satisfies the `"0.7.1"` requirement declared in crates/polars-async/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p hwlocality-sys` and commit the updated REDACTED.
  • Outdated: indexmap — `indexmap` is locked at 2.14.0 but 2.14.2 is the current stable release on crates.io, and it already satisfies the `"2.12"` requirement declared in crates/polars-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p indexmap` and commit the updated REDACTED.
  • Outdated: itoa — `itoa` is locked at 1.0.18 but 1.0.19 is the current stable release on crates.io, and it already satisfies the `"1.0.6"` requirement declared in crates/polars-arrow/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p itoa` and commit the updated REDACTED.
  • Outdated: libc — `libc` is locked at 0.2.189 but 0.2.191 is the current stable release on crates.io, and it already satisfies the `"0.2"` requirement declared in crates/polars-io/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libc` and commit the updated REDACTED.
  • Outdated: libloading — `libloading` is locked at 0.9.0 but 0.9.1 is the current stable release on crates.io, and it already satisfies the `"0.9.0"` requirement declared in crates/polars-expr/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libloading` and commit the updated REDACTED.
  • Outdated: proptest — `proptest` is locked at 1.11.0 but 1.12.0 is the current stable release on crates.io, and it already satisfies the `"1.6"` requirement declared in crates/polars-arrow/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p proptest` and commit the updated REDACTED.
  • Outdated: rand — `rand` is locked at 0.10.2 but 0.10.3 is the current stable release on crates.io, and it already satisfies the `"0.10"` requirement declared in crates/polars-async/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rand` and commit the updated REDACTED.
  • Outdated: reqwest — `reqwest` is locked at 0.13.4 but 0.13.5 is the current stable release on crates.io, and it already satisfies the `"0.13"` requirement declared in crates/polars-io/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p reqwest` and commit the updated REDACTED.
  • Outdated: schemars — `schemars` is locked at 1.2.2 but 1.2.3 is the current stable release on crates.io, and it already satisfies the `"1.2.1"` requirement declared in crates/polars-arrow/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p schemars` and commit the updated REDACTED.
  • Outdated: serde_json — `serde_json` is locked at 1.0.151 but 1.0.154 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/polars-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_json` and commit the updated REDACTED.
  • Outdated: sha2 — `sha2` is locked at 0.11.0 but 0.11.1 is the current stable release on crates.io, and it already satisfies the `"0.11"` requirement declared in crates/polars-plan/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p sha2` and commit the updated REDACTED.
  • + 6 more in this group — see findings.md.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-1de5ab32422a4c4cbcd6fa4801dde8f2/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-1de5ab32422a4c4cbcd6fa4801dde8f2/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude py-polars/docs --exclude pyo3-polars/example .161artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .6artifacts/raw/osv-scanner.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a1d885-9212-7ac8-bcf9-18c5acf50d42 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md