Public report of pola-rs/polars, published 26 October 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.10.5). Watchdog 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, 26 October 2026, 02:44 UTC · Survey ID cd_b2ae0b1fc1ce41a9beb60f0f40473d83

pola-rs/polars

Measured 26 October 2026, 02:33 UTC, at code version 7f902bd

Regression: 1 dimension fell since the last survey

A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.

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: 590,238 lines of product code in 42 projects, tests not counted · Estimated rebuild effort: about 6.7 person-years · Weakest lens: Performance, 60

Findings by how serious they are

177 critical 2976 serious 135 minor

18 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks 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

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
26 October 2026, 02:33 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 Watchdog. It is open to any tool that implements it, and today Watchdog is the only one that does.

The score is deterministic, which means the same code always gets the same score. Watchdog works 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 ▸

60of 60 dimensions measured by tools.
3237of 3288 findings point to an exact file and line, so you can open each one in the code. The other 51 concern the repository as a whole, such as missing documentation.
60dimensions across 6 lenses, read from 590,238 lines of product code in 42 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 150 of its 177 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 twenty-seven 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 product code is 590,238 lines, about €970,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%Production Readiness 71 · counts for 14%Code Health 76 · counts for 8%Security and Compliance 77 · counts for 4%Architecture 93 · counts for 2%

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 73%Tests 27%
New since the last survey: 368 findings

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

  • Cyclomatic Complexity · polars_parquet::arrow::read::deserialize::simple::page_iter_to_array (cyclomatic 51) crates/polars-parquet/src/arrow/read/deserialize/simple.rs
  • Cyclomatic Complexity · polars_parquet::arrow::write::schema::to_parquet_type (cyclomatic 50) crates/polars-parquet/src/arrow/write/schema.rs
  • Cyclomatic Complexity · polars_parquet::arrow::write::array_to_page_simple (cyclomatic 42) crates/polars-parquet/src/arrow/write/mod.rs
  • Cyclomatic Complexity · polars_plan::plans::conversion::ir_to_dsl::node_to_expr (cyclomatic 39) crates/polars-plan/src/plans/conversion/ir_to_dsl.rs
  • Cyclomatic Complexity · SQLContext::try_attach_join_membership (cyclomatic 37) crates/polars-sql/src/subquery.rs
  • Cyclomatic Complexity · polars_parquet::arrow::write::array_to_page_nested (cyclomatic 35) crates/polars-parquet/src/arrow/write/mod.rs
  • Cyclomatic Complexity · PageDecoder::collect_predicate_flat (cyclomatic 31) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.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 · polars_parquet::arrow::read::deserialize::utils::unspecialized_decode (cyclomatic 29) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs
  • Cyclomatic Complexity · polars_plan::plans::optimizer::extract_window::extract_from_projection (cyclomatic 29) crates/polars-plan/src/plans/optimizer/extract_window.rs
  • Cyclomatic Complexity · polars_parquet::arrow::read::statistics::deserialize_all (cyclomatic 28) crates/polars-parquet/src/arrow/read/statistics.rs
  • Cyclomatic Complexity · polars_parquet::arrow::read::deserialize::binview::decode_plain_generic (cyclomatic 26) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs
  • Cyclomatic Complexity · polars_parquet::arrow::write::dictionary::array_to_pages (cyclomatic 26) crates/polars-parquet/src/arrow/write/dictionary.rs
  • Cyclomatic Complexity · polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_dict (cyclomatic 24) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs
  • Cyclomatic Complexity · polars_plan::plans::aexpr::order_keeping::order_keeping_column_rec (cyclomatic 23) crates/polars-plan/src/plans/aexpr/order_keeping.rs
  • Cyclomatic Complexity · polars_python::io::iceberg_plugin::v1::convert::import_output (cyclomatic 23) crates/polars-python/src/io/iceberg_plugin/v1/convert.rs
  • Cyclomatic Complexity · PolarsTableFunctions::read_csv (cyclomatic 23) crates/polars-sql/src/table_functions.rs
  • Cyclomatic Complexity · GroupBySink::spawn (cyclomatic 23) crates/polars-stream/src/nodes/group_by/sink.rs
  • Cyclomatic Complexity · IcebergSinkState.new (cyclomatic 23) py-polars/src/polars/io/iceberg/_sink.py
  • Cyclomatic Complexity · AggMinMaxByExpr::evaluate_on_groups_impl (cyclomatic 22) crates/polars-expr/src/expressions/aggregation.rs
  • Cyclomatic Complexity · polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_plain (cyclomatic 22) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs
  • Cyclomatic Complexity · Parser::parse_logical_type (cyclomatic 21) crates/polars-parquet/src/parquet/schema/io_message/from_message.rs
  • Cyclomatic Complexity · polars_parquet::arrow::write::pages::to_nested_recursive (cyclomatic 21) crates/polars-parquet/src/arrow/write/pages.rs
  • Cyclomatic Complexity · IcebergSinkState._commit (cyclomatic 21) py-polars/src/polars/io/iceberg/_sink.py
  • Cyclomatic Complexity · polars_core::series::any_value::any_values_to_struct (cyclomatic 20) crates/polars-core/src/series/any_value.rs
  • Cyclomatic Complexity · polars_ops::frame::join::cross_join::fused_cross_filter (cyclomatic 20) crates/polars-ops/src/frame/join/cross_join.rs
  • Cyclomatic Complexity · polars_parquet::arrow::geo::geo_key_value (cyclomatic 20) crates/polars-parquet/src/arrow/geo.rs
  • Cyclomatic Complexity · StackOptimizer::optimize_loop (cyclomatic 20) crates/polars-plan/src/plans/optimizer/stack_opt.rs
  • Cyclomatic Complexity · ColumnPredicateExpr::new (cyclomatic 19) crates/polars-io/src/predicates.rs
  • Cyclomatic Complexity · polars_plan::plans::conversion::dsl_to_ir::sinks::validate_sinks (cyclomatic 19) crates/polars-plan/src/plans/conversion/dsl_to_ir/sinks.rs
  • Cyclomatic Complexity · polars_sql::subquery::exists_aggregates (cyclomatic 19) crates/polars-sql/src/subquery.rs
  • Cyclomatic Complexity · BooleanDecoder::extend_filtered_with_state (cyclomatic 18) crates/polars-parquet/src/arrow/read/deserialize/boolean.rs
  • Cyclomatic Complexity · CategoricalDecoder::unspecialized_predicate_decode (cyclomatic 18) crates/polars-parquet/src/arrow/read/deserialize/categorical.rs
  • Cyclomatic Complexity · polars_parquet::arrow::read::schema::convert::from_int64 (cyclomatic 18) crates/polars-parquet/src/arrow/read/schema/convert.rs
  • Cyclomatic Complexity · polars_plan::plans::aexpr::filter_constraint::model_and_chain (cyclomatic 18) crates/polars-plan/src/plans/aexpr/filter_constraint.rs
  • Cyclomatic Complexity · polars_plan::plans::optimizer::simplify_expr::arity::simplify_ternary (cyclomatic 18) crates/polars-plan/src/plans/optimizer/simplify_expr/arity.rs
  • Cyclomatic Complexity · SQLContext::execute_joins (cyclomatic 18) crates/polars-sql/src/context.rs
  • Cyclomatic Complexity · _sink._partition_key_exprs (cyclomatic 18) py-polars/src/polars/io/iceberg/_sink.py
  • Cyclomatic Complexity · PageDecoder::collect_flat (cyclomatic 17) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs
  • Cyclomatic Complexity · polars_parquet::arrow::read::deserialize::nested::columns_to_iter_recursive (cyclomatic 17) crates/polars-parquet/src/arrow/read/deserialize/nested.rs
  • Cyclomatic Complexity · polars_plan::plans::aexpr::filter_constraint::classify_comparison (cyclomatic 17) crates/polars-plan/src/plans/aexpr/filter_constraint.rs
  • Cyclomatic Complexity · SQLContext::process_join_on_subqueries (cyclomatic 17) crates/polars-sql/src/context.rs
  • Cyclomatic Complexity · SortNode::partition (cyclomatic 17) crates/polars-stream/src/nodes/sort/mod.rs
  • Cyclomatic Complexity · DataFrame.to_numpy (cyclomatic 17) py-polars/src/polars/dataframe/frame.py
  • Cyclomatic Complexity · DataFrame.to_numpy (cyclomatic 17) py-polars/src/polars/dataframe/frame.py
  • Cyclomatic Complexity · MatchesToEnd::parse (cyclomatic 16) crates/polars-ops/src/chunked_array/strings/namespace.rs
  • Cyclomatic Complexity · IntDecoder::evaluate_predicate (cyclomatic 16) crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs
  • Cyclomatic Complexity · polars_parquet::arrow::read::deserialize::dictionary_encoded::optional::decode (cyclomatic 16) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs
  • Cyclomatic Complexity · SQLContext::try_first_row_order (cyclomatic 16) crates/polars-sql/src/subquery.rs
  • Cyclomatic Complexity · DeletionFilesProvider::spawn_row_deletions_init (cyclomatic 16) crates/polars-stream/src/nodes/io_sources/multi_scan/components/row_deletions.rs
  • Cognitive Complexity · polars_parquet::arrow::read::deserialize::nested_utils::decode_nested (cognitive 88) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs
  • Cognitive Complexity · GroupBySink::spawn (cognitive 70) crates/polars-stream/src/nodes/group_by/sink.rs
  • Cognitive Complexity · PageDecoder::collect_predicate_flat (cognitive 61) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs
  • Cognitive Complexity · polars_parquet::arrow::read::deserialize::utils::unspecialized_decode (cognitive 53) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs
  • Cognitive Complexity · polars_parquet::arrow::read::deserialize::dictionary_encoded::optional::decode (cognitive 50) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional.rs
  • Cognitive Complexity · polars_python::io::iceberg_plugin::v1::convert::import_output (cognitive 47) crates/polars-python/src/io/iceberg_plugin/v1/convert.rs
  • Cognitive Complexity · polars_plan::plans::optimizer::extract_window::extract_from_projection (cognitive 45) crates/polars-plan/src/plans/optimizer/extract_window.rs
  • Cognitive Complexity · SQLContext::try_attach_join_membership (cognitive 44) crates/polars-sql/src/subquery.rs
  • Cognitive Complexity · polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_dict (cognitive 43) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs
  • Cognitive Complexity · polars_parquet::arrow::read::deserialize::binview::decode_plain_generic (cognitive 42) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs
  • Cognitive Complexity · polars_parquet::arrow::write::array_to_page_simple (cognitive 39) crates/polars-parquet/src/arrow/write/mod.rs
  • Cognitive Complexity · polars_parquet::arrow::write::pages::to_nested_recursive (cognitive 39) crates/polars-parquet/src/arrow/write/pages.rs
  • Cognitive Complexity · polars_parquet::arrow::read::deserialize::fixed_size_binary::decode_fsb_plain (cognitive 38) crates/polars-parquet/src/arrow/read/deserialize/fixed_size_binary.rs
  • Cognitive Complexity · polars_plan::plans::conversion::dsl_to_ir::sinks::validate_sinks (cognitive 36) crates/polars-plan/src/plans/conversion/dsl_to_ir/sinks.rs
  • Cognitive Complexity · CategoricalDecoder::unspecialized_predicate_decode (cognitive 33) crates/polars-parquet/src/arrow/read/deserialize/categorical.rs
  • Cognitive Complexity · polars_plan::plans::aexpr::order_keeping::order_keeping_column_rec (cognitive 32) crates/polars-plan/src/plans/aexpr/order_keeping.rs
  • Cognitive Complexity · polars_parquet::arrow::write::array_to_page_nested (cognitive 30) crates/polars-parquet/src/arrow/write/mod.rs
  • Cognitive Complexity · Shared::run (cognitive 30) crates/polars-stream/src/nodes/group_by/flush.rs
  • Cognitive Complexity · Shuffle::run (cognitive 30) crates/polars-stream/src/nodes/window/evaluate.rs
  • Cognitive Complexity · IcebergSinkState._commit (cognitive 30) py-polars/src/polars/io/iceberg/_sink.py
  • Cognitive Complexity · Parser::parse_logical_type (cognitive 29) crates/polars-parquet/src/parquet/schema/io_message/from_message.rs
  • Cognitive Complexity · polars_parquet::arrow::read::deserialize::binary::dictionary::decode_dictionary (cognitive 29) crates/polars-parquet/src/arrow/read/deserialize/binary/dictionary.rs
  • Cognitive Complexity · polars_parquet::arrow::write::schema::to_parquet_type (cognitive 29) crates/polars-parquet/src/arrow/write/schema.rs
  • Cognitive Complexity · 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
  • Cognitive Complexity · 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
  • Cognitive Complexity · polars_parquet::arrow::write::dictionary::array_to_pages (cognitive 28) crates/polars-parquet/src/arrow/write/dictionary.rs
  • Cognitive Complexity · DataFrame.to_numpy (cognitive 28) py-polars/src/polars/dataframe/frame.py
  • Cognitive Complexity · polars_parquet::arrow::write::get_encodings_recursive (cognitive 26) crates/polars-parquet/src/arrow/write/mod.rs
  • Cognitive Complexity · SQLContext::execute_joins (cognitive 26) crates/polars-sql/src/context.rs
  • Cognitive Complexity · SQLContext::try_first_row_order (cognitive 25) crates/polars-sql/src/subquery.rs
  • Cognitive Complexity · IcebergSinkState.new (cognitive 25) py-polars/src/polars/io/iceberg/_sink.py
  • Cognitive Complexity · AggMinMaxByExpr::evaluate_on_groups_impl (cognitive 24) crates/polars-expr/src/expressions/aggregation.rs
  • Cognitive Complexity · polars_parquet::arrow::read::deserialize::dictionary_encoded::required::decode (cognitive 24) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required.rs
  • Cognitive Complexity · polars_parquet::arrow::read::deserialize::nested::columns_to_iter_recursive (cognitive 23) crates/polars-parquet/src/arrow/read/deserialize/nested.rs
  • Cognitive Complexity · PageDecoder::collect_flat (cognitive 22) crates/polars-parquet/src/arrow/read/deserialize/utils/mod.rs
  • Cognitive Complexity · Levels::extend (cognitive 22) crates/polars-parquet/src/arrow/write/nested/dremel/mod.rs
  • Cognitive Complexity · polars_parquet::arrow::geo::geo_key_value (cognitive 22) crates/polars-parquet/src/arrow/geo.rs
  • Cognitive Complexity · polars_parquet::parquet::encoding::hybrid_rle::encoder::encode (cognitive 21) crates/polars-parquet/src/parquet/encoding/hybrid_rle/encoder.rs
  • Cognitive Complexity · polars_plan::plans::optimizer::join_order::enumerate::key_domain_product (cognitive 21) crates/polars-plan/src/plans/optimizer/join_order/enumerate.rs
  • Cognitive Complexity · GroupByNode::spawn (cognitive 21) crates/polars-stream/src/nodes/group_by/mod.rs
  • Cognitive Complexity · SQLContext::register_ctes (cognitive 20) crates/polars-sql/src/context.rs
  • Cognitive Complexity · PolarsTableFunctions::read_csv (cognitive 20) crates/polars-sql/src/table_functions.rs
  • Cognitive Complexity · polars_stream::nodes::window::evaluate::evaluate (cognitive 20) crates/polars-stream/src/nodes/window/evaluate.rs
  • Cognitive Complexity · MemoryManager::spawn_spills (cognitive 19) crates/polars-ooc/src/memory_manager.rs
  • Cognitive Complexity · polars_parquet::arrow::geo::apply_geo_metadata (cognitive 19) crates/polars-parquet/src/arrow/geo.rs
  • Cognitive Complexity · polars_parquet::parquet::encryption::decrypt::decrypt_column_metadata (cognitive 19) crates/polars-parquet/src/parquet/encryption/decrypt.rs
  • Cognitive Complexity · polars_plan::plans::aexpr::filter_constraint::model_and_chain (cognitive 19) crates/polars-plan/src/plans/aexpr/filter_constraint.rs
  • Cognitive Complexity · polars_plan::plans::optimizer::simplify_expr::arity::simplify_ternary (cognitive 19) crates/polars-plan/src/plans/optimizer/simplify_expr/arity.rs
  • Cognitive Complexity · polars_sql::subquery::exists_aggregates (cognitive 19) crates/polars-sql/src/subquery.rs
  • Cognitive Complexity · BottomKWithPayload::add_df (cognitive 19) crates/polars-stream/src/nodes/top_k.rs

Watchdog compares 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: 109 findings

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

  • Cyclomatic Complexity · GroupBySinkState::combine_locals (cyclomatic 20) crates/polars-stream/src/nodes/group_by.rs
  • Cyclomatic Complexity · SQLContext::execute_from_statement (cyclomatic 19) crates/polars-sql/src/context.rs
  • Cyclomatic Complexity · GroupBySinkState::spawn (cyclomatic 19) crates/polars-stream/src/nodes/group_by.rs
  • Cyclomatic Complexity · polars_core::chunked_array::ops::explode::offsets_to_indexes (cyclomatic 17) crates/polars-core/src/chunked_array/ops/explode.rs
  • Cyclomatic Complexity · polars_stream::nodes::io_sources::parquet::statistics::runtime_range_skip_mask (cyclomatic 17) crates/polars-stream/src/nodes/io_sources/parquet/statistics.rs
  • Cognitive Complexity · GroupBySinkState::spawn (cognitive 65) crates/polars-stream/src/nodes/group_by.rs
  • Cognitive Complexity · GroupBySinkState::combine_locals (cognitive 46) crates/polars-stream/src/nodes/group_by.rs
  • Cognitive Complexity · polars_core::chunked_array::ops::explode::offsets_to_indexes (cognitive 40) crates/polars-core/src/chunked_array/ops/explode.rs
  • Cognitive Complexity · polars_stream::nodes::io_sources::parquet::statistics::runtime_range_skip_mask (cognitive 32) crates/polars-stream/src/nodes/io_sources/parquet/statistics.rs
  • Cognitive Complexity · MemoryManager::do_spill (cognitive 29) crates/polars-ooc/src/memory_manager.rs
  • Cognitive Complexity · SQLContext::execute_from_statement (cognitive 29) crates/polars-sql/src/context.rs
  • Cognitive Complexity · GroupByNode::spawn (cognitive 21) crates/polars-stream/src/nodes/group_by.rs
  • Cognitive Complexity · ConnectionExecutor._fetch_arrow (cognitive 18) py-polars/src/polars/io/database/_executor.py
  • Cognitive Complexity · DeltaDataset.table (cognitive 18) REDACTED
  • Cognitive Complexity · ListNameSpaceImpl::lst_gather (cognitive 17) crates/polars-ops/src/chunked_array/list/namespace.rs
  • Cognitive Complexity · SQLContext::process_implicit_joins (cognitive 17) crates/polars-sql/src/context.rs
  • God Classes · MethodTooLong: GroupBySinkState.combine_locals crates/polars-stream/src/nodes/group_by.rs
  • God Classes · FileTooLong: nodes/group_by.rs crates/polars-stream/src/nodes/group_by.rs
  • God Classes · MethodTooLong: GroupBySinkState.spawn crates/polars-stream/src/nodes/group_by.rs
  • God Classes · MethodTooLong: SQLContext.execute_from_statement crates/polars-sql/src/context.rs
  • God Classes · MethodTooLong: RowGroupDataFetcher.next crates/polars-stream/src/nodes/io_sources/parquet/row_group_data_fetch.rs
  • Code Duplication · Near-duplicate member pair (214 shared lines) crates/polars-plan/src/dsl/function_expr/mod.rs
  • Code Duplication · Edited copy of a member (47 corresponding lines) crates/polars-io/src/csv/read/streaming.rs
  • Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) crates/polars-expr/src/reduce/any_all.rs
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) crates/polars-expr/src/reduce/any_all.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-expr/src/idx_table/binview.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 (51 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs
  • Code Duplication · Duplicated block (21 lines × 2) crates/polars-expr/src/reduce/convert.rs
  • Code Duplication · Duplicated block (20 lines × 2) crates/polars-expr/src/idx_table/binview.rs
  • Code Duplication · Duplicated block (19 lines × 2) crates/polars-compute/src/approx_quantile.rs
  • Code Duplication · Duplicated block (19 lines × 2) crates/polars-expr/src/idx_table/binview.rs
  • Code Duplication · Duplicated block (19 lines × 2) crates/polars-expr/src/idx_table/binview.rs
  • Code Duplication · Duplicated block (18 lines × 2) crates/polars-expr/src/idx_table/key_rows.rs
  • Code Duplication · Duplicated block (17 lines × 3) crates/polars-expr/src/idx_table/binview.rs
  • Code Duplication · Duplicated block (16–17 lines × 2) crates/polars-sql/src/context.rs
  • Code Duplication · Duplicated block (15–16 lines × 2) crates/polars-core/src/frame/row/dataframe.rs
  • Code Duplication · Duplicated block (12–16 lines × 2) crates/polars-sql/src/subquery.rs
  • Code Duplication · Duplicated block (14–15 lines × 4) crates/polars-expr/src/idx_table/binview.rs
  • Code Duplication · Duplicated block (14 lines × 2) crates/polars-core/src/chunked_array/arg_min_max.rs
  • Code Duplication · Duplicated block (14 lines × 2) crates/polars-ops/src/frame/join/asof/groups.rs
  • Code Duplication · Duplicated block (13 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs
  • Code Duplication · Duplicated block (13 lines × 2) crates/polars-core/src/frame/row/dataframe.rs
  • Code Duplication · Duplicated block (13 lines × 2) crates/polars-expr/src/idx_table/row_encoded.rs
  • Code Duplication · Duplicated block (11 lines × 2) crates/polars-compute/src/approx_quantile.rs
  • Code Duplication · Duplicated block (10–11 lines × 2) crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs
  • Code Duplication · Duplicated block (11 lines × 2) crates/polars-sql/src/subquery.rs
  • Code Duplication · Duplicated block (10 lines × 2) crates/polars-core/src/frame/row/dataframe.rs
  • Code Duplication · Duplicated block (8–10 lines × 2) crates/polars-mem-engine/src/planner/lp.rs
  • Code Duplication · Duplicated block (9–10 lines × 2) crates/polars-ops/src/frame/join/asof/groups.rs
  • Code Duplication · Duplicated block (10 lines × 2) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs
  • Code Duplication · Duplicated block (9 lines × 2) crates/polars-sql/src/subquery.rs
  • Code Duplication · Duplicated block (9 lines × 2) crates/polars-stream/src/nodes/scalar_window.rs
  • Code Duplication · Duplicated block (7–8 lines × 4) crates/polars-expr/src/idx_table/binview.rs
  • Code Duplication · Duplicated block (4–8 lines × 3) crates/polars-core/src/frame/builder.rs
  • Code Duplication · Duplicated block (8 lines × 2) crates/polars-sql/src/subquery.rs
  • Code Duplication · Duplicated block (6–7 lines × 4) crates/polars-stream/src/physical_plan/lower_expr.rs
  • Code Duplication · Duplicated block (7 lines × 3) crates/polars-ops/src/frame/join/asof/groups.rs
  • Code Duplication · Duplicated block (7 lines × 2) crates/polars-ops/src/frame/join/asof/groups.rs
  • Code Duplication · Duplicated block (6 lines × 3) crates/polars-sql/src/subquery.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/polars-expr/src/dispatch/list.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/polars-expr/src/expressions/aggregation.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/polars-core/src/chunked_array/arithmetic/numeric.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/polars-expr/src/reduce/min_max_by.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/polars-sql/src/subquery.rs
  • Code Duplication · Duplicated block (7 lines × 2) crates/polars-stream/src/nodes/joins/in_memory.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/polars-expr/src/dispatch/misc.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/polars-ops/src/series/ops/floor_divide.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/polars-stream/src/nodes/dynamic_slice.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/polars-stream/src/physical_plan/lower_ir.rs
  • Code Duplication · Duplicated block (16–17 lines × 2) py-polars/src/polars/lazyframe/frame.py
  • Code Duplication · Duplicated block (14 lines × 2) py-polars/src/polars/lazyframe/frame.py
  • Churn × Complexity Hotspots · Hotspot: crates/polars-stream/src/nodes/group_by.rs crates/polars-stream/src/nodes/group_by.rs
  • Churn × Complexity Hotspots · Hotspot: crates/polars-plan/src/plans/aexpr/equality.rs crates/polars-plan/src/plans/aexpr/equality.rs
  • Churn × Complexity Hotspots · Hotspot: py-polars/src/polars/testing/parametric/strategies/data.py py-polars/src/polars/testing/parametric/strategies/data.py
  • Churn × Complexity Hotspots · Hotspot: crates/polars-stream/src/nodes/io_sources/ndjson/negative_slice_pass.rs crates/polars-stream/src/nodes/io_sources/ndjson/negative_slice_pass.rs
  • Churn × Complexity Hotspots · Hotspot: crates/polars-stream/src/nodes/forward_fill.rs crates/polars-stream/src/nodes/forward_fill.rs
  • Explicit Debt · TodoComment crates/polars-core/src/chunked_array/logical/datetime.rs
  • Explicit Debt · TodoComment crates/polars-core/src/series/any_value.rs
  • Explicit Debt · TodoComment crates/polars-ops/src/series/ops/horizontal.rs
  • Explicit Debt · TodoComment crates/polars-stream/src/execute.rs
  • Explicit Debt · TodoComment py-polars/tests/unit/operations/test_shift.py
  • Explicit Debt · TodoComment py-polars/tests/unit/operations/test_join.py
  • Explicit Debt · TodoComment py-polars/tests/unit/operations/test_join.py
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Knowledge Freshness · Orphaned knowledge crates/polars-parquet/src/arrow/write/nested/dremel/tests.rs
  • Change Coupling · Boundary-crossing change coupling: cat.rs ↔ categorical.py crates/polars-plan/src/dsl/function_expr/cat.rs
  • Change Coupling · Boundary-crossing change coupling: cat.rs ↔ categorical.py crates/polars-plan/src/dsl/function_expr/cat.rs
  • Change Coupling · Change coupling: avro.py ↔ functions.py py-polars/src/polars/io/avro.py
  • Change Coupling · Change-coupling hub: determinism.rs → misc.rs, mod.rs, functions.rs, ir_to_dsl.rs crates/polars-plan/src/plans/aexpr/determinism.rs
  • Change Coupling · Change coupling: row_deletions.rs ↔ lower_ir.rs crates/polars-stream/src/nodes/io_sources/multi_scan/components/row_deletions.rs
  • Change Coupling · Change coupling: serializable_plan.rs ↔ mod.rs crates/polars-plan/src/dsl/serializable_plan.rs
  • Change Coupling · Change coupling: binary.py ↔ binary.py py-polars/src/polars/expr/binary.py
  • Change Coupling · Change coupling: mod.rs ↔ functions.rs crates/polars-expr/src/dispatch/mod.rs
Rebuild cost: about €970,000 · Estimate
Cost to rebuild€320,000 to €1,600,000, for 5,385 to 17,082 hours of work, about 6.7 person-years for 3 to 13 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: 590,238 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: Watchdog prices 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.
Raises the score by about 2 points · Low effort · ADR Quality
3
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.
Raises the score by about 2 points · Low effort · Secret Scanning

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 €970,000 to build again, about 6.7 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.8 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 3% to 7% on every change. The history of the code shows how much it changes: about 278,094 lines over the last 90 days, which is about 1,127,826 lines a year. At that pace, the extra work comes to an estimated 87.5 to 525.1 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 Watchdog's 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__ +22 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.

1936 modules, with 6218 dependencies between them. 11 loops run through 391 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 1896 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_io.cloud.options4 polars_arrow.bitmap.mutable5 polars_arrow.ffi.generated6 polars_arrow.scalar7 polars_async.executor8 polars_core.datatypes.any_value9 polars_core.frame.group_by.position10 polars_utils.arena11 polars_arrow.bitmap.immutable12 polars_compute.rolling13 polars_schema.schema14 polars_arrow.bitmap.builder15 polars_core.datatypes.dtype16 polars_plan.plans.ir17 polars_core.series18 polars_plan.plans.expr_ir19 polars_stream.nodes.io_sources.parquet.statistics20 polars_expr.reduce.first_last21 polars_plan.plans.options22 polars_buffer.buffer23 polars_arrow.array.primitive24 polars_arrow.io.ipc.write.common25 polars_lazy.frame26 polars_core.chunked_array27 polars_core.frame.column28 polars_core.frame.dataframe29 polars_defs.join30 polars_expr.state.execution_state31 polars_stream.morsel32 polars_plan.dsl.expr33 polars_stream.execute34 polars_stream.nodes35 polars_utils.pl_str36 polars_arrow.datatypes.field37 polars_arrow.datatypes38 polars_arrow.array39 polars_arrow.array.binary40 polars_arrow.array.boolean
1 polars_async.executor.metrics
2 polars_async.primitives.distributor_channel
3 polars_io.cloud.options
4 polars_arrow.bitmap.mutable1
5 polars_arrow.ffi.generated1
6 polars_arrow.scalar11
7 polars_async.executor32
8 polars_core.datatypes.any_value11
9 polars_core.frame.group_by.position1
10 polars_utils.arena3
11 polars_arrow.bitmap.immutable11
12 polars_compute.rolling1
13 polars_schema.schema1211
14 polars_arrow.bitmap.builder12
15 polars_core.datatypes.dtype1111
16 polars_plan.plans.ir81
17 polars_core.series111121111112
18 polars_plan.plans.expr_ir31112
19 polars_stream.nodes.io_sources.parquet.statistics11131
20 polars_expr.reduce.first_last13523
21 polars_plan.plans.options111
22 polars_buffer.buffer121
23 polars_arrow.array.primitive1111122
24 polars_arrow.io.ipc.write.common1
25 polars_lazy.frame11411112732
26 polars_core.chunked_array1112132111111
27 polars_core.frame.column1111122111
28 polars_core.frame.dataframe1112121111
29 polars_defs.join112
30 polars_expr.state.execution_state12
31 polars_stream.morsel1
32 polars_plan.dsl.expr112211
33 polars_stream.execute111
34 polars_stream.nodes21
35 polars_utils.pl_str11
36 polars_arrow.datatypes.field11
37 polars_arrow.datatypes11
38 polars_arrow.array113
39 polars_arrow.array.binary1111113
40 polars_arrow.array.boolean1111112
Uses a module listed above itPart of a loopThe module itself
1 polars_async.executor.metrics2 polars_async.primitives.distributor_channel3 polars_io.cloud.options4 polars_arrow.bitmap.mutable5 polars_arrow.ffi.generated6 polars_arrow.scalar7 polars_async.executor8 polars_core.datatypes.any_value9 polars_core.frame.group_by.position10 polars_utils.arena11 polars_arrow.bitmap.immutable12 polars_compute.rolling13 polars_schema.schema14 polars_arrow.bitmap.builder15 polars_core.datatypes.dtype16 polars_plan.plans.ir17 polars_core.series18 polars_plan.plans.expr_ir19 polars_stream.nodes.io_sources.parquet.statistics20 polars_expr.reduce.first_last21 polars_plan.plans.options22 polars_buffer.buffer23 polars_arrow.array.primitive24 polars_arrow.io.ipc.write.common25 polars_lazy.frame26 polars_core.chunked_array27 polars_core.frame.column28 polars_core.frame.dataframe29 polars_defs.join30 polars_expr.state.execution_state31 polars_stream.morsel32 polars_plan.dsl.expr33 polars_stream.execute34 polars_stream.nodes35 polars_utils.pl_str36 polars_arrow.datatypes.field37 polars_arrow.datatypes38 polars_arrow.array39 polars_arrow.array.binary40 polars_arrow.array.booleanpolars_async.executor.metrics1polars_async.primitives.distributor_channel2polars_io.cloud.options3polars_arrow.bitmap.mutable4polars_arrow.ffi.generated5polars_arrow.scalar6polars_async.executor7polars_core.datatypes.any_value8polars_core.frame.group_by.position9polars_utils.arena10polars_arrow.bitmap.immutable11polars_compute.rolling12polars_schema.schema13polars_arrow.bitmap.builder14polars_core.datatypes.dtype15polars_plan.plans.ir16polars_core.series17polars_plan.plans.expr_ir18polars_stream.nodes.io_sources.parquet.statistics19polars_expr.reduce.first_last20polars_plan.plans.options21polars_buffer.buffer22polars_arrow.array.primitive23polars_arrow.io.ipc.write.common24polars_lazy.frame25polars_core.chunked_array26polars_core.frame.column27polars_core.frame.dataframe28polars_defs.join29polars_expr.state.execution_state30polars_stream.morsel31polars_plan.dsl.expr32polars_stream.execute33polars_stream.nodes34polars_utils.pl_str35polars_arrow.datatypes.field36polars_arrow.datatypes37polars_arrow.array38polars_arrow.array.binary39polars_arrow.array.boolean40111132111311112111211118111112111111231112111311352311112111111221114111127321112132111111111112211111121211111121211122111112111111111311111131111112+1896 more modules (most-connected shown)

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

At a glance — Architecture · 93% · Exemplary ·

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

At a glance — Readiness · 71% · Strong ·

At a glance — Security · 77% · Adequate · gated by D29 ·

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 — Injection156High / Critical
A03:2025 — Software Supply Chain Failures26Medium
A07:2025 — Authentication Failures1High / Critical

Roadmap

First, fix async hygiene in Rust by properly awaiting futures and offloading synchronous work to prevent panics, and resolve the single leaked secret in REDACTED. Next, address the missing Architecture Decision Records by documenting key design choices in a dedicated folder. Finally, update outdated direct dependencies using cargo update to maintain a healthy dependency graph.

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`.+6.0 ptsMediumAsync & latency hygiene
Resolve the 1 No ADRs found finding(s) in ADR Quality.+2.4 ptsLowADR Quality
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.+1.6 ptsLowSecret Scanning
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.2 ptsMediumArchitecture documentation
Improve Dependency Hygiene — currently 8.6/10.+1.2 ptsMediumDependency Hygiene
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.+1.0 ptsMediumObservability
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.9 ptsMediumDocumentation (README)
Resolve the 170 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (29), REDACTED (4), functions.rs (3).+0.9 ptsHighChurn × Complexity Hotspots

File quality

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

FileScoreBandWorst signal
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-plan/src/dsl/dt.rs4.0MixedChange Coupling: Boundary-crossing change coupling: dt.rs ↔ datetime.py
REDACTED4.3MixedStatic Analysis (SAST): Medium: REDACTED

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 — 177

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 — 2976

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 — 135

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

Could not be resolved — 18

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

Watchdog 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. 60 of 60 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

Every figure here is one of three 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; ◐ Advisory — an LLM prose judgement. 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; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.

What we checked — 60 dimensions across the health lenses
D1D2D3D4D5D6D9D12D13D14D15D16D17D19D20D26D28D29D30D34D35D36D37D43D44AX10AX3AX4AX9M1M2M3M4P1P10P2P3P4P6PF3X1X12X13X14X15X16X17X18X19X21X22X23X24X25X26X27X28X29X3X30

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, 3237 of 3288 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, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — 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
Watchdog 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
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurement—◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a1760e-3233-70ab-a65c-b80de455a541.

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 — Watchdog 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 READ here — but this repository measures it: a Codecov configuration (.github/codecov.yml) and a coverage step in CI (`cargo llvm-cov`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.rs, .py), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`, or `coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`, or `coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
  • D11 Test Reliability — not measured this run — Watchdog 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, 429 test files), but it was not re-run: its dependency install outgrew the 6 GB scratch ceiling (6.363 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 — Watchdog measured this, but not all of it. What it 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 — Watchdog measured this, but not all of it. What it 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 — Watchdog 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. D21's deterministic naming 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. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog 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 — Watchdog 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 — Watchdog 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 — Watchdog 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 — Watchdog 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 — Watchdog 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 — Watchdog 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 — Watchdog 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 — Watchdog 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 — Watchdog 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 this repository's Python, Rust is most of its product and 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 — Watchdog 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 this repository's Python, Rust is most of its product and 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 — Watchdog measured this, but not all of it. What it 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). 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 — Watchdog 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 — Watchdog 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.
  • X5 Nullable reference types — not measured this run — Watchdog 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: 1 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

Watchdog assesses the repository exactly as committed, and only the repository. By design it does 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.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • 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 is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • 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: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • 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

375 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions at 420. A further 116 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 143 — they are counted neither in the figure above nor in this dimension's score. 46 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-expr/src/dispatch/temporal.rs (polars_expr::dispatch::temporal::temporal_func_to_udf at 50), crates/polars-config/src/lib.rs (Config::apply_env_var at 48), crates/polars-expr/src/dispatch/strings.rs (polars_expr::dispatch::strings::function_expr_to_udf at 48), and 41 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 420) · ×62crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs:16
polars_stream::physical_plan::lower_ir::lower_ir_inner (cyclomatic 152) · ×16crates/polars-stream/src/physical_plan/lower_ir.rs:278
polars_parquet::arrow::read::deserialize::simple::page_iter_to_array (cyclomatic 51) · ×16crates/polars-parquet/src/arrow/read/deserialize/simple.rs:31
polars_ops::series::ops::unique::unique_counts (cyclomatic 41) · ×16crates/polars-ops/src/series/ops/unique.rs:32
polars_io::csv::write::write_impl::serializer::serializer_for (cyclomatic 72) · ×13crates/polars-io/src/csv/write/write_impl/serializer.rs:577

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

What to do

  1. Bring the 4 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions (cyclomatic 420), polars_python::lazyframe::visitor::expr_nodes::into_py (cyclomatic 417), polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl (cyclomatic 368). — 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 4 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.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive Complexity3.5 / 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.5 / 10 · rule-coverage 100% · ceiling Prevented

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

polars_plan::plans::conversion::dsl_to_ir::to_alp_impl (cognitive 240) · ×67crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:193
polars_ops::chunked_array::gather::chunked::take_opt_chunked_unchecked_binview (cognitive 74) · ×43crates/polars-ops/src/chunked_array/gather/chunked.rs:685
polars_stream::physical_plan::lower_ir::lower_ir_inner (cognitive 258) · ×31crates/polars-stream/src/physical_plan/lower_ir.rs:278
polars_parquet::arrow::read::deserialize::nested_utils::decode_nested (cognitive 88) · ×28crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs:409
polars_core::chunked_array::ops::search_sorted::binary_search_ca (cognitive 53) · ×26crates/polars-core/src/chunked_array/ops/search_sorted.rs:135

+ 296 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 457), WindowExpr::evaluate_on_groups_impl (cognitive 273), polars_stream::physical_plan::lower_ir::lower_ir_inner (cognitive 258). — 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.6 to about 4.4/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes7.8 / 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.8 / 10 · rule-coverage 100% · ceiling Prevented

439 god class(es) detected.

FileTooLong: series/series.py · ×151py-polars/src/polars/series/series.py
MethodTooLong: ProjectionPushdownVisitor.pushdown · ×113crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:215
FunctionTooLong: polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx · ×109crates/polars-stream/src/physical_plan/lower_expr.rs:599
TooManyMethods: PyExpr · ×38crates/polars-python/src/expr/mod.rs:44
ClassTooLong: SQLContext · ×23crates/polars-sql/src/context.rs:228

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

What to do

  1. Resolve the 151 FileTooLong finding(s) in God Classes — start with mod.rs (32), functions.rs (3), frame.py (2). — One of this dimension's main actionable groups (151 warning-level).
  2. Resolve the 113 MethodTooLong finding(s) in God Classes — start with mod.rs (25), context.rs (7), builder.rs (4). — One of this dimension's main actionable groups (113 warning-level).
  3. Resolve the 109 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 (109 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication9.3 / 10Stronggated by 876 serious findings✓ Tool-verified

What it measures: Copy-pasted code that should be shared instead.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.

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

828 duplicated block group(s) detected. A further 48 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 1 of the 876 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (5 lines × 2) · ×76crates/polars-compute/src/moment.rs:653
Duplicated block (8 lines × 2) · ×64crates/polars-compute/src/arithmetic/mod.rs:197
Duplicated block (11 lines × 2) · ×54crates/polars-compute/src/rolling/moment.rs:286
Duplicated block (7 lines × 2) · ×54crates/polars-compute/src/approx_quantile.rs:697
Duplicated block (9 lines × 2) · ×48crates/polars-compute/src/min_max/simd.rs:40

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

What to do

  1. Resolve the 76 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with mod.rs (9), distinct.rs (5), av_buffer.rs (4). — One of this dimension's main actionable groups (76 warning-level).
  2. Resolve the 64 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with mod.rs (6), dispersion.rs (3), moment.rs (2). — One of this dimension's main actionable groups (64 warning-level).
  3. Resolve the 54 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with mod.rs (12), ewm.rs (3), implode.rs (2). — One of this dimension's main actionable groups (54 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D5 · Coupling8.5 / 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.5 / 10 · rule-coverage 100% · ceiling Prevented

42 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 31 of the 42 (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).
  4. Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D6 · Cohesion (LCOM4)9.7 / 10Stronggated by 20 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

20 of 757 classes have LCOM4 above 3.

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

What to do

  1. Resolve the 20 Low cohesion finding(s) in Cohesion (LCOM4) — start with mod.rs (4), options.rs, dataframe.rs. — One of this dimension's main actionable groups (20 warning-level).
  2. Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.

Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.

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

11241 test methods: 10370 unit, 871 integration, 0 BDD, 0 e2e. The Rust suite contributes 1877 `#[test]` function(s) across 369 file(s) declaring at least one; its unit/integration split is Cargo's own — 129 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test. The Python suite contributes 9364 test function(s) across 428 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D12 · Dependency Hygiene8.6 8.4 / 10Strong✓ Tool-verified

What it measures: Whether dependencies are current, secure, and not bloated.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.

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

28 outdated, 0 yanked direct Cargo dependencies. 117 of 120 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 · ×28

What to do

  1. Improve Dependency Hygiene — currently 8.6/10. — 28 outdated, 0 yanked direct Cargo dependencies. 117 of 120 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.

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

D13 · Secret Scanning5.0 / 10Adequate✓ Tool-verified

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 5.0 / 10 · rule-coverage 100% · ceiling Prevented

1 secret(s) detected.

REDACTED

What to do

  1. Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Enforce Secret Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.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 517 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.7 / 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.7 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: crates/polars-python/src/lazyframe/visitor/expr_nodes.rs (27×417=11259); crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs (26×420=10920); crates/polars-plan/src/plans/conversion/ir_to_dsl.rs (23×368=8464) Repeated repair below the complexity floor: crates/polars-core/src/chunked_array/cast.rs (5 of 9 changes were fixes); crates/polars-expr/src/expressions/sortby.rs (4 of 7 changes were fixes); crates/polars-plan/src/plans/optimizer/cse/cspe.rs (3 of 5 changes were fixes)

Hotspot: crates/polars-python/src/lazyframe/visitor/expr_nodes.rs · ×170crates/polars-python/src/lazyframe/visitor/expr_nodes.rs:860
Repeated repair: crates/polars-core/src/chunked_array/cast.rs · ×7crates/polars-core/src/chunked_array/cast.rs:75

What to do

  1. Resolve the 170 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (29), REDACTED (4), functions.rs (3). — One of this dimension's main actionable groups (170 warning-level).
  2. Resolve the 7 Repeated repair finding(s) in Churn × Complexity Hotspots — start with cast.rs, sortby.rs, cspe.rs. — One of this dimension's main actionable groups (7 warning-level).

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

D16 · Bus Factor9.5 / 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.5 / 10 · rule-coverage 100% · ceiling Documented

74 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 1524 of the 2242 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 · ×6
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 358 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

358 deducted task-comment markers across 590238 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 · ×354pyo3-polars/pyo3-polars/src/lib.rs:17
HackComment · ×3crates/polars-stream/src/physical_plan/lower_expr.rs:3169
XxxCommentcrates/polars-python/src/file.rs:397

What to do

  1. Resolve the 354 TodoComment finding(s) in Explicit Debt — start with mod.rs (40), frame.py (7), scans.rs (6). — One of this dimension's main actionable groups (354 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).
  4. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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. 230 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: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

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

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — 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.8 / 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, LLM-independent.

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

11 of 42 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

156 finding(s): 0 critical, 149 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 8 file(s) — `crates/polars-buffer/src/storage.rs` (line 141), `crates/polars-core/src/chunked_array/mod.rs` (line 1021), `crates/polars-io/src/cloud/object_store_setup.rs` (line 139, line 147, lines 148–149), `crates/polars-plan/src/plans/optimizer/expand_datasets.rs` (line 941, lines 942–943), `crates/polars-schema/src/schema.rs` (line 355, line 359, line 364, …), … (+3 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

+ 9 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 Vulnerabilities8.9 / 10Strong✓ 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.

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

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

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 3 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).
  2. 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).
  3. Resolve the 1 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).

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

D34 · Knowledge Freshness9.6 / 10Exemplary✓ 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

65 of 1524 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is py-polars/src/polars/_utils/getitem.py. Counted over 1524 of the 2242 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned file · ×65py-polars/src/polars/_utils/getitem.py:1
Orphaned files with no living knowledge

✓ On the Gold path — maintain.

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

D35 · Change Coupling9.5 / 10Adequategated by 27 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: array.rs↔array.rs 93%; mod.rs↔array.py 91%; dt.rs↔datetime.rs 90%

Boundary-crossing change coupling: mod.rs ↔ array.py · ×27crates/polars-ops/src/chunked_array/array/mod.rs:1
Change coupling: dt.rs ↔ datetime.rs · ×35crates/polars-plan/src/dsl/dt.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 27 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 (27 issue-level).
  2. Resolve the 35 Change coupling finding(s) in Change Coupling — start with mod.rs (5), list.rs (2), iterator.rs (2). — One of this dimension's main actionable groups (35 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. Scored 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. SCORED, not informational.

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 composition9.9 / 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.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
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.

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

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

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.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 13 of 44 project(s) that lack one — worth up to 0.6 pts.
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 repo is organised deliberately — src/test separation and consistent project naming.

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 README actually describes the code that exists (LLM-judged, advisory).

Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.

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○ Nothing flagged

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 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.

P2 · Observability4.6 / 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/5 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `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 the language 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:1128

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.

X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.

Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

X17 · Uncapped recursion over a caller-supplied document2.2 / 10Critical✓ Tool-verified

Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.

Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.

  • `flexhash` is public and takes `elem: Any` from its caller, and it calls itself at line 11 (`flexhash`) with a piece of `elem` (and at line 13) — and nowhere in `flexhash` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `flexhash` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — py-polars/src/polars/testing/parametric/strategies/_utils.py:11
  • `lit` is public and takes `value: Any` from its caller, and it calls itself at line 209 (`lit`) with a piece of `value` (and at line 218, line 225, line 228) — and nowhere in `lit` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `lit` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — py-polars/src/polars/functions/lit.py:209
  • `nt_unpack` is public and takes `obj: Any` from its caller, and it calls itself at line 94 (`nt_unpack`) with a piece of `obj` (and at line 96, line 98, line 100) — and nowhere in `nt_unpack` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `nt_unpack` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — py-polars/src/polars/_utils/construction/utils.py:94

What to do

  • Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
X18 · Disposal-pattern correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.

Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.

X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

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 366 (`(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:366

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.
X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.

Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.

Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

X26 · Unsynchronised callback handoff10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.

Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.

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.

X3 · Exception handling6.4 / 10Adequate✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×9) — py-polars/src/polars/sql/context.py:974, py-polars/src/polars/meta/versions.py:141, py-polars/src/polars/io/lance/_scan_resolver.py:139, …
  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. — py-polars/src/polars/io/iceberg/_utils.py:634

What to do

  • Swallowed exception (caught, then discarded)
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 Health76%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture93%ExemplaryStrongest area.
Maturity68%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness71%StrongSolid.
Security77%Adequate — gated by D29Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance60%AdequateLargest drag on the score — prioritise here.
Unscored — 2 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 — 25 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.
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 — 54 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.
  • AC7 A11y enforcement — 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 — ~217708 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 — Naming consistency is measured on C# only; JavaScript, Python, Rust not measured.
  • 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+ projects each declaring an entity of their own. 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# and Visual Basic 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.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • 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 included — suite not readable by the collector
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (280 value object(s))
  • 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
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • 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 JavaScript/TypeScript, 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 — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • 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 applicable: Rust spells out every heap allocation and makes borrowed slices (&[T], &str) its ordinary parameter types, so the allocation-aware style this card rewards elsewhere is the language's baseline rather than a rung to climb. Python runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
  • 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.
  • 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.
  • 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
  • X7 Silent fallback defaults — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • 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 — 177 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 · ×27
  • 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: 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/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: 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 76% of the time (13 of the 17 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 13 shared commits counted here, the most recent 3 are `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`); `85b8de22` feat: Add an `is_literal` method to expression `meta` namespace (#19773) (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/expr/datetime.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 73% of the time (19 of the 26 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 19 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: 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 73% of the time (19 of the 26 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 19 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: 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 (38 of the 58 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 38 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: 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: 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: 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: 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 54% of the time (44 of the 81 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 44 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: 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.
  • Boundary-crossing change coupling: mod.rs ↔ string.py crates/polars-ops/src/chunked_array/strings/mod.rs:1 — `crates/polars-ops/src/chunked_array/strings/mod.rs` (context crates) and `py-polars/src/polars/expr/string.py` (context py-polars) sit in DIFFERENT parts of the tree yet change together 50% of the time (7 of the 14 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 `74dad84e` feat: Add `str.normalize()` (#20483) (at that commit the file was still `py-polars/polars/expr/string.py`); `791c336f` feat: Added `escape_regex` operation to the `str` namespace and as a … (at that commit the file was still `py-polars/polars/expr/string.py`); `ecc5c4cc` feat: str namespace; add aho-corasick expressions: 'contains_any' and… (at that commit the file was still `py-polars/polars/expr/string.py`) — run `git show` on any of them.
  • + 2 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
D13 · Secret Scanning · Leaked secret · ×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
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
Serious — 2976 finding(s)
D17 · Explicit Debt · TodoComment · ×354
  • 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:13 — # 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:1399 — # 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:2317 — # 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:2292 — # 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:817 — # 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:635 — # 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:31 — # TODO: null-supertype — 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:31 — # TODO: null-supertype — 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:268 — # 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:273 — # 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:484 — # 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:513 — # 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:1474 — # TODO: uint128 — 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/lazyframe/test_lazyframe.py:508 — # TODO: uint128 — 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:1482 — # TODO: Remove this exception when #24509 is resolved
  • TodoComment py-polars/tests/unit/operations/aggregation/test_aggregations.py:1562 — # TODO: polars/#24936
  • TodoComment py-polars/tests/unit/operations/aggregation/test_aggregations.py:1598 — # 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.
  • + 329 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×170
  • 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 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 417 in polars_python::lazyframe::visitor::expr_nodes::into_py at line 860. 3 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-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 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 420 in polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions at line 16. 4 of those changes were fix/bug commits, and the other 22 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-plan/src/plans/conversion/ir_to_dsl.rs crates/polars-plan/src/plans/conversion/ir_to_dsl.rs:338 — crates/polars-plan/src/plans/conversion/ir_to_dsl.rs changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 368 in polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl at line 338. 2 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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:278 — crates/polars-stream/src/physical_plan/lower_ir.rs changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 152 in polars_stream::physical_plan::lower_ir::lower_ir_inner at line 278. 1 of those changes was a fix/bug commit, and the other 38 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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: crates/polars-sql/src/functions.rs crates/polars-sql/src/functions.rs:1328 — crates/polars-sql/src/functions.rs changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 220 in SQLFunctionVisitor::visit_function at line 1328. 12 of those changes were fix/bug commits, and the other 14 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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/aexpr/function_expr/schema.rs crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:8 — crates/polars-plan/src/plans/aexpr/function_expr/schema.rs changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 194 in IRFunctionExpr::get_field at line 8. 11 of those changes were fix/bug commits, and the other 17 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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:215 — crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 234 in ProjectionPushdownVisitor::pushdown at line 215. 6 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-sql/src/context.rs crates/polars-sql/src/context.rs:2557 — crates/polars-sql/src/context.rs changed 69 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in SQLContext::execute_select_block at line 2557. 31 of those changes were fix/bug commits, and the other 38 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +01:00' --full-history --no-merges -- crates/polars-sql/src/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.
  • Hotspot: crates/polars-stream/src/physical_plan/lower_expr.rs crates/polars-stream/src/physical_plan/lower_expr.rs:599 — crates/polars-stream/src/physical_plan/lower_expr.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 119 in polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx at line 599. 4 of those changes were fix/bug commits, and the other 26 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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:193 — crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs changed 25 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 193. 5 of those changes were fix/bug commits, and the other 20 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-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 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 108 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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 21 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-sql/src/sql_expr.rs crates/polars-sql/src/sql_expr.rs:924 — crates/polars-sql/src/sql_expr.rs changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in SQLExprVisitor::visit_binary_op at line 924. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-expr/src/dispatch/mod.rs crates/polars-expr/src/dispatch/mod.rs:147 — crates/polars-expr/src/dispatch/mod.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 143 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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:835 — crates/polars-plan/src/plans/aexpr/function_expr/mod.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 127 in IRFunctionExpr::fmt_name at line 835. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-compute/src/cast/mod.rs crates/polars-compute/src/cast/mod.rs:400 — crates/polars-compute/src/cast/mod.rs changed 6 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-plan/src/plans/conversion/type_coercion/mod.rs crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:114 — crates/polars-plan/src/plans/conversion/type_coercion/mod.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 111 in TypeCoercionRule::optimize_expr at line 114. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-plan/src/plans/aexpr/determinism.rs crates/polars-plan/src/plans/aexpr/determinism.rs:88 — crates/polars-plan/src/plans/aexpr/determinism.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 94 in polars_plan::plans::aexpr::determinism::is_inherently_nondeterministic_fn at line 88. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/aexpr/determinism.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:816 — crates/polars-plan/src/dsl/function_expr/mod.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 127 in FunctionExpr::fmt at line 816. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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/mod.rs crates/polars-stream/src/physical_plan/mod.rs:651 — crates/polars-stream/src/physical_plan/mod.rs changed 24 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 651. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-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 17 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 176 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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/optimizer/simplify_ordering/mod.rs crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs:110 — crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 110 in SimplifyIRNodeOrder::simplify_ir_node_orders at line 110. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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: crates/polars-plan/src/plans/optimizer/predicate_pushdown/mod.rs crates/polars-plan/src/plans/optimizer/predicate_pushdown/mod.rs:254 — crates/polars-plan/src/plans/optimizer/predicate_pushdown/mod.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in PredicatePushDown::push_down at line 254. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/optimizer/predicate_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-plan/src/plans/optimizer/mod.rs crates/polars-plan/src/plans/optimizer/mod.rs:112 — crates/polars-plan/src/plans/optimizer/mod.rs changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in polars_plan::plans::optimizer::optimize at line 112. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/optimizer/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.
  • + 145 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×151
  • FileTooLong: series/series.py py-polars/src/polars/series/series.py — FileTooLong — 5240 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4740 over it, 10.48× 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/context.rs crates/polars-sql/src/context.rs — FileTooLong — 4469 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 79% of them inside a single declaration: SQLContext (5 blocks, 228-5333), declaring 51 free functions. The bar is 500 significant lines; this is 3969 over it, 8.94× 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: dataframe/frame.py py-polars/src/polars/dataframe/frame.py — FileTooLong — 4464 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3964 over it, 8.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: lazyframe/frame.py py-polars/src/polars/lazyframe/frame.py — FileTooLong — 3451 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2951 over it, 6.90× 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 — 2479 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 1979 over it, 4.96× 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 — 2446 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 41 free functions. The bar is 500 significant lines; this is 1946 over it, 4.89× 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: visitor/expr_nodes.rs crates/polars-python/src/lazyframe/visitor/expr_nodes.rs — FileTooLong — 1845 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 1345 over it, 3.69× 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 — 1804 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 64% of them inside a single declaration: SQLFunctionVisitor (2 blocks, 42-3021). The bar is 500 significant lines; this is 1304 over it, 3.61× 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_ir.rs crates/polars-stream/src/physical_plan/lower_ir.rs — FileTooLong — 1735 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 1235 over it, 3.47× 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/sql_expr.rs crates/polars-sql/src/sql_expr.rs — FileTooLong — 1712 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: SQLExprVisitor (2 blocks, 139-1957), declaring 40 free functions. The bar is 500 significant lines; this is 1212 over it, 3.42× 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/to_graph.rs crates/polars-stream/src/physical_plan/to_graph.rs — FileTooLong — 1632 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 1132 over it, 3.26× 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 — 1565 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: ProjectionPushdownVisitor (3 blocks, 128-2224). The bar is 500 significant lines; this is 1065 over it, 3.13× 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: conversion/mod.rs crates/polars-python/src/conversion/mod.rs — FileTooLong — 1526 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 (67 blocks, 72-2265). The bar is 500 significant lines; this is 1026 over it, 3.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: dsl_to_ir/scans.rs crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs — FileTooLong — 1408 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 908 over it, 2.82× 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 — 1397 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 897 over it, 2.79× 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/general.rs crates/polars-python/src/lazyframe/general.rs — FileTooLong — 1384 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 (91-1713). The bar is 500 significant lines; this is 884 over it, 2.77× 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: datatypes/dtype.rs crates/polars-core/src/datatypes/dtype.rs — FileTooLong — 1355 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 (8 blocks, 90-1978). The bar is 500 significant lines; this is 855 over it, 2.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: frame/mod.rs crates/polars-lazy/src/frame/mod.rs — FileTooLong — 1322 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-1996). The bar is 500 significant lines; this is 822 over it, 2.64× 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: joins/equi_join.rs crates/polars-stream/src/nodes/joins/equi_join.rs — FileTooLong — 1301 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 801 over it, 2.60× 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-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: function_expr/mod.rs crates/polars-plan/src/plans/aexpr/function_expr/mod.rs — FileTooLong — 1273 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-1509). The bar is 500 significant lines; this is 773 over it, 2.55× 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 — 1206 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 706 over it, 2.41× 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: type_coercion/mod.rs crates/polars-plan/src/plans/conversion/type_coercion/mod.rs — FileTooLong — 1195 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-1269). The bar is 500 significant lines; this is 695 over it, 2.39× 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/functions.rs crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs — FileTooLong — 1176 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 676 over it, 2.35× 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.
  • + 126 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×113
  • MethodTooLong: ProjectionPushdownVisitor.pushdown crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:215 — MethodTooLong — pushdown runs 1280 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 1180 over it, 12.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: TypeCoercionRule.optimize_expr crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:114 — MethodTooLong — optimize_expr runs 859 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 759 over it, 8.59× 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:227 — MethodTooLong — pushdown runs 575 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 475 over it, 5.75× 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:8 — MethodTooLong — get_field runs 506 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 406 over it, 5.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: SQLFunctionVisitor.visit_function crates/polars-sql/src/functions.rs:1328 — MethodTooLong — visit_function runs 495 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 395 over it, 4.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.
  • MethodTooLong: SQLContext.execute_select_block crates/polars-sql/src/context.rs:2557 — MethodTooLong — execute_select_block runs 412 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 312 over it, 4.12× 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 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.
  • 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: SQLContext.process_group_by crates/polars-sql/src/context.rs:4662 — MethodTooLong — process_group_by 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: SimplifyIRNodeOrder.simplify_ir_node_orders crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs:110 — MethodTooLong — simplify_ir_node_orders runs 321 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 221 over it, 3.21× 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: IpcFileReader.begin_read crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:199 — MethodTooLong — begin_read 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: IRFunctionExpr.hash crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:464 — MethodTooLong — hash runs 305 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 205 over it, 3.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.
  • MethodTooLong: FunctionExpr.hash crates/polars-plan/src/dsl/function_expr/mod.rs:480 — MethodTooLong — hash runs 303 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 203 over it, 3.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.
  • MethodTooLong: SimplifyExprRule.optimize_expr crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:701 — MethodTooLong — optimize_expr runs 300 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 200 over it, 3.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: AExpr.to_field_impl crates/polars-plan/src/plans/aexpr/schema.rs:45 — MethodTooLong — to_field_impl runs 286 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 186 over it, 2.86× 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:470 — MethodTooLong — fmt runs 275 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 175 over it, 2.75× 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:1201 — MethodTooLong — function_options runs 264 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 164 over it, 2.64× 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:130 — MethodTooLong — _join_impl 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.
  • 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.
  • MethodTooLong: WindowExpr.evaluate_on_groups_impl crates/polars-expr/src/expressions/window.rs:717 — MethodTooLong — evaluate_on_groups_impl runs 257 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 157 over it, 2.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.
  • MethodTooLong: TreeFmtNode.node_data crates/polars-plan/src/plans/ir/tree_format.rs:197 — MethodTooLong — node_data runs 254 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 154 over it, 2.54× 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.
  • + 88 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×109
  • FunctionTooLong: polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx crates/polars-stream/src/physical_plan/lower_expr.rs:599 — FunctionTooLong — polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx runs 1700 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 1600 over it, 17.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.
  • 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 1523 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 1423 over it, 15.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.
  • FunctionTooLong: polars_stream::physical_plan::lower_ir::lower_ir_inner crates/polars-stream/src/physical_plan/lower_ir.rs:278 — FunctionTooLong — polars_stream::physical_plan::lower_ir::lower_ir_inner runs 1374 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 1274 over it, 13.74× 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 1180 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 1080 over it, 11.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.
  • 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 1163 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 1063 over it, 11.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.
  • FunctionTooLong: polars_plan::plans::conversion::dsl_to_ir::to_alp_impl crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:193 — FunctionTooLong — polars_plan::plans::conversion::dsl_to_ir::to_alp_impl runs 1092 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 992 over it, 10.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::conversion::ir_to_dsl::ir_function_to_dsl crates/polars-plan/src/plans/conversion/ir_to_dsl.rs:338 — FunctionTooLong — polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl runs 860 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 760 over it, 8.60× 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 767 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 667 over it, 7.67× 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 688 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 588 over it, 6.88× 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 crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:264 — FunctionTooLong — polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec runs 590 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 490 over it, 5.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.
  • 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:623 — FunctionTooLong — polars_plan::plans::optimizer::predicate_pushdown::join::predicate_pruning::try_rewrite_join_type runs 443 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 343 over it, 4.43× 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_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::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_to_ir.rs:123 — FunctionTooLong — polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl runs 393 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 293 over it, 3.93× 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:247 — FunctionTooLong — polars_expr::planner::create_physical_expr_inner runs 388 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 288 over it, 3.88× 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_expr::dispatch::function_expr_to_udf crates/polars-expr/src/dispatch/mod.rs:147 — FunctionTooLong — polars_expr::dispatch::function_expr_to_udf runs 373 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 273 over it, 3.73× 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:269 — FunctionTooLong — polars_plan::plans::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec runs 369 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 269 over it, 3.69× 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_stream::physical_plan::lower_group_by::try_lower_elementwise_scalar_agg_expr crates/polars-stream/src/physical_plan/lower_group_by.rs:262 — FunctionTooLong — polars_stream::physical_plan::lower_group_by::try_lower_elementwise_scalar_agg_expr 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 346 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 246 over it, 3.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_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.
  • FunctionTooLong: polars_python::c_api::_polars_runtime crates/polars-python/src/c_api/mod.rs:111 — FunctionTooLong — polars_python::c_api::_polars_runtime runs 324 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 224 over it, 3.24× 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.
  • + 84 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×76
  • 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.
  • 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.
  • Duplicated block (5 lines × 2) crates/polars-compute/src/unique/distinct.rs:589 — crates/polars-compute/src/unique/distinct.rs:589-593 | crates/polars-compute/src/unique/distinct.rs:759-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.
  • 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.
  • 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.
  • Duplicated block (5 lines × 2) crates/polars-core/src/frame/builder.rs:195 — crates/polars-core/src/frame/builder.rs:195-199 | crates/polars-core/src/frame/builder.rs:225-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.
  • Duplicated block (5 lines × 2) crates/polars-core/src/frame/row/av_buffer.rs:240 — crates/polars-core/src/frame/row/av_buffer.rs:240-244 | crates/polars-core/src/frame/row/av_buffer.rs:716-720 — both copies are in the same file, so extract the 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-core/src/frame/row/av_buffer.rs:246 — crates/polars-core/src/frame/row/av_buffer.rs:246-250 | crates/polars-core/src/frame/row/av_buffer.rs:722-726 — both copies are in the same file, so extract the 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-core/src/frame/row/av_buffer.rs:252 — crates/polars-core/src/frame/row/av_buffer.rs:252-256 | crates/polars-core/src/frame/row/av_buffer.rs:728-732 — both copies are in the same file, so extract the 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-core/src/frame/row/av_buffer.rs:258 — crates/polars-core/src/frame/row/av_buffer.rs:258-262 | crates/polars-core/src/frame/row/av_buffer.rs:734-738 — both copies are in the same file, so extract the 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-core/src/series/mod.rs:712 — crates/polars-core/src/series/mod.rs:712-716 | crates/polars-core/src/series/mod.rs:763-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.
  • Duplicated block (5 lines × 2) crates/polars-core/src/series/mod.rs:729 — crates/polars-core/src/series/mod.rs:729-733 | crates/polars-core/src/series/mod.rs:746-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.
  • Duplicated block (5 lines × 2) crates/polars-core/src/utils/supertype.rs:325 — crates/polars-core/src/utils/supertype.rs:325-329 | crates/polars-core/src/utils/supertype.rs:331-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.
  • Duplicated block (5 lines × 2) crates/polars-core/src/utils/supertype.rs:362 — crates/polars-core/src/utils/supertype.rs:362-366 | crates/polars-core/src/utils/supertype.rs:370-374 — both copies are in the same file, so extract the 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.
  • Duplicated block (5 lines × 2) crates/polars-expr/src/dispatch/pow.rs:43 — crates/polars-expr/src/dispatch/pow.rs:43-47 | crates/polars-expr/src/dispatch/pow.rs:82-86 — both copies are in the same file, so extract the 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/expressions/apply.rs:284 — crates/polars-expr/src/expressions/apply.rs:284-288 | crates/polars-expr/src/expressions/structeval.rs:107-111 — 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 6 separate duplicated blocks between them, totalling at least 80 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 × 2) crates/polars-expr/src/hot_groups/binview.rs:149 — crates/polars-expr/src/hot_groups/binview.rs:149-153 | crates/polars-expr/src/hot_groups/binview.rs:162-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.
  • 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.
  • Duplicated block (5 lines × 2) crates/polars-expr/src/reduce/mod.rs:405 — crates/polars-expr/src/reduce/mod.rs:405-409 | crates/polars-expr/src/reduce/mod.rs:666-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.
  • Duplicated block (5 lines × 2) crates/polars-expr/src/reduce/mod.rs:481 — crates/polars-expr/src/reduce/mod.rs:481-485 | crates/polars-expr/src/reduce/mod.rs:491-495 — both copies are in the same file, so extract the 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-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.
  • 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.
  • 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.
  • Duplicated block (5 lines × 2) crates/polars-ops/src/chunked_array/strings/extract.rs:105 — crates/polars-ops/src/chunked_array/strings/extract.rs:105-109 | crates/polars-ops/src/chunked_array/strings/extract.rs:130-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.
  • + 51 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_plan · ×67
  • polars_plan::plans::conversion::dsl_to_ir::to_alp_impl (cognitive 240) crates/polars-plan/src/plans/conversion/dsl_to_ir/mod.rs:193 — 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:623 — 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 150) 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 150 (threshold 15). Drivers by points: match/switch 32 (68 pts), if/else 27 (63 pts), loops 5 (17 pts), boolean chains 2 (nesting depth added 84). 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::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec (cognitive 122) crates/polars-plan/src/plans/aexpr/predicates/skip_batches.rs:269 — polars_plan::plans::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec has cognitive complexity 122 (threshold 15). Drivers by points: if/else 28 (79 pts), match/switch 11 (34 pts), loops 2 (6 pts), boolean chains 3 (nesting depth added 78). To reduce it, split the body into named stages: move each independent 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 (cognitive 66) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:264 — polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec 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:1128 — 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 62) crates/polars-plan/src/plans/optimizer/mod.rs:112 — polars_plan::plans::optimizer::optimize has cognitive complexity 62 (threshold 15). Drivers by points: if/else 33 (46 pts), boolean chains 8, 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::conversion::dsl_to_ir::scans::parquet_column_stats (cognitive 56) crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:636 — polars_plan::plans::conversion::dsl_to_ir::scans::parquet_column_stats has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (27 pts), match/switch 6 (20 pts), boolean chains 6, loops 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.
  • polars_plan::plans::hive::hive_partitions_from_paths (cognitive 56) crates/polars-plan/src/plans/hive.rs:80 — 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::optimizer::slice_pushdown_expr::aexpr_slice_pushdown_top (cognitive 55) crates/polars-plan/src/plans/optimizer/slice_pushdown_expr.rs:335 — polars_plan::plans::optimizer::slice_pushdown_expr::aexpr_slice_pushdown_top has cognitive complexity 55 (threshold 15). Drivers by points: if/else 22 (42 pts), match/switch 4 (7 pts), boolean chains 4, loops 2 (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_plan::plans::ir::format::write_ir_non_recursive (cognitive 54) crates/polars-plan/src/plans/ir/format.rs:899 — 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::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::python::pyarrow::predicate_to_pa (cognitive 49) crates/polars-plan/src/plans/python/pyarrow.rs:206 — polars_plan::plans::python::pyarrow::predicate_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:338 — 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:503 — 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.
  • polars_plan::plans::conversion::type_coercion::binary::coerce_comparison_literal (cognitive 43) crates/polars-plan/src/plans/conversion/type_coercion/binary.rs:543 — polars_plan::plans::conversion::type_coercion::binary::coerce_comparison_literal has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (21 pts), match/switch 10 (16 pts), boolean chains 6 (nesting depth added 11). Of this number, 37 points are the body's own statements and 6 belong to 2 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.
  • + 42 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×64
  • 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.
  • 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/moment.rs:332 — crates/polars-compute/src/moment.rs:332-339 | crates/polars-compute/src/moment.rs:465-472 — both copies are in the same file, so extract the 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.
  • 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.
  • Duplicated block (8 lines × 2) crates/polars-core/src/chunked_array/ops/arity.rs:258 — crates/polars-core/src/chunked_array/ops/arity.rs:258-265 | crates/polars-core/src/chunked_array/ops/arity.rs:335-342 — both copies are in the same file, so extract the 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-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/mod.rs:596 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:596-603 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:781-788 — both copies are in the same file, so extract the 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-core/src/frame/group_by/aggregations/mod.rs:1042 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1042-1049 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1119-1126 — both copies are in the same file, so extract the 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-core/src/series/any_value.rs:360 — crates/polars-core/src/series/any_value.rs:360-367 | crates/polars-core/src/series/any_value.rs:375-382 — both copies are in the same file, so extract the 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-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.
  • 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 5 separate duplicated blocks between them, totalling at least 64 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 (8 lines × 2) crates/polars-expr/src/expressions/slice.rs:176 — crates/polars-expr/src/expressions/slice.rs:176-183 | crates/polars-expr/src/expressions/slice.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.
  • Duplicated block (8 lines × 2) crates/polars-expr/src/groups/row_encoded.rs:133 — crates/polars-expr/src/groups/row_encoded.rs:133-140 | crates/polars-expr/src/groups/row_encoded.rs:184-191 — both copies are in the same file, so extract the 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/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.
  • Duplicated block (8 lines × 2) crates/polars-expr/src/reduce/first_last.rs:493 — crates/polars-expr/src/reduce/first_last.rs:493-500 | crates/polars-expr/src/reduce/first_last_nonnull.rs:484-491 — 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/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.
  • Duplicated block (8 lines × 2) crates/polars-ops/src/chunked_array/array/dispersion.rs:12 — crates/polars-ops/src/chunked_array/array/dispersion.rs:12-19 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:232-239 — 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-ops/src/chunked_array/array/dispersion.rs:47 — crates/polars-ops/src/chunked_array/array/dispersion.rs:47-54 | crates/polars-ops/src/chunked_array/list/dispersion.rs:14-21 — `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 6 separate duplicated blocks between them, totalling at least 39 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 (8 lines × 2) crates/polars-ops/src/chunked_array/array/dispersion.rs:82 — crates/polars-ops/src/chunked_array/array/dispersion.rs:82-89 | crates/polars-ops/src/chunked_array/list/dispersion.rs:59-66 — `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 6 separate duplicated blocks between them, totalling at least 39 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.
  • + 39 more in this group — see findings.md.
D1 · Cyclomatic Complexity · polars_plan · ×62
  • polars_plan::plans::conversion::dsl_to_ir::functions::convert_functions (cyclomatic 420) 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 420 (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 368) crates/polars-plan/src/plans/conversion/ir_to_dsl.rs:338 — polars_plan::plans::conversion::ir_to_dsl::ir_function_to_dsl has cyclomatic complexity 368 (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:193 — 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::optimizer::predicate_pushdown::join::predicate_pruning::try_rewrite_join_type (cyclomatic 78) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:623 — 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::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec (cyclomatic 75) crates/polars-plan/src/plans/aexpr/predicates/skip_batches.rs:269 — polars_plan::plans::aexpr::predicates::skip_batches::aexpr_to_skip_batch_predicate_rec has cyclomatic complexity 75 (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::conversion::dsl_to_ir::expr_expansion::expand_expression_rec (cyclomatic 70) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:264 — polars_plan::plans::conversion::dsl_to_ir::expr_expansion::expand_expression_rec 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 (cyclomatic 58) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_to_ir.rs:123 — polars_plan::plans::conversion::dsl_to_ir::expr_to_ir::to_aexpr_impl 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 55) crates/polars-plan/src/plans/aexpr/schema.rs:587 — polars_plan::plans::aexpr::schema::get_arithmetic_field has cyclomatic complexity 55 (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 49) crates/polars-plan/src/plans/conversion/type_coercion/binary.rs:543 — polars_plan::plans::conversion::type_coercion::binary::coerce_comparison_literal has cyclomatic complexity 49 (threshold 15). Of this number, 43 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::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:899 — 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 45) crates/polars-plan/src/plans/optimizer/mod.rs:112 — polars_plan::plans::optimizer::optimize 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.
  • polars_plan::plans::aexpr::schema::get_truediv_dtype (cyclomatic 41) crates/polars-plan/src/plans/aexpr/schema.rs:889 — polars_plan::plans::aexpr::schema::get_truediv_dtype 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_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::predicate_to_pa (cyclomatic 40) crates/polars-plan/src/plans/python/pyarrow.rs:206 — polars_plan::plans::python::pyarrow::predicate_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:306 — 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:1531 — 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::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.
  • polars_plan::plans::optimizer::slice_pushdown_expr::aexpr_slice_pushdown_top (cyclomatic 33) crates/polars-plan/src/plans/optimizer/slice_pushdown_expr.rs:335 — polars_plan::plans::optimizer::slice_pushdown_expr::aexpr_slice_pushdown_top 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.
  • + 37 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×54
  • Duplicated block (11 lines × 2) crates/polars-compute/src/rolling/moment.rs:286 — crates/polars-compute/src/rolling/moment.rs:286-296 | 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.
  • 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.
  • Duplicated block (11 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1089 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1089-1099 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1169-1179 — both copies are in the same file, so extract the 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/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 5 separate duplicated blocks between them, totalling at least 64 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/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.
  • 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.
  • Duplicated block (11 lines × 2) crates/polars-expr/src/expressions/sortby.rs:177 — crates/polars-expr/src/expressions/sortby.rs:177-188 | crates/polars-expr/src/expressions/sortby.rs:195-205 — both copies are in the same file, so extract the 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/reduce/cov.rs:105 — crates/polars-expr/src/reduce/cov.rs:105-115 | crates/polars-expr/src/reduce/cov.rs:251-261 — both copies are in the same file, so extract the 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/reduce/implode.rs:103 — crates/polars-expr/src/reduce/implode.rs:103-113 | crates/polars-expr/src/reduce/unique.rs:258-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.
  • 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.
  • Duplicated block (11 lines × 2) crates/polars-io/src/cloud/credential_provider.rs:620 — crates/polars-io/src/cloud/credential_provider.rs:620-630 | crates/polars-io/src/cloud/credential_provider.rs:805-815 — both copies are in the same file, so extract the 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.
  • 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.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/frame/join/asof/groups.rs:301 — crates/polars-ops/src/frame/join/asof/groups.rs:301-311 | crates/polars-ops/src/frame/join/asof/groups.rs:333-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.
  • 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.
  • 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.
  • 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.
  • Duplicated block (11 lines × 2) crates/polars-ops/src/frame/join/merge_join.rs:295 — crates/polars-ops/src/frame/join/merge_join.rs:295-305 | crates/polars-ops/src/frame/join/merge_join.rs:306-316 — both copies are in the same file, so extract the 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • + 29 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×54
  • Duplicated block (7 lines × 2) crates/polars-compute/src/approx_quantile.rs:697 — crates/polars-compute/src/approx_quantile.rs:697-703 | crates/polars-compute/src/approx_quantile.rs:1051-1057 — both copies are in the same file, so extract the 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-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.
  • Duplicated block (7 lines × 2) crates/polars-compute/src/moment.rs:341 — crates/polars-compute/src/moment.rs:341-347 | crates/polars-compute/src/moment.rs:474-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.
  • 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.
  • 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-compute/src/unique/distinct.rs:544 — crates/polars-compute/src/unique/distinct.rs:544-550 | crates/polars-compute/src/unique/distinct.rs:729-735 — both copies are in the same file, so extract the 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-compute/src/unique/distinct.rs:633 — crates/polars-compute/src/unique/distinct.rs:633-639 | crates/polars-compute/src/unique/distinct.rs:790-796 — both copies are in the same file, so extract the 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/chunked_array/ops/row_encode.rs:192 — crates/polars-core/src/chunked_array/ops/row_encode.rs:192-198 | crates/polars-core/src/chunked_array/ops/row_encode.rs:227-233 — both copies are in the same file, so extract the 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:1014 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1014-1020 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1087-1093 — both copies are in the same file, so extract the 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/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.
  • 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.
  • 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.
  • 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.
  • Duplicated block (7 lines × 2) crates/polars-expr/src/expressions/eval.rs:172 — crates/polars-expr/src/expressions/eval.rs:172-178 | crates/polars-expr/src/expressions/eval.rs:348-354 — both copies are in the same file, so extract the 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-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.
  • 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.
  • Duplicated block (7 lines × 2) crates/polars-expr/src/reduce/cov.rs:135 — crates/polars-expr/src/reduce/cov.rs:135-141 | crates/polars-expr/src/reduce/cov.rs:281-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.
  • Duplicated block (7 lines × 2) crates/polars-expr/src/reduce/min_max_by.rs:588 — crates/polars-expr/src/reduce/min_max_by.rs:588-594 | crates/polars-expr/src/reduce/min_max_by.rs:642-648 — both copies are in the same file, so extract the 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-io/src/csv/read/parser.rs:447 — crates/polars-io/src/csv/read/parser.rs:447-453 | crates/polars-io/src/csv/read/parser.rs:692-698 — both copies are in the same file, so extract the 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-io/src/csv/write/write_impl/serializer.rs:514 — crates/polars-io/src/csv/write/write_impl/serializer.rs:514-520 | crates/polars-io/src/csv/write/write_impl/serializer.rs:528-534 — both copies are in the same file, so extract the 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-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.
  • Duplicated block (7 lines × 2) crates/polars-ops/src/chunked_array/array/dispersion.rs:90 — crates/polars-ops/src/chunked_array/array/dispersion.rs:90-96 | crates/polars-ops/src/chunked_array/list/dispersion.rs:67-73 — `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 6 separate duplicated blocks between them, totalling at least 39 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 × 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.
  • 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.
  • + 29 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×48
  • 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.
  • 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-compute/src/unique/distinct.rs:493 — crates/polars-compute/src/unique/distinct.rs:493-501 | crates/polars-compute/src/unique/distinct.rs:697-705 — both copies are in the same file, so extract the 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:616 — crates/polars-core/src/chunked_array/cast.rs:616-624 | crates/polars-core/src/chunked_array/cast.rs:641-649 — both copies are in the same file, so extract the 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/row_encode.rs:252 — crates/polars-core/src/chunked_array/ops/row_encode.rs:252-260 | crates/polars-core/src/chunked_array/ops/row_encode.rs:270-278 — both copies are in the same file, so extract the 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/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.
  • Duplicated block (9 lines × 2) crates/polars-core/src/series/arithmetic/fixed_size_list.rs:178 — crates/polars-core/src/series/arithmetic/fixed_size_list.rs:178-186 | crates/polars-core/src/series/arithmetic/list.rs:259-267 — 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 5 separate duplicated blocks between them, totalling at least 64 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 (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.
  • Duplicated block (9 lines × 2) crates/polars-core/src/series/mod.rs:565 — crates/polars-core/src/series/mod.rs:565-573 | crates/polars-core/src/series/mod.rs:577-585 — both copies are in the same file, so extract the 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/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.
  • Duplicated block (9 lines × 2) crates/polars-expr/src/expressions/group_iter.rs:81 — crates/polars-expr/src/expressions/group_iter.rs:81-89 | crates/polars-expr/src/expressions/group_iter.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.
  • 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.
  • Duplicated block (9 lines × 2) crates/polars-expr/src/reduce/mod.rs:422 — crates/polars-expr/src/reduce/mod.rs:422-430 | crates/polars-expr/src/reduce/mod.rs:686-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.
  • 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.
  • 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.
  • 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 36 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 (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.
  • 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:926-934 — both copies are in the same file, so extract the 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/chunked_array/list/namespace.rs:463 — crates/polars-ops/src/chunked_array/list/namespace.rs:463-471 | crates/polars-ops/src/chunked_array/list/namespace.rs:537-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.
  • Duplicated block (9 lines × 2) crates/polars-ops/src/chunked_array/list/sets.rs:148 — crates/polars-ops/src/chunked_array/list/sets.rs:148-156 | crates/polars-ops/src/chunked_array/list/sets.rs:251-259 — both copies are in the same file, so extract the 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/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/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.
  • 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.
  • Duplicated block (9 lines × 2) crates/polars-ops/src/series/ops/is_in/mod.rs:684 — crates/polars-ops/src/series/ops/is_in/mod.rs:684-692 | crates/polars-ops/src/series/ops/is_in/mod.rs:696-704 — both copies are in the same file, so extract the 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/rolling.rs:20 — crates/polars-ops/src/series/ops/rolling.rs:20-28 | crates/polars-ops/src/series/ops/rolling.rs:84-92 — both copies are in the same file, so extract the 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 (6 lines × 2) · ×45
  • Duplicated block (6 lines × 2) crates/polars-compute/src/approx_quantile.rs:688 — crates/polars-compute/src/approx_quantile.rs:688-693 | crates/polars-compute/src/approx_quantile.rs:1043-1048 — both copies are in the same file, so extract the 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-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.
  • Duplicated block (6 lines × 2) crates/polars-compute/src/unique/primitive.rs:104 — crates/polars-compute/src/unique/primitive.rs:104-109 | crates/polars-compute/src/unique/primitive.rs:123-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.
  • Duplicated block (6 lines × 2) crates/polars-core/src/chunked_array/ops/arity.rs:701 — crates/polars-core/src/chunked_array/ops/arity.rs:701-706 | crates/polars-core/src/chunked_array/ops/arity.rs:742-747 — both copies are in the same file, so extract the 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/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/chunked_array/ops/row_encode.rs:184 — crates/polars-core/src/chunked_array/ops/row_encode.rs:184-189 | crates/polars-core/src/chunked_array/ops/row_encode.rs:219-224 — both copies are in the same file, so extract the 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:1312 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1312-1317 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1362-1367 — both copies are in the same file, so extract the 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/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.
  • 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.
  • 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.
  • Duplicated block (6 lines × 2) crates/polars-expr/src/dispatch/rolling.rs:38 — crates/polars-expr/src/dispatch/rolling.rs:38-43 | crates/polars-expr/src/dispatch/rolling_by.rs:28-33 — 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 (6 lines × 2) crates/polars-expr/src/expressions/slice.rs:179 — crates/polars-expr/src/expressions/slice.rs:179-184 | crates/polars-expr/src/expressions/slice.rs:221-226 — both copies are in the same file, so extract the 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-expr/src/hot_groups/fixed_index_table.rs:108 — crates/polars-expr/src/hot_groups/fixed_index_table.rs:108-113 | crates/polars-expr/src/hot_groups/fixed_index_table.rs:119-124 — both copies are in the same file, so extract the 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-expr/src/reduce/count.rs:106 — crates/polars-expr/src/reduce/count.rs:106-111 | crates/polars-expr/src/reduce/count.rs:238-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.
  • Duplicated block (6 lines × 2) crates/polars-expr/src/reduce/mod.rs:510 — crates/polars-expr/src/reduce/mod.rs:510-515 | crates/polars-expr/src/reduce/mod.rs:758-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.
  • Duplicated block (6 lines × 2) crates/polars-io/src/utils/other.rs:106 — crates/polars-io/src/utils/other.rs:106-111 | crates/polars-io/src/utils/other.rs:135-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.
  • 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.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/chunked_array/gather/chunked.rs:234 — crates/polars-ops/src/chunked_array/gather/chunked.rs:234-239 | crates/polars-ops/src/chunked_array/gather/chunked.rs:334-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.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/chunked_array/list/min_max.rs:82 — crates/polars-ops/src/chunked_array/list/min_max.rs:82-87 | crates/polars-ops/src/chunked_array/list/min_max.rs:200-205 — both copies are in the same file, so extract the 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-ops/src/chunked_array/nan_propagating_aggregate.rs:73 — crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:73-78 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.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.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/chunked_array/repeat_by.rs:50 — crates/polars-ops/src/chunked_array/repeat_by.rs:50-55 | crates/polars-ops/src/chunked_array/repeat_by.rs:64-69 — both copies are in the same file, so extract the 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-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.
  • 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.
  • Duplicated block (6 lines × 2) crates/polars-ops/src/series/ops/ewm_by.rs:138 — crates/polars-ops/src/series/ops/ewm_by.rs:138-143 | crates/polars-ops/src/series/ops/ewm_by.rs:163-168 — both copies are in the same file, so extract the 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-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.
  • + 20 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_ops · ×43
  • 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:221 — 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::frame::join::merge_join::match_keys_impl (cognitive 35) crates/polars-ops/src/frame/join/merge_join.rs:89 — polars_ops::frame::join::merge_join::match_keys_impl has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 2 (8 pts), loops 2 (4 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.
  • polars_ops::series::ops::strings::str_format (cognitive 34) crates/polars-ops/src/series/ops/strings.rs:17 — polars_ops::series::ops::strings::str_format has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 4 (7 pts), match/switch 1 (3 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.
  • 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::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:42 — 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::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:891 — 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:252 — 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::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.
  • polars_ops::series::ops::duration::impl_duration (cognitive 22) crates/polars-ops/src/series/ops/duration.rs:7 — polars_ops::series::ops::duration::impl_duration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 3, 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.
  • + 18 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×43
  • Duplicated block (10 lines × 2) crates/polars-compute/src/comparisons/array.rs:44 — crates/polars-compute/src/comparisons/array.rs:44-53 | crates/polars-compute/src/comparisons/array.rs:70-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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • Duplicated block (10 lines × 2) crates/polars-core/src/datatypes/_serde.rs:112 — crates/polars-core/src/datatypes/_serde.rs:112-121 | crates/polars-core/src/datatypes/_serde.rs:176-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 (10 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1339 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1339-1348 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1390-1399 — both copies are in the same file, so extract the 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-core/src/frame/row/av_buffer.rs:807 — crates/polars-core/src/frame/row/av_buffer.rs:807-816 | crates/polars-core/src/frame/row/av_buffer.rs:832-841 — both copies are in the same file, so extract the 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-core/src/series/any_value.rs:385 — crates/polars-core/src/series/any_value.rs:385-394 | crates/polars-core/src/series/any_value.rs:396-405 — both copies are in the same file, so extract the 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-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.
  • 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.
  • Duplicated block (10 lines × 2) crates/polars-expr/src/expressions/apply.rs:604 — crates/polars-expr/src/expressions/apply.rs:604-613 | 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 6 separate duplicated blocks between them, totalling at least 80 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 (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.
  • Duplicated block (10 lines × 2) crates/polars-expr/src/reduce/cov.rs:116 — crates/polars-expr/src/reduce/cov.rs:116-125 | crates/polars-expr/src/reduce/cov.rs:262-271 — both copies are in the same file, so extract the 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-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-json/src/json/write/serialize.rs:506 — crates/polars-json/src/json/write/serialize.rs:506-515 | crates/polars-json/src/json/write/serialize.rs:520-529 — both copies are in the same file, so extract the 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • Duplicated block (10 lines × 2) crates/polars-ops/src/series/ops/cut.rs:151 — crates/polars-ops/src/series/ops/cut.rs:151-160 | crates/polars-ops/src/series/ops/cut.rs:219-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.
  • 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.
  • + 18 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×38
  • TooManyMethods: PyExpr crates/polars-python/src/expr/mod.rs:44 — TooManyMethods — 441 methods, declared across 15 files: expr/general.rs (189), expr/string.rs (55), expr/datetime.rs (43), expr/list.rs (31), +11 more file(s). The bar is 30 methods; this is 411 over it, 14.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: 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 — 316 methods. The bar is 30 methods; this is 286 over it, 10.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: Expr crates/polars-plan/src/dsl/expr/mod.rs:67 — TooManyMethods — 258 methods, declared across 8 files: dsl/mod.rs (187), dsl/arithmetic.rs (23), expr/mod.rs (18), dsl/statistics.rs (12), +4 more file(s). The bar is 30 methods; this is 228 over it, 8.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: Expr py-polars/src/polars/expr/expr.py:161 — TooManyMethods — 256 methods. The bar is 30 methods; this is 226 over it, 8.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: DataFrame py-polars/src/polars/dataframe/frame.py:207 — TooManyMethods — 218 methods. The bar is 30 methods; this is 188 over it, 7.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.
  • TooManyMethods: Column crates/polars-core/src/frame/column/mod.rs:43 — 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: 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 — 142 methods, declared across 22 files: chunked_array/mod.rs (55), ops/chunkops.rs (15), chunked_array/from.rs (14), aggregations/mod.rs (13), +18 more file(s). The bar is 30 methods; this is 112 over it, 4.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: SQLContext crates/polars-sql/src/context.rs:228 — TooManyMethods — 135 methods, declared across 2 files: src/context.rs (110), src/subquery.rs (25). The bar is 30 methods; this is 105 over it, 4.50× 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:195 — 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 — 93 methods, declared across 3 files: datatypes/dtype.rs (86), datatypes/field.rs (5), ops/json_map.rs (2). The bar is 30 methods; this is 63 over it, 3.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: PyDataFrame crates/polars-python/src/dataframe/mod.rs:20 — TooManyMethods — 90 methods, declared across 8 files: dataframe/general.rs (68), dataframe/io.rs (6), dataframe/export.rs (5), dataframe/serde.rs (4), +4 more file(s). The bar is 30 methods; this is 60 over it, 3.00× 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 — 88 methods, declared across 4 files: lazyframe/general.rs (82), lazyframe/serde.rs (4), lazyframe/exitable.rs (1), lazyframe/visit.rs (1). The bar is 30 methods; this is 58 over it, 2.93× 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:15 — 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:42 — TooManyMethods — 57 methods, declared across 2 files: src/functions.rs (48), src/window_frames.rs (9). The bar is 30 methods; this is 27 over it, 1.90× 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: 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: Config crates/polars-config/src/lib.rs:245 — TooManyMethods — 50 methods. The bar is 30 methods; this is 20 over it, 1.67× 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.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×38
  • 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.
  • Duplicated block (12 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:550 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:550-561 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:733-744 — both copies are in the same file, so extract the 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-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 5 separate duplicated blocks between them, totalling at least 64 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 (12 lines × 2) crates/polars-core/src/series/arithmetic/list.rs:603 — crates/polars-core/src/series/arithmetic/list.rs:603-614 | crates/polars-core/src/series/arithmetic/list.rs:701-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.
  • Duplicated block (12 lines × 2) crates/polars-expr/src/expressions/apply.rs:305 — crates/polars-expr/src/expressions/apply.rs:305-316 | 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 6 separate duplicated blocks between them, totalling at least 80 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 (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.
  • 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.
  • Duplicated block (12 lines × 2) crates/polars-expr/src/reduce/mod.rs:465 — crates/polars-expr/src/reduce/mod.rs:465-476 | crates/polars-expr/src/reduce/mod.rs:720-731 — both copies are in the same file, so extract the 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-lazy/src/frame/mod.rs:1079 — crates/polars-lazy/src/frame/mod.rs:1079-1090 | crates/polars-lazy/src/frame/mod.rs:1125-1136 — both copies are in the same file, so extract the 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/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/array/join.rs:14 — crates/polars-ops/src/chunked_array/array/join.rs:14-25 | crates/polars-ops/src/chunked_array/list/namespace.rs:95-106 — 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 (12 lines × 2) crates/polars-ops/src/chunked_array/array/to_struct.rs:53 — crates/polars-ops/src/chunked_array/array/to_struct.rs:53-64 | crates/polars-ops/src/chunked_array/list/to_struct.rs:49-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.
  • 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.
  • Duplicated block (12 lines × 2) crates/polars-ops/src/chunked_array/list/sets.rs:159 — crates/polars-ops/src/chunked_array/list/sets.rs:159-170 | crates/polars-ops/src/chunked_array/list/sets.rs:262-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.
  • 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.
  • 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.
  • 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.
  • Duplicated block (12 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs:145 — crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/optional_masked_dense.rs:145-156 | crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/required_masked_dense.rs:117-128 — 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 (12 lines × 2) crates/polars-parquet/src/arrow/write/binary/basic.rs:62 — crates/polars-parquet/src/arrow/write/binary/basic.rs:62-73 | 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.
  • Duplicated block (12 lines × 2) crates/polars-plan/src/dsl/file_scan/mod.rs:1201 — crates/polars-plan/src/dsl/file_scan/mod.rs:1201-1212 | 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.
  • Duplicated block (12 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs:353 — crates/polars-plan/src/plans/aexpr/traverse.rs:353-364 | crates/polars-plan/src/plans/aexpr/traverse.rs:465-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.
  • 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:970-981 — 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 40 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 (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.
  • Duplicated block (12 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs:1175 — crates/polars-stream/src/nodes/joins/equi_join.rs:1175-1186 | crates/polars-stream/src/nodes/joins/equi_join.rs:1263-1274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 13 more in this group — see findings.md.
D35 · Change Coupling · Change coupling · ×35
  • 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 (19 of the 21 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 `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 (53 of the 63 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 53 shared commits counted here, the most recent 3 are `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…; `efba0b7b` feat!: Type exact SQL numeric literals as Decimal and truncate SQL `%… — 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 75% of the time (9 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 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 9 shared commits counted here, the most recent 3 are `f6408481` fix: Fix EntityTooSmall on sink_ipc to S3 (#28255); `93bfdf9f` perf: Remove excess memory copy in streaming IPC sink (#28141); `3e16e784` refactor: Add sinked paths callback (#26995) — 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 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 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 8 shared commits counted here, the most recent 3 are `8bd626a6` perf: Push as-of join key filters to the right input (#30123); `9f475279` fix: Change AsOf join to be based on `TotalOrd` (#26497); `46b27141` feat: Add 'allow_exact_matches' join_asof' (#20723) — 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 71% of the time (12 of the 17 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 12 shared commits counted here, the most recent 3 are `5de4805c` feat: Add more expression properties to `meta` namespace (#28091); `1af179ab` refactor: Add schema parameters to `expr.meta` (#22906); `85b8de22` feat: Add an `is_literal` method to expression `meta` namespace (#19773) — 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: 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: 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 67% of the time (14 of the 21 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: 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: 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 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 `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: 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: 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: context.rs ↔ keywords.rs crates/polars-sql/src/context.rs:1 — `crates/polars-sql/src/context.rs` and `crates/polars-sql/src/keywords.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 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 `b0cba6eb` feat: Streamline SQL `INTERVAL` handling and improve related error me…; `62ff49da` feat(python,rust,cli): support left and right anti/semi joins from th…; `8b3a8407` feat(rust,python,cli): add sql DROP TABLE (#9355) (at that commit the files were still `polars/polars-sql/src/context.rs` and `polars/polars-sql/src/keywords.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: 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: 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 ↔ 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: read_impl.rs ↔ schema_inference.rs crates/polars-io/src/csv/read/read_impl.rs:1 — `crates/polars-io/src/csv/read/read_impl.rs` and `crates/polars-io/src/csv/read/schema_inference.rs` 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) 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 9 shared commits counted here, the most recent 3 are `3a780c26` feat!: Respect file column order when schema is given for `scan_csv()…; `f8dc1120` feat: Implement streaming CSV schema inference (#25911); `6b174770` fix: Allow `decimal_comma` with `,` separator in `read_csv` (#23657) — run `git show` on any of them.
  • Change coupling: mod.rs ↔ string.rs crates/polars-ops/src/chunked_array/strings/mod.rs:1 — `crates/polars-ops/src/chunked_array/strings/mod.rs` and `crates/polars-python/src/expr/string.rs` change together 50% of the time (7 of the 14 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 `74dad84e` feat: Add `str.normalize()` (#20483); `791c336f` feat: Added `escape_regex` operation to the `str` namespace and as a …; `ecc5c4cc` feat: str namespace; add aho-corasick expressions: 'contains_any' and… (at that commit the file was still `py-polars/src/expr/string.rs`) — 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 50% of the time (6 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 6 shared commits counted here, the most recent 3 are `f6408481` fix: Fix EntityTooSmall on sink_ipc to S3 (#28255); `93bfdf9f` perf: Remove excess memory copy in streaming IPC sink (#28141); `ad12e5dd` refactor(rust): Update `typos` to `v1.48.0` (#28162) — run `git show` on any of them.
  • + 10 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_stream · ×31
  • polars_stream::physical_plan::lower_ir::lower_ir_inner (cognitive 258) crates/polars-stream/src/physical_plan/lower_ir.rs:278 — polars_stream::physical_plan::lower_ir::lower_ir_inner has cognitive complexity 258 (threshold 15). Drivers by points: if/else 78 (170 pts), match/switch 18 (47 pts), loops 8 (24 pts), boolean chains 17 (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 128) crates/polars-stream/src/physical_plan/to_graph.rs:137 — polars_stream::physical_plan::to_graph::to_graph_rec has cognitive complexity 128 (threshold 15). Drivers by points: if/else 29 (71 pts), loops 12 (35 pts), match/switch 9 (21 pts), boolean chains 1 (nesting depth added 77). To reduce it, split the body into named stages: move each independent 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 118) crates/polars-stream/src/physical_plan/lower_expr.rs:599 — polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx has cognitive complexity 118 (threshold 15). Drivers by points: if/else 26 (61 pts), match/switch 13 (35 pts), loops 5 (15 pts), boolean chains 7 (nesting depth added 67). To reduce it, split the body into named stages: move each independent 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:651 — 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:92 — 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 (cognitive 48) crates/polars-stream/src/physical_plan/lower_group_by.rs:893 — polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by 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::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:456 — 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::lower_group_by::try_lower_elementwise_scalar_agg_expr (cognitive 36) crates/polars-stream/src/physical_plan/lower_group_by.rs:262 — polars_stream::physical_plan::lower_group_by::try_lower_elementwise_scalar_agg_expr has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 5 (10 pts), boolean chains 3 (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_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:287 — 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::joins::merge_join::find_mergeable_search (cognitive 25) crates/polars-stream/src/nodes/joins/merge_join.rs:646 — 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:493 — 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:524 — 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.rs:238 — 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::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::joins::merge_join::find_mergeable_task (cognitive 21) crates/polars-stream/src/nodes/joins/merge_join.rs:366 — polars_stream::nodes::joins::merge_join::find_mergeable_task has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (4 pts), match/switch 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::nodes::joins::merge_join::compute_join_and_send (cognitive 20) crates/polars-stream/src/nodes/joins/merge_join.rs:449 — polars_stream::nodes::joins::merge_join::compute_join_and_send has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 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.
  • polars_stream::nodes::window::evaluate::evaluate (cognitive 20) crates/polars-stream/src/nodes/window/evaluate.rs:35 — polars_stream::nodes::window::evaluate::evaluate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 3 (4 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.
  • + 6 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_parquet · ×28
  • polars_parquet::arrow::read::deserialize::nested_utils::decode_nested (cognitive 88) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs:409 — polars_parquet::arrow::read::deserialize::nested_utils::decode_nested has cognitive complexity 88 (threshold 15). Drivers by points: if/else 14 (52 pts), loops 6 (25 pts), boolean chains 11 (nesting depth added 57). 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::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:368 — 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:455 — 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::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::geo::geo_key_value (cognitive 22) crates/polars-parquet/src/arrow/geo.rs:150 — polars_parquet::arrow::geo::geo_key_value has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 6 (12 pts), if/else 4 (7 pts), boolean chains 2, loops 1 (nesting depth added 9). 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::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::arrow::geo::apply_geo_metadata (cognitive 19) crates/polars-parquet/src/arrow/geo.rs:80 — polars_parquet::arrow::geo::apply_geo_metadata has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts), match/switch 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.
  • 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::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.
  • polars_parquet::arrow::read::deserialize::dictionary_encoded::predicate::decode_multiple (cognitive 17) crates/polars-parquet/src/arrow/read/deserialize/dictionary_encoded/predicate.rs:82 — polars_parquet::arrow::read::deserialize::dictionary_encoded::predicate::decode_multiple 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_single) 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_parquet::arrow::read::statistics::deserialize_all (cognitive 17) crates/polars-parquet/src/arrow/read/statistics.rs:155 — polars_parquet::arrow::read::statistics::deserialize_all has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (11 pts), loops 2 (4 pts), if/else 1 (2 pts) (nesting depth added 9). 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.
  • + 3 more in this group — see findings.md.
D2 · Cognitive Complexity · polars_core · ×26
  • polars_core::chunked_array::ops::search_sorted::binary_search_ca (cognitive 53) crates/polars-core/src/chunked_array/ops/search_sorted.rs:135 — 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 51) crates/polars-core/src/utils/supertype.rs:154 — polars_core::utils::supertype::get_supertype_with_options::inner has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (29 pts), match/switch 5 (11 pts), boolean chains 9, loops 1 (2 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_core::chunked_array::ops::append::update_sorted_flag_before_append (cognitive 40) crates/polars-core/src/chunked_array/ops/append.rs:29 — 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:690 — 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::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:343 — 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:776 — 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::series::any_value::any_values_to_struct (cognitive 19) crates/polars-core/src/series/any_value.rs:875 — polars_core::series::any_value::any_values_to_struct has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (7 pts), loops 3 (5 pts), match/switch 3 (5 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.
  • 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:161 — 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.
  • + 1 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 64) crates/polars-io/src/csv/read/parser.rs:1096 — polars_io::csv::read::parser::parse_lines has cognitive complexity 64 (threshold 15). Drivers by points: if/else 14 (47 pts), match/switch 2 (8 pts), loops 3 (5 pts), boolean chains 4 (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_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:577 — 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::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:270 — 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:216 — 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::write::write_impl::serializer::string_serializer (cognitive 25) crates/polars-io/src/csv/write/write_impl/serializer.rs:442 — polars_io::csv::write::write_impl::serializer::string_serializer has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 3 (5 pts), loops 1 (2 pts) (nesting depth added 12). Of this number, 15 points are the body's own statements and 10 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.
  • 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:67 — 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 · Duplicated block (14 lines × 2) · ×25
  • 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.
  • 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.
  • 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.
  • 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.
  • Duplicated block (14 lines × 2) crates/polars-expr/src/expressions/apply.rs:301 — crates/polars-expr/src/expressions/apply.rs:301-314 | crates/polars-expr/src/expressions/apply.rs:326-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.
  • 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-expr/src/groups/binview.rs:220 — crates/polars-expr/src/groups/binview.rs:220-233 | crates/polars-expr/src/groups/binview.rs:263-276 — both copies are in the same file, so extract the 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-lazy/src/frame/mod.rs:1026 — crates/polars-lazy/src/frame/mod.rs:1026-1039 | crates/polars-lazy/src/frame/mod.rs:1144-1157 — both copies are in the same file, so extract the 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-mem-engine/src/executors/group_by_dynamic.rs:52 — crates/polars-mem-engine/src/executors/group_by_dynamic.rs:52-65 | crates/polars-mem-engine/src/executors/group_by_rolling.rs:87-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 36 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 (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.
  • Duplicated block (14 lines × 2) crates/polars-ops/src/chunked_array/array/to_struct.rs:30 — crates/polars-ops/src/chunked_array/array/to_struct.rs:30-43 | crates/polars-ops/src/chunked_array/list/to_struct.rs:26-39 — 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 (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.
  • Duplicated block (14 lines × 2) crates/polars-ops/src/chunked_array/list/namespace.rs:769 — crates/polars-ops/src/chunked_array/list/namespace.rs:769-782 | crates/polars-ops/src/chunked_array/list/namespace.rs:806-819 — both copies are in the same file, so extract the 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-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.
  • 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.
  • 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.
  • Duplicated block (14 lines × 2) crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:87 — crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:87-100 | crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:132-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.
  • Duplicated block (14 lines × 2) crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:561 — crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:561-574 | crates/polars-plan/src/plans/conversion/dsl_to_ir/expr_expansion.rs:753-766 — both copies are in the same file, so extract the 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-plan/src/plans/conversion/type_coercion/binary.rs:679 — crates/polars-plan/src/plans/conversion/type_coercion/binary.rs:679-692 | crates/polars-plan/src/plans/conversion/type_coercion/binary.rs:696-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.
  • 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:730-743 — 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 (14 lines × 2) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1125 — crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1125-1138 | crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1271-1284 — both copies are in the same file, so extract the 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-plan/src/plans/python/pyarrow.rs:364 — crates/polars-plan/src/plans/python/pyarrow.rs:364-377 | crates/polars-plan/src/plans/python/pyarrow.rs:765-778 — both copies are in the same file, so extract the 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-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.
  • Duplicated block (14 lines × 2) crates/polars-expr/src/reduce/skew_kurtosis.rs:62 — crates/polars-expr/src/reduce/skew_kurtosis.rs:62-75 | crates/polars-expr/src/reduce/var_std.rs:34-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 (14 lines × 2) crates/polars-sql/src/subquery.rs:1296 — crates/polars-sql/src/subquery.rs:1296-1309 | crates/polars-sql/src/subquery.rs:1468-1481 — both copies are in the same file, so extract the 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 (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.
  • 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/frame/group_by/aggregations/mod.rs:1064 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1064-1076 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1141-1153 — both copies are in the same file, so extract the 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.
  • 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.
  • 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.
  • Duplicated block (13 lines × 2) crates/polars-expr/src/expressions/group_iter.rs:93 — crates/polars-expr/src/expressions/group_iter.rs:93-105 | crates/polars-expr/src/expressions/group_iter.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.
  • Duplicated block (13 lines × 2) crates/polars-expr/src/expressions/slice.rs:185 — crates/polars-expr/src/expressions/slice.rs:185-197 | crates/polars-expr/src/expressions/slice.rs:275-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.
  • 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:228-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 (13 lines × 2) crates/polars-expr/src/reduce/cov.rs:91 — crates/polars-expr/src/reduce/cov.rs:91-103 | crates/polars-expr/src/reduce/cov.rs:237-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.
  • Duplicated block (13 lines × 2) crates/polars-io/src/csv/read/splitfields.rs:263 — crates/polars-io/src/csv/read/splitfields.rs:263-275 | crates/polars-io/src/csv/read/splitfields.rs:352-364 — both copies are in the same file, so extract the 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-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 36 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.
  • Duplicated block (13 lines × 2) crates/polars-ops/src/chunked_array/array/join.rs:28 — crates/polars-ops/src/chunked_array/array/join.rs:28-40 | crates/polars-ops/src/chunked_array/list/namespace.rs:110-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.
  • 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.
  • 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.
  • Duplicated block (13 lines × 2) crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:116 — crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:116-128 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:183-195 — both copies are in the same file, so extract the 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-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:937-949 — 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 (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.
  • Duplicated block (13 lines × 2) crates/polars-plan/src/plans/aexpr/schema.rs:622 — crates/polars-plan/src/plans/aexpr/schema.rs:622-634 | crates/polars-plan/src/plans/aexpr/schema.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.
  • 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.
  • Duplicated block (13 lines × 2) crates/polars-sql/src/context.rs:3727 — crates/polars-sql/src/context.rs:3727-3739 | crates/polars-sql/src/sql_visitors.rs:631-643 — 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 (13 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:1541 — crates/polars-stream/src/physical_plan/lower_expr.rs:1541-1553 | crates/polars-stream/src/physical_plan/lower_expr.rs:1570-1582 — both copies are in the same file, so extract the 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-stream/src/physical_plan/to_graph.rs:1671 — crates/polars-stream/src/physical_plan/to_graph.rs:1671-1683 | crates/polars-stream/src/physical_plan/to_graph.rs:1740-1752 — both copies are in the same file, so extract the 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-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.
D3 · God Classes · ClassTooLong · ×23
  • ClassTooLong: SQLContext crates/polars-sql/src/context.rs:228 — ClassTooLong — 3519 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 135 methods, 5 blocks, lines 228-5333. The bar is 400 significant lines; this is 3119 over it, 8.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.
  • ClassTooLong: ProjectionPushdownVisitor crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:128 — ClassTooLong — 1340 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 128-2224. The bar is 400 significant lines; this is 940 over it, 3.35× 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:93 — ClassTooLong — 1245 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, 67 blocks, lines 72-2265. The bar is 400 significant lines; this is 845 over it, 3.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: SQLFunctionVisitor crates/polars-sql/src/functions.rs:42 — ClassTooLong — 1153 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 57 methods, 2 blocks, lines 42-3021. The bar is 400 significant lines; this is 753 over it, 2.88× 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 — 1129 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-1509. 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: Column crates/polars-core/src/frame/column/mod.rs:43 — ClassTooLong — 1126 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 43-1997. The bar is 400 significant lines; this is 726 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: SQLExprVisitor crates/polars-sql/src/sql_expr.rs:139 — ClassTooLong — 1121 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 39 methods, 2 blocks, lines 139-1957. The bar is 400 significant lines; this is 721 over it, 2.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.
  • ClassTooLong: DataType crates/polars-core/src/datatypes/dtype.rs:90 — ClassTooLong — 1118 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 93 methods, 8 blocks, lines 90-1978. The bar is 400 significant lines; this is 718 over it, 2.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.
  • ClassTooLong: AnyValue crates/polars-core/src/datatypes/any_value.rs:34 — ClassTooLong — 1084 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-1564. The bar is 400 significant lines; this is 684 over it, 2.71× 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 — 974 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-1996. The bar is 400 significant lines; this is 574 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 — 866 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-1269. The bar is 400 significant lines; this is 466 over it, 2.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.
  • ClassTooLong: FunctionExpr crates/polars-plan/src/dsl/function_expr/mod.rs:137 — ClassTooLong — 805 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-1048. The bar is 400 significant lines; this is 405 over it, 2.01× 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 — 652 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-1044. The bar is 400 significant lines; this is 252 over it, 1.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: WindowExpr crates/polars-expr/src/expressions/window.rs:27 — ClassTooLong — 624 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-1087. The bar is 400 significant lines; this is 224 over it, 1.56× 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: Duration crates/polars-defs/src/time/duration.rs:40 — ClassTooLong — 573 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-980. The bar is 400 significant lines; this is 173 over it, 1.43× 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: Config crates/polars-config/src/lib.rs:245 — ClassTooLong — 481 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 50 methods, 2 blocks, lines 245-943. The bar is 400 significant lines; this is 81 over it, 1.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.
  • 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: ExprOrderSimplifier crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:93 — ClassTooLong — 440 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-781. The bar is 400 significant lines; this is 40 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: ChunkedArray crates/polars-core/src/chunked_array/mod.rs:140 — ClassTooLong — 439 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 142 methods, 15 blocks, lines 140-1177. The bar is 400 significant lines; this is 39 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: SpillTokenInner crates/polars-ooc/src/spill_token.rs:55 — ClassTooLong — 418 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 24 methods, 5 blocks, lines 55-941. The bar is 400 significant lines; this is 18 over it, 1.05× 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: ListNameSpaceImpl crates/polars-ops/src/chunked_array/list/namespace.rs:71 — ClassTooLong — 412 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 23 methods. The bar is 400 significant lines; this is 12 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×20
  • Low cohesion: ChunkedArray (LCOM4 44) crates/polars-core/src/chunked_array/mod.rs:140 — ChunkedArray's methods fall into 44 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 44 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: 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: 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: 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:88 — 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: PythonConvertRegistry (LCOM4 4) crates/polars-utils/src/python_convert_registry.rs:53 — PythonConvertRegistry'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.
D2 · Cognitive Complexity · SQLContext · ×19
  • SQLContext::execute_select_block (cognitive 108) crates/polars-sql/src/context.rs:2557 — SQLContext::execute_select_block has cognitive complexity 108 (threshold 15). Drivers by points: if/else 42 (75 pts), match/switch 9 (16 pts), loops 8 (12 pts), boolean chains 5 (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.
  • SQLContext::process_group_by (cognitive 101) crates/polars-sql/src/context.rs:4662 — SQLContext::process_group_by has cognitive complexity 101 (threshold 15). Drivers by points: if/else 49 (75 pts), boolean chains 9, loops 7 (9 pts), match/switch 7 (8 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::try_attach_join_membership (cognitive 44) crates/polars-sql/src/subquery.rs:941 — SQLContext::try_attach_join_membership has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24 (33 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 43) crates/polars-sql/src/subquery.rs:1209 — SQLContext::try_decorrelate_scalar_subquery has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (28 pts), match/switch 3 (7 pts), boolean chains 6, 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.
  • SQLContext::get_table (cognitive 37) crates/polars-sql/src/context.rs:4259 — 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::execute_joins (cognitive 26) crates/polars-sql/src/context.rs:2007 — SQLContext::execute_joins has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 2 (7 pts), loops 1 (2 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.
  • SQLContext::process_wildcard_additional_options (cognitive 26) crates/polars-sql/src/context.rs:5223 — 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::try_first_row_order (cognitive 25) crates/polars-sql/src/subquery.rs:667 — SQLContext::try_first_row_order has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 2 (3 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.
  • SQLContext::execute_create_table (cognitive 24) crates/polars-sql/src/context.rs:4157 — 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) crates/polars-sql/src/context.rs:4420 — 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) crates/polars-sql/src/context.rs:1011 — 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::execute_delete_from_table (cognitive 22) crates/polars-sql/src/context.rs:1609 — SQLContext::execute_delete_from_table has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 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.
  • SQLContext::register_ctes (cognitive 20) crates/polars-sql/src/context.rs:1730 — 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) crates/polars-sql/src/context.rs:3250 — 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::rewrite_subquery_conjuncts (cognitive 20) crates/polars-sql/src/subquery.rs:51 — SQLContext::rewrite_subquery_conjuncts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 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.
  • SQLContext::process_join_on_subqueries (cognitive 17) crates/polars-sql/src/context.rs:3601 — SQLContext::process_join_on_subqueries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 2 (3 pts), boolean chains 1, 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::process_asof_join (cognitive 17) crates/polars-sql/src/context.rs:3809 — 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.
  • SQLContext::record_joined_aliases (cognitive 16) crates/polars-sql/src/context.rs:1109 — SQLContext::record_joined_aliases has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (5 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::execute_recursive_cte (cognitive 16) crates/polars-sql/src/context.rs:1781 — SQLContext::execute_recursive_cte has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, loops 2, 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 · Duplicated block (15 lines × 2) · ×17
  • Duplicated block (15 lines × 2) crates/polars-core/src/chunked_array/cast.rs:602 — crates/polars-core/src/chunked_array/cast.rs:602-616 | crates/polars-core/src/chunked_array/cast.rs:666-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.
  • Duplicated block (15 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:509 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:509-523 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:692-706 — both copies are in the same file, so extract the 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 (15 lines × 2) crates/polars-expr/src/expressions/apply.rs:87 — crates/polars-expr/src/expressions/apply.rs:87-101 | 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 6 separate duplicated blocks between them, totalling at least 80 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-expr/src/expressions/binary.rs:374 — crates/polars-expr/src/expressions/binary.rs:374-388 | crates/polars-expr/src/expressions/structeval.rs:317-331 — 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 (15 lines × 2) crates/polars-ops/src/series/ops/round.rs:304 — crates/polars-ops/src/series/ops/round.rs:304-318 | crates/polars-ops/src/series/ops/round.rs:346-360 — both copies are in the same file, so extract the 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 (15 lines × 2) crates/polars-plan/src/dsl/file_scan/mod.rs:1004 — crates/polars-plan/src/dsl/file_scan/mod.rs:1004-1018 | 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.
  • 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.
  • 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.
  • 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.
  • 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:50-64 — 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 (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.
  • 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.
  • Duplicated block (15 lines × 2) crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:392 — crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:392-406 | crates/polars-stream/src/nodes/io_sources/parquet/row_group_decode.rs:978-992 — both copies are in the same file, so extract the 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 (15 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs:443 — crates/polars-stream/src/nodes/joins/equi_join.rs:443-457 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:238-252 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 217 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-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.
  • 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.
  • 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.
D1 · Cyclomatic Complexity · polars_stream · ×16
  • polars_stream::physical_plan::lower_ir::lower_ir_inner (cyclomatic 152) crates/polars-stream/src/physical_plan/lower_ir.rs:278 — polars_stream::physical_plan::lower_ir::lower_ir_inner has cyclomatic complexity 152 (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 119) crates/polars-stream/src/physical_plan/lower_expr.rs:599 — polars_stream::physical_plan::lower_expr::lower_exprs_with_ctx has cyclomatic complexity 119 (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 108) crates/polars-stream/src/physical_plan/to_graph.rs:137 — polars_stream::physical_plan::to_graph::to_graph_rec has cyclomatic complexity 108 (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:651 — 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:262 — 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:92 — 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_group_by::try_build_streaming_group_by (cyclomatic 31) crates/polars-stream/src/physical_plan/lower_group_by.rs:893 — polars_stream::physical_plan::lower_group_by::try_build_streaming_group_by 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::physical_plan::lower_expr::is_input_independent_rec (cyclomatic 30) crates/polars-stream/src/physical_plan/lower_expr.rs:159 — polars_stream::physical_plan::lower_expr::is_input_independent_rec 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.
  • polars_stream::nodes::joins::merge_join::find_mergeable_search (cyclomatic 27) crates/polars-stream/src/nodes/joins/merge_join.rs:646 — 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:456 — 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 · ×16
  • 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::nested_utils::decode_nested (cyclomatic 29) crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs:409 — polars_parquet::arrow::read::deserialize::nested_utils::decode_nested 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.
  • 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:368 — 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:455 — 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:150 — polars_parquet::arrow::geo::geo_key_value 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.
  • 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.
D1 · Cyclomatic Complexity · polars_ops · ×16
  • 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:221 — 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::series::ops::strings::str_format (cyclomatic 17) crates/polars-ops/src/series/ops/strings.rs:17 — polars_ops::series::ops::strings::str_format 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::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.
  • polars_ops::frame::join::merge_join::match_keys_impl (cyclomatic 16) crates/polars-ops/src/frame/join/merge_join.rs:89 — polars_ops::frame::join::merge_join::match_keys_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.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×16
  • 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.
  • Duplicated block (7 lines × 3) crates/polars-core/src/frame/group_by/aggregations/mod.rs:557 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:557-563 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:740-746 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1016-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.
  • 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.
  • Duplicated block (7 lines × 3) crates/polars-expr/src/dispatch/struct_.rs:42 — crates/polars-expr/src/dispatch/struct_.rs:42-48 | crates/polars-expr/src/dispatch/struct_.rs:85-91 | crates/polars-expr/src/dispatch/struct_.rs:102-108 — 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 (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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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 39 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) 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-33 | docs/source/src/rust/user-guide/concepts/expressions.rs:12-18 | docs/source/src/rust/user-guide/getting-started.rs:12-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 6 separate duplicated blocks between them, totalling at least 64 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 (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-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.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×15
  • Duplicated block (5 lines × 3) 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 — 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 6 separate duplicated blocks between them, totalling at least 39 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 (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.
  • 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.
  • Duplicated block (5 lines × 3) crates/polars-sql/src/functions.rs:2806 — crates/polars-sql/src/functions.rs:2806-2810 | crates/polars-sql/src/functions.rs:2819-2823 | crates/polars-sql/src/functions.rs:2878-2882 — 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 6 separate duplicated blocks between them, totalling at least 66 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:1211 — crates/polars-stream/src/physical_plan/lower_expr.rs:1211-1219 | crates/polars-stream/src/physical_plan/lower_expr.rs:1502-1506 | crates/polars-stream/src/physical_plan/lower_expr.rs:1533-1539 — 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-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:296 — crates/polars-expr/src/dispatch/strings.rs:296-300 | crates/polars-expr/src/dispatch/strings.rs:309-313 | crates/polars-expr/src/dispatch/strings.rs:322-326 — 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:248 — crates/polars-core/src/utils/supertype.rs:248-252 | crates/polars-core/src/utils/supertype.rs:297-301 | crates/polars-core/src/utils/supertype.rs:304-308 — 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-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 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 (5 lines × 3) crates/polars-expr/src/reduce/first_last.rs:451 — crates/polars-expr/src/reduce/first_last.rs:451-455 | 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.
  • Duplicated block (5 lines × 3) 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:317-321 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:412-416 — 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/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.
  • 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.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×14
  • 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.
  • 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.
  • Duplicated block (18 lines × 2) crates/polars-ops/src/chunked_array/list/namespace.rs:441 — crates/polars-ops/src/chunked_array/list/namespace.rs:441-458 | crates/polars-ops/src/chunked_array/list/namespace.rs:515-532 — both copies are in the same file, so extract the 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/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.
  • 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.
  • Duplicated block (18 lines × 2) crates/polars-parquet/src/arrow/write/dictionary.rs:507 — crates/polars-parquet/src/arrow/write/dictionary.rs:507-524 | crates/polars-parquet/src/arrow/write/dictionary.rs:568-585 — both copies are in the same file, so extract the 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-sql/src/sql_expr.rs:2271 — crates/polars-sql/src/sql_expr.rs:2271-2288 | crates/polars-sql/src/sql_expr.rs:2343-2360 — both copies are in the same file, so extract the 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-sql/src/subquery.rs:338 — crates/polars-sql/src/subquery.rs:338-355 | crates/polars-sql/src/subquery.rs:1684-1701 — both copies are in the same file, so extract the 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/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.
  • Duplicated block (18 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:854 — crates/polars-stream/src/physical_plan/lower_expr.rs:854-871 | crates/polars-stream/src/physical_plan/lower_expr.rs:914-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.
  • Duplicated block (18 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:2450 — crates/polars-stream/src/physical_plan/lower_expr.rs:2450-2467 | crates/polars-stream/src/physical_plan/lower_expr.rs:2524-2541 — both copies are in the same file, so extract the 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.
  • 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.
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:577 — 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:216 — 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::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::parser::parse_lines (cyclomatic 21) crates/polars-io/src/csv/read/parser.rs:1096 — polars_io::csv::read::parser::parse_lines 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_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.
  • polars_io::csv::write::write_impl::serializer::string_serializer (cyclomatic 16) crates/polars-io/src/csv/write/write_impl/serializer.rs:442 — polars_io::csv::write::write_impl::serializer::string_serializer has cyclomatic complexity 16 (threshold 15). 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, 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 · polars_compute · ×13
  • 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:91 — 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::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 · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×12
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/polars-core/src/frame/group_by/aggregations/mod.rs:322 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:322-397 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1114-1190 | 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 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/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:50-84 — 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:80 — crates/polars-ops/src/series/ops/log.rs:80-100 | crates/polars-ops/src/series/ops/log.rs:103-123 | crates/polars-ops/src/series/ops/log.rs:126-154 | crates/polars-ops/src/series/ops/log.rs:157-185 — 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:41-70 | 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-49 | crates/polars-parquet/src/arrow/write/binview/nested.rs:18-45 | 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) crates/polars-sql/src/subquery.rs:298 — crates/polars-sql/src/subquery.rs:298-368 | crates/polars-sql/src/subquery.rs:1215-1427 | crates/polars-sql/src/subquery.rs:1439-1549 | crates/polars-sql/src/subquery.rs:1592-1712 — 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.
D2 · Cognitive Complexity · ChunkedArray · ×11
  • 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 39) crates/polars-core/src/frame/group_by/aggregations/mod.rs:757 — ChunkedArray::agg_arg_max has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 4 (9 pts), loops 2 (6 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.
  • ChunkedArray::agg_arg_min (cognitive 38) crates/polars-core/src/frame/group_by/aggregations/mod.rs:574 — ChunkedArray::agg_arg_min 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_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_max (cognitive 20) crates/polars-core/src/frame/group_by/aggregations/mod.rs:681 — ChunkedArray::agg_max has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 4 (9 pts), boolean chains 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.
  • ChunkedArray::agg_sum (cognitive 20) crates/polars-core/src/frame/group_by/aggregations/mod.rs:867 — 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_min (cognitive 19) crates/polars-core/src/frame/group_by/aggregations/mod.rs:500 — ChunkedArray::agg_min 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::create_groups_from_sorted (cognitive 18) crates/polars-core/src/frame/group_by/into_groups.rs:65 — 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.
  • ChunkedArray::agg_var (cognitive 17) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1311 — ChunkedArray::agg_var has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (4 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. This shape REPEATS in the file: one other method here (ChunkedArray::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.
  • ChunkedArray::agg_std (cognitive 17) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1361 — ChunkedArray::agg_std has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (4 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. This shape REPEATS in the file: one other method here (ChunkedArray::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.
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D1 · Cyclomatic Complexity · SQLContext · ×10
  • SQLContext::execute_select_block (cyclomatic 63) crates/polars-sql/src/context.rs:2557 — SQLContext::execute_select_block 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.
  • SQLContext::process_group_by (cyclomatic 63) crates/polars-sql/src/context.rs:4662 — SQLContext::process_group_by 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.
  • SQLContext::try_attach_join_membership (cyclomatic 37) crates/polars-sql/src/subquery.rs:941 — SQLContext::try_attach_join_membership 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.
  • SQLContext::try_decorrelate_scalar_subquery (cyclomatic 30) crates/polars-sql/src/subquery.rs:1209 — SQLContext::try_decorrelate_scalar_subquery 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.
  • SQLContext::execute_joins (cyclomatic 18) crates/polars-sql/src/context.rs:2007 — SQLContext::execute_joins 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_asof_join (cyclomatic 18) crates/polars-sql/src/context.rs:3809 — 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) crates/polars-sql/src/context.rs:4259 — 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) crates/polars-sql/src/context.rs:5223 — 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::process_join_on_subqueries (cyclomatic 17) crates/polars-sql/src/context.rs:3601 — SQLContext::process_join_on_subqueries 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.
  • SQLContext::try_first_row_order (cyclomatic 16) crates/polars-sql/src/subquery.rs:667 — SQLContext::try_first_row_order 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 · Duplicated block (16 lines × 2) · ×10
  • 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.
  • 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.
  • 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.
  • 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.
  • Duplicated block (16 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:42 — crates/polars-parquet/src/arrow/read/deserialize/primitive/float.rs:42-57 | crates/polars-parquet/src/arrow/read/deserialize/primitive/integer.rs:49-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 4 separate duplicated blocks between them, totalling at least 77 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 (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.
  • Duplicated block (16 lines × 2) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/mod.rs:166 — crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/mod.rs:166-181 | crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/mod.rs:208-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.
  • 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.
  • 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.
D1 · Cyclomatic Complexity · polars_core · ×9
  • polars_core::utils::supertype::get_supertype_with_options::inner (cyclomatic 176) crates/polars-core/src/utils/supertype.rs:154 — polars_core::utils::supertype::get_supertype_with_options::inner has cyclomatic complexity 176 (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:29 — 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::series::any_value::any_values_to_struct (cyclomatic 20) crates/polars-core/src/series/any_value.rs:875 — polars_core::series::any_value::any_values_to_struct 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. 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::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::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:343 — 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:135 — 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.
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:290 — 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 · Duplicated block (20 lines × 2) · ×9
  • 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.
  • Duplicated block (20 lines × 2) crates/polars-io/src/cloud/options.rs:645 — crates/polars-io/src/cloud/options.rs:645-664 | crates/polars-io/src/cloud/options.rs:715-734 — both copies are in the same file, so extract the 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 (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.
  • 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.
  • Duplicated block (20 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:871 — crates/polars-plan/src/dsl/function_expr/mod.rs:871-890 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:889-908 — 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 11 separate duplicated blocks between them, totalling at least 496 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.
  • 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.
  • Duplicated block (20 lines × 2) crates/polars-stream/src/physical_plan/lower_group_by.rs:819 — crates/polars-stream/src/physical_plan/lower_group_by.rs:819-838 | crates/polars-stream/src/physical_plan/lower_group_by.rs:868-887 — both copies are in the same file, so extract the 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 (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.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×9
  • 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.
  • 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.
  • Duplicated block (17 lines × 2) crates/polars-row/src/fixed/decimal.rs:184 — crates/polars-row/src/fixed/decimal.rs:184-200 | crates/polars-row/src/fixed/decimal.rs:219-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.
  • 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.
  • Duplicated block (17 lines × 2) crates/polars-stream/src/physical_plan/fmt.rs:846 — crates/polars-stream/src/physical_plan/fmt.rs:846-862 | crates/polars-stream/src/physical_plan/fmt.rs:941-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.
  • Duplicated block (17 lines × 2) crates/polars-stream/src/physical_plan/to_description.rs:687 — crates/polars-stream/src/physical_plan/to_description.rs:687-703 | crates/polars-stream/src/physical_plan/to_description.rs:769-785 — both copies are in the same file, so extract the 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 (17 lines × 2) crates/polars-stream/src/physical_plan/to_graph.rs:1382 — crates/polars-stream/src/physical_plan/to_graph.rs:1382-1398 | crates/polars-stream/src/physical_plan/to_graph.rs:1414-1430 — both copies are in the same file, so extract the 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 (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.
  • Duplicated block (17 lines × 2) crates/polars-stream/src/nodes/io_sources/ipc/builder.rs:72 — crates/polars-stream/src/nodes/io_sources/ipc/builder.rs:72-89 | crates/polars-stream/src/nodes/io_sources/parquet/builder.rs:91-107 — 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.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×9
  • Duplicated block (7–8 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:542 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:542-548 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:174-181 — 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 (7–8 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:725 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:725-731 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:107-114 — 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 (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.
  • Duplicated block (7–8 lines × 2) crates/polars-expr/src/dispatch/strings.rs:368 — crates/polars-expr/src/dispatch/strings.rs:368-375 | crates/polars-expr/src/dispatch/strings.rs:390-396 — both copies are in the same file, so extract the 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-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.
  • Duplicated block (7–8 lines × 2) crates/polars-expr/src/planner.rs:594 — crates/polars-expr/src/planner.rs:594-600 | crates/polars-expr/src/planner.rs:627-634 — both copies are in the same file, so extract the 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-parquet/src/arrow/read/deserialize/nested_utils.rs:432 — crates/polars-parquet/src/arrow/read/deserialize/nested_utils.rs:432-438 | crates/polars-parquet/src/arrow/read/deserialize/nested_utils.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 (7–8 lines × 2) crates/polars-sql/src/group_context.rs:371 — crates/polars-sql/src/group_context.rs:371-377 | crates/polars-sql/src/group_context.rs:409-416 — both copies are in the same file, so extract the 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-stream/src/physical_plan/lower_group_by.rs:1484 — crates/polars-stream/src/physical_plan/lower_group_by.rs:1484-1490 | crates/polars-stream/src/physical_plan/lower_group_by.rs:1506-1513 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×9
  • Swallowed exception (caught, then discarded) py-polars/src/polars/sql/context.py:974 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) py-polars/src/polars/meta/versions.py:141 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) py-polars/src/polars/io/lance/_scan_resolver.py:139 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) py-polars/src/polars/io/lance/_scan_resolver.py:263 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) py-polars/src/polars/io/iceberg/_cache.py:227 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) py-polars/src/polars/io/iceberg/_dataset.py:1039 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) py-polars/src/polars/io/iceberg/_utils.py:235 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) py-polars/src/polars/io/iceberg/_utils.py:461 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) py-polars/src/polars/io/cloud/credential_provider/_providers.py:544 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
D2 · Cognitive Complexity · polars_python · ×8
  • polars_python::lazyframe::visitor::expr_nodes::into_py (cognitive 109) crates/polars-python/src/lazyframe/visitor/expr_nodes.rs:860 — polars_python::lazyframe::visitor::expr_nodes::into_py has cognitive complexity 109 (threshold 15). Drivers by points: match/switch 36 (109 pts) (nesting depth added 73). 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:59 — 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 34) crates/polars-python/src/conversion/any_value.rs:602 — polars_python::conversion::any_value::py_object_to_any_value::get_conversion_function has cognitive complexity 34 (threshold 15). Drivers by points: if/else 26 (33 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. 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:454 — 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::series::scatter::scatter (cognitive 20) crates/polars-python/src/series/scatter.rs:32 — polars_python::series::scatter::scatter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 5 (7 pts), boolean chains 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.
  • 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.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×8
  • Duplicated block (10 lines × 3) crates/polars-core/src/frame/group_by/aggregations/mod.rs:896 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:896-905 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:989-998 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1054-1063 — 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 (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.
  • Duplicated block (10 lines × 3) crates/polars-ops/src/series/ops/fused.rs:15 — crates/polars-ops/src/series/ops/fused.rs:15-24 | crates/polars-ops/src/series/ops/fused.rs:66-75 | crates/polars-ops/src/series/ops/fused.rs:116-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 (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.
  • Duplicated block (10 lines × 3) crates/polars-plan/src/plans/aexpr/schema.rs:620 — crates/polars-plan/src/plans/aexpr/schema.rs:620-629 | crates/polars-plan/src/plans/aexpr/schema.rs:695-704 | crates/polars-plan/src/plans/aexpr/schema.rs:773-782 — 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 (10 lines × 3) crates/polars-plan/src/plans/to_description.rs:267 — crates/polars-plan/src/plans/to_description.rs:267-276 | crates/polars-stream/src/physical_plan/to_description.rs:697-706 | crates/polars-stream/src/physical_plan/to_description.rs:779-788 — 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 40 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 (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.
  • 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:395-404 | 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.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×8
  • Duplicated block (6 lines × 3) crates/polars-core/src/utils/supertype.rs:280 — crates/polars-core/src/utils/supertype.rs:280-285 | crates/polars-core/src/utils/supertype.rs:296-301 | crates/polars-core/src/utils/supertype.rs:303-308 — 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 (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 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 (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:122-127 | crates/polars-plan/src/plans/aexpr/traverse.rs:242-247 — 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 (6 lines × 3) crates/polars-sql/src/subquery.rs:327 — crates/polars-sql/src/subquery.rs:327-332 | crates/polars-sql/src/subquery.rs:1487-1492 | crates/polars-sql/src/subquery.rs:1673-1678 — 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 (6 lines × 3) crates/polars-stream/src/physical_plan/lower_expr.rs:1456 — crates/polars-stream/src/physical_plan/lower_expr.rs:1456-1461 | crates/polars-stream/src/physical_plan/lower_expr.rs:1503-1508 | crates/polars-stream/src/physical_plan/lower_expr.rs:1536-1541 — 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 (6 lines × 3) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:244 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:244-249 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:341-346 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:539-546 — 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 (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) py-polars/src/polars/series/series.py:1152 — py-polars/src/polars/series/series.py:1152-1157 | py-polars/src/polars/series/series.py:1210-1215 | py-polars/src/polars/series/series.py:1276-1281 — 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.
D15 · Churn × Complexity Hotspots · Repeated repair · ×7
  • Repeated repair: crates/polars-core/src/chunked_array/cast.rs crates/polars-core/src/chunked_array/cast.rs:75 — crates/polars-core/src/chunked_array/cast.rs changed 9 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 11 (its worst body is polars_core::chunked_array::cast::cast_impl_inner at line 75), 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: Cast the inner values by their type in Array and List casts (#29864)”; “fix: Raise on oob gather indices (#29827)”; “refactor(rust): Fix `cut`/`rename` error messages and include offending values in others (#29721)”; “fix: Stop casting data to a Decimal needle in `is_in`, allow `Array(Null)` casts (#29485)”. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +01:00' --full-history --no-merges -- crates/polars-core/src/chunked_array/cast.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-expr/src/expressions/sortby.rs crates/polars-expr/src/expressions/sortby.rs:276 — crates/polars-expr/src/expressions/sortby.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 14 (its worst body is SortByExpr::evaluate_on_groups_impl at line 276), 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 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)”; “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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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-plan/src/plans/optimizer/cse/cspe.rs crates/polars-plan/src/plans/optimizer/cse/cspe.rs:183 — crates/polars-plan/src/plans/optimizer/cse/cspe.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 10 (its worst body is InsertCachesVisitor::pre_visit at line 183), 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 deduplicate inherently nondeterministic plan nodes (#28768)”; “fix: Remove cryptographic hashing from CSPE (#28716)”; “fix: Check for (shallow) IR node equality on top of hashing in CSPE (#28506)”. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +01:00' --full-history --no-merges -- crates/polars-plan/src/plans/optimizer/cse/cspe.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/series/implementations/binary_offset.rs crates/polars-core/src/series/implementations/binary_offset.rs:6 — crates/polars-core/src/series/implementations/binary_offset.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 1 (its worst body is SeriesWrap::compute_len at line 6), 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: Raise on oob gather indices (#29827)”; “fix: Fix small bugs in SQL aggregates and in group contexts (#29754)”; “refactor(rust): Fix errors/warnings for upcoming nightly bump (#28734)”. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +01:00' --full-history --no-merges -- crates/polars-core/src/series/implementations/binary_offset.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/series/ops/reshape.rs crates/polars-core/src/series/ops/reshape.rs:235 — crates/polars-core/src/series/ops/reshape.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 14 (its worst body is Series::reshape_list at line 235), 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: Various map issues (#29147)”; “refactor(rust): Fix errors/warnings for upcoming nightly bump (#28734)”. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +01:00' --full-history --no-merges -- crates/polars-core/src/series/ops/reshape.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), 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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.
  • Repeated repair: crates/polars-sql/src/group_context.rs crates/polars-sql/src/group_context.rs:124 — crates/polars-sql/src/group_context.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 8 (its worst body is GroupContextSplitter::needs_post_aggregation at line 124), 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: 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 15:18:24 +01:00' --until='2026-10-25 15:18:24 +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.
D2 · Cognitive Complexity · polars_sql · ×7
  • polars_sql::context::disambiguate_projection_cols (cognitive 52) crates/polars-sql/src/context.rs:95 — 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::sql_expr::resolve_compound_identifier (cognitive 21) crates/polars-sql/src/sql_expr.rs:2242 — 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:2243 — 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::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::context::disambiguate_output_names (cognitive 17) crates/polars-sql/src/context.rs:176 — polars_sql::context::disambiguate_output_names has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 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_sql::sql_expr::cast_literal_series (cognitive 16) crates/polars-sql/src/sql_expr.rs:146 — 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 · Duplicated block (26 lines × 2) · ×7
  • 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.
  • Duplicated block (26 lines × 2) crates/polars-expr/src/reduce/convert.rs:225 — crates/polars-expr/src/reduce/convert.rs:225-250 | crates/polars-expr/src/reduce/convert.rs:258-283 — both copies are in the same file, so extract the 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 (26 lines × 2) crates/polars-parquet/src/arrow/write/binary/nested.rs:24 — crates/polars-parquet/src/arrow/write/binary/nested.rs:24-49 | crates/polars-parquet/src/arrow/write/binview/nested.rs:20-45 — `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 39 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 (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 — 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 (26 lines × 2) crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:652 — crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:652-677 | crates/polars-stream/src/nodes/io_sources/parquet/init.rs:418-443 — 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 (26 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs:1672 — crates/polars-stream/src/nodes/joins/equi_join.rs:1672-1697 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1051-1076 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 217 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 (26 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs:1774 — crates/polars-stream/src/nodes/joins/equi_join.rs:1774-1799 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1150-1175 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 217 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.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×7
  • 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.
  • 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.
  • Duplicated block (22 lines × 2) crates/polars-parquet/src/arrow/write/pages.rs:209 — crates/polars-parquet/src/arrow/write/pages.rs:209-230 | crates/polars-parquet/src/arrow/write/pages.rs:232-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.
  • 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.
  • 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.
  • Duplicated block (22 lines × 2) crates/polars-plan/src/plans/aexpr/schema.rs:672 — crates/polars-plan/src/plans/aexpr/schema.rs:672-693 | crates/polars-plan/src/plans/aexpr/schema.rs:737-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.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×7
  • 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:358 — crates/polars-row/src/encode.rs:358-370 | crates/polars-row/src/encode.rs:374-386 | crates/polars-row/src/encode.rs:390-402 — 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-sql/src/subquery.rs:2261 — crates/polars-sql/src/subquery.rs:2261-2273 | crates/polars-sql/src/subquery.rs:2305-2317 | crates/polars-sql/src/subquery.rs:2558-2570 — 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-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 6 separate duplicated blocks between them, totalling at least 66 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 × 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 5 separate duplicated blocks between them, totalling at least 54 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 (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.
  • 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.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×7
  • Duplicated block (11 lines × 3) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1282 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1282-1292 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1327-1337 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1378-1388 — 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 (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.
  • 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:129-139 | crates/polars-plan/src/plans/aexpr/traverse.rs:249-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.
  • Duplicated block (11 lines × 3) crates/polars-stream/src/physical_plan/lower_expr.rs:1442 — crates/polars-stream/src/physical_plan/lower_expr.rs:1442-1452 | crates/polars-stream/src/physical_plan/lower_expr.rs:1466-1476 | crates/polars-stream/src/physical_plan/lower_expr.rs:1517-1527 — 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 (11 lines × 3) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:373 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:373-383 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:454-464 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:494-504 — 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 (11 lines × 3) 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:323-333 — 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 (11 lines × 3) crates/polars-plan/src/plans/aexpr/schema.rs:654 — crates/polars-plan/src/plans/aexpr/schema.rs:654-664 | crates/polars-plan/src/plans/aexpr/schema.rs:724-734 | crates/polars-plan/src/plans/aexpr/schema.rs:933-943 — 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.
D1 · Cyclomatic Complexity · polars_row · ×6
  • polars_row::encode::get_encoder (cyclomatic 29) crates/polars-row/src/encode.rs:276 — polars_row::encode::get_encoder 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::encode_flat_array (cyclomatic 29) crates/polars-row/src/encode.rs:632 — 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:960 — 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:226 — 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 21) crates/polars-row/src/decode.rs:92 — polars_row::decode::dtype_and_data_to_encoded_item_len 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.
  • polars_row::encode::encode_array (cyclomatic 19) crates/polars-row/src/encode.rs:769 — 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:924 — 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_expr (cognitive 31) crates/polars-sql/src/sql_expr.rs:401 — 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_like (cognitive 23) crates/polars-sql/src/sql_expr.rs:719 — SQLExprVisitor::visit_like has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 3, 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.
  • SQLExprVisitor::visit_case_when_then (cognitive 20) crates/polars-sql/src/sql_expr.rs:1879 — 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:343 — 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:1335 — 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 · 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 5 separate duplicated blocks between them, totalling at least 64 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 (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.
  • Duplicated block (23 lines × 2) crates/polars-stream/src/nodes/io_sinks/writers/ipc/mod.rs:58 — crates/polars-stream/src/nodes/io_sinks/writers/ipc/mod.rs:58-80 | crates/polars-stream/src/nodes/io_sinks/writers/parquet/mod.rs:90-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.
  • Duplicated block (23 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs:599 — crates/polars-stream/src/nodes/joins/equi_join.rs:599-621 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:365-387 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 217 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 (23 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs:625 — crates/polars-stream/src/nodes/joins/equi_join.rs:625-647 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:391-413 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 217 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 (23 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:992 — crates/polars-stream/src/physical_plan/lower_expr.rs:992-1014 | crates/polars-stream/src/physical_plan/lower_expr.rs:1088-1110 — both copies are in the same file, so extract the 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 (9–10 lines × 2) · ×6
  • 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.
  • 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:274-283 — both copies are in the same file, so extract the 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/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.
  • Duplicated block (9–10 lines × 2) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:682 — crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:682-690 | crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:698-707 — both copies are in the same file, so extract the 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-stream/src/nodes/io_sources/ipc/builder.rs:143 — crates/polars-stream/src/nodes/io_sources/ipc/builder.rs:143-151 | crates/polars-stream/src/nodes/io_sources/parquet/builder.rs:167-176 — 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.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×6
  • 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.
  • Duplicated block (9 lines × 3) 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:246-254 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:371-379 — 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 (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.
  • Duplicated block (9 lines × 3) crates/polars-plan/src/plans/aexpr/filter_constraint.rs:905 — crates/polars-plan/src/plans/aexpr/filter_constraint.rs:905-913 | crates/polars-plan/src/plans/aexpr/filter_constraint.rs:1115-1123 | crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:2388-2396 — 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-sql/src/subquery.rs:1404 — crates/polars-sql/src/subquery.rs:1404-1412 | crates/polars-sql/src/subquery.rs:1516-1524 | crates/polars-sql/src/subquery.rs:1683-1691 — 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 (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 5 separate duplicated blocks between them, totalling at least 54 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 (6 lines × 4) · ×6
  • 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 6 separate duplicated blocks between them, totalling at least 39 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) 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.
  • 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 39 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 6 separate duplicated blocks between them, totalling at least 64 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 (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:546-551 | 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:233-238 | crates/polars-ops/src/chunked_array/list/namespace.rs:240-245 — 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 · ×5
  • 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::rolling::create_validity (cyclomatic 16) crates/polars-compute/src/rolling/mod.rs:91 — 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_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:290 — 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 · polars_expr · ×5
  • polars_expr::expressions::window::set_numeric (cognitive 27) crates/polars-expr/src/expressions/window.rs:1138 — 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::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:636 — 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::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.
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:43 — 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 · Duplicated block (19 lines × 2) · ×5
  • 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.
  • 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 4 separate duplicated blocks between them, totalling at least 77 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 (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.
  • 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.
  • Duplicated block (19 lines × 2) crates/polars-stream/src/nodes/joins/equi_join.rs:1801 — crates/polars-stream/src/nodes/joins/equi_join.rs:1801-1819 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1177-1195 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 217 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.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×5
  • Duplicated block (15 lines × 3) crates/polars-core/src/utils/mod.rs:102 — crates/polars-core/src/utils/mod.rs:102-116 | pyo3-polars/example/derive_expression/expression_lib/src/expressions.rs:38-52 | pyo3-polars/example/extend_polars_python_dispatch/extend_polars/src/parallel_jaccard_mod.rs:8-22 — 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-io/src/cloud/options.rs:569 — crates/polars-io/src/cloud/options.rs:569-583 | crates/polars-io/src/cloud/options.rs:645-659 | crates/polars-io/src/cloud/options.rs:715-729 — 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 (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:105-119 | crates/polars-plan/src/plans/aexpr/traverse.rs:225-239 — 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 (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 6 separate duplicated blocks between them, totalling at least 66 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.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×5
  • Duplicated block (10–11 lines × 2) crates/polars-ops/src/chunked_array/strings/find_many.rs:192 — crates/polars-ops/src/chunked_array/strings/find_many.rs:192-202 | crates/polars-ops/src/chunked_array/strings/find_many.rs:288-297 — both copies are in the same file, so extract the 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/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.
  • Duplicated block (10–11 lines × 2) crates/polars-ops/src/series/ops/cut.rs:13 — crates/polars-ops/src/series/ops/cut.rs:13-22 | crates/polars-ops/src/series/ops/cut.rs:76-86 — both copies are in the same file, so extract the 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.
  • Duplicated block (10–11 lines × 2) crates/polars-stream/src/physical_plan/lower_group_by.rs:418 — crates/polars-stream/src/physical_plan/lower_group_by.rs:418-427 | crates/polars-stream/src/physical_plan/lower_group_by.rs:540-550 — both copies are in the same file, so extract the 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 (8–9 lines × 2) · ×5
  • 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.
  • 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.
  • Duplicated block (8–9 lines × 2) crates/polars-plan/src/plans/python/pyarrow.rs:268 — crates/polars-plan/src/plans/python/pyarrow.rs:268-275 | crates/polars-plan/src/plans/python/pyarrow.rs:646-654 — both copies are in the same file, so extract the 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–9 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:1457 — crates/polars-stream/src/physical_plan/lower_expr.rs:1457-1464 | crates/polars-stream/src/physical_plan/lower_expr.rs:1504-1512 — both copies are in the same file, so extract the 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–9 lines × 2) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:266 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:266-274 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:296-303 — both copies are in the same file, so extract the 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 (8 lines × 3) · ×5
  • Duplicated block (8 lines × 3) crates/polars-sql/src/subquery.rs:338 — crates/polars-sql/src/subquery.rs:338-345 | crates/polars-sql/src/subquery.rs:1517-1524 | crates/polars-sql/src/subquery.rs:1684-1691 — 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 (8 lines × 3) crates/polars-stream/src/physical_plan/to_graph.rs:1677 — crates/polars-stream/src/physical_plan/to_graph.rs:1677-1684 | crates/polars-stream/src/physical_plan/to_graph.rs:1713-1720 | crates/polars-stream/src/physical_plan/to_graph.rs:1746-1753 — 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 (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 6 separate duplicated blocks between them, totalling at least 64 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 (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.
  • Duplicated block (8 lines × 3) crates/polars-ops/src/chunked_array/list/namespace.rs:260 — crates/polars-ops/src/chunked_array/list/namespace.rs:260-267 | crates/polars-ops/src/chunked_array/list/namespace.rs:432-439 | crates/polars-ops/src/chunked_array/list/namespace.rs:506-513 — 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.
D1 · Cyclomatic Complexity · polars_python · ×4
  • polars_python::lazyframe::visitor::expr_nodes::into_py (cyclomatic 417) crates/polars-python/src/lazyframe/visitor/expr_nodes.rs:860 — polars_python::lazyframe::visitor::expr_nodes::into_py has cyclomatic complexity 417 (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 25) crates/polars-python/src/conversion/any_value.rs:602 — polars_python::conversion::any_value::py_object_to_any_value::get_conversion_function 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. 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:59 — 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.
D1 · Cyclomatic Complexity · polars_expr · ×4
  • polars_expr::dispatch::function_expr_to_udf (cyclomatic 143) crates/polars-expr/src/dispatch/mod.rs:147 — polars_expr::dispatch::function_expr_to_udf has cyclomatic complexity 143 (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 33) crates/polars-expr/src/planner.rs:247 — polars_expr::planner::create_physical_expr_inner 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_expr::dispatch::misc::corr (cyclomatic 22) crates/polars-expr/src/dispatch/misc.rs:969 — 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 · 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 · polars_sql · ×4
  • 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::resolve_compound_identifier (cyclomatic 19) crates/polars-sql/src/sql_expr.rs:2242 — 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. This is NOT this file's highest cyclomatic complexity: polars_sql::sql_expr::parse_extract_date_part (cyclomatic 46) 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_sql::subquery::exists_aggregates (cyclomatic 19) crates/polars-sql/src/subquery.rs:2243 — 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::disambiguate_projection_cols (cyclomatic 17) crates/polars-sql/src/context.rs:95 — 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.
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:1265 — 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:1597 — 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:450 — 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:769 — 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:226 — 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 18) crates/polars-row/src/encode.rs:276 — polars_row::encode::get_encoder has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (10 pts), loops 2 (6 pts), if/else 2 (nesting depth added 9). 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, strings.rs, string.rs crates/polars-plan/src/dsl/function_expr/strings.rs — `crates/polars-plan/src/dsl/function_expr/strings.rs` changes together with 4 other files — `crates/polars-ops/src/chunked_array/strings/mod.rs`, `crates/polars-ops/src/chunked_array/strings/namespace.rs`, `crates/polars-plan/src/plans/aexpr/function_expr/strings.rs`, `crates/polars-python/src/expr/string.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: 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, merge_join.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 4 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/nodes/joins/merge_join.rs`, `crates/polars-stream/src/physical_plan/to_graph.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.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×4
  • Duplicated block (24 lines × 2) crates/polars-io/src/csv/read/parser.rs:577 — crates/polars-io/src/csv/read/parser.rs:577-600 | crates/polars-io/src/csv/read/parser.rs:913-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.
  • 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.
  • Duplicated block (24 lines × 2) crates/polars-parquet/src/arrow/write/binary/basic.rs:113 — crates/polars-parquet/src/arrow/write/binary/basic.rs:113-136 | crates/polars-parquet/src/arrow/write/binview/basic.rs:117-140 — 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 (24 lines × 2) crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:760 — crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:760-783 | crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:800-823 — both copies are in the same file, so extract the 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 lines × 2) · ×4
  • 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-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:326-346 — 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.
  • Duplicated block (21 lines × 2) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:295 — crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:295-315 | crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:331-351 — both copies are in the same file, so extract the 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) py-polars/src/polars/dataframe/frame.py:1025 — py-polars/src/polars/dataframe/frame.py:1025-1045 | py-polars/src/polars/series/series.py:1493-1513 — 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 (14–15 lines × 2) · ×4
  • Duplicated block (14–15 lines × 2) crates/polars-expr/src/dispatch/misc.rs:1187 — crates/polars-expr/src/dispatch/misc.rs:1187-1201 | crates/polars-expr/src/dispatch/misc.rs:1216-1229 — both copies are in the same file, so extract the 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-ops/src/frame/join/dispatch_left_right.rs:98 — crates/polars-ops/src/frame/join/dispatch_left_right.rs:98-111 | crates/polars-ops/src/frame/join/dispatch_left_right.rs:128-142 — both copies are in the same file, so extract the 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-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.
  • 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.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×4
  • Duplicated block (13–14 lines × 2) crates/polars-core/src/frame/group_by/aggregations/mod.rs:654 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:654-667 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:842-854 — both copies are in the same file, so extract the 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–14 lines × 2) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1110 — crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1110-1122 | crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1203-1216 — both copies are in the same file, so extract the 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–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.
  • 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.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×4
  • 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:532-543 | 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.
  • 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.
  • 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.
  • 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.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×4
  • 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.
  • Duplicated block (10–12 lines × 2) crates/polars-io/src/cloud/options.rs:625 — crates/polars-io/src/cloud/options.rs:625-636 | crates/polars-io/src/cloud/options.rs:702-711 — both copies are in the same file, so extract the 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–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.
  • Duplicated block (10–12 lines × 2) py-polars/src/polars/io/csv/functions.py:521 — py-polars/src/polars/io/csv/functions.py:521-530 | 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 (11–12 lines × 2) · ×4
  • 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-python/src/series/scatter.rs:39 — crates/polars-python/src/series/scatter.rs:39-50 | crates/polars-python/src/series/scatter.rs:53-63 — both copies are in the same file, so extract the 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.rs:1708 — crates/polars-stream/src/nodes/joins/equi_join.rs:1708-1719 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1094-1104 — before extracting anything, compare `crates/polars-stream/src/nodes/joins/equi_join.rs` and `crates/polars-stream/src/nodes/joins/semi_anti_join.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 217 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–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.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×4
  • Duplicated block (8 lines × 4) crates/polars-io/src/csv/read/parser.rs:577 — crates/polars-io/src/csv/read/parser.rs:577-584 | crates/polars-io/src/csv/read/parser.rs:913-920 | crates/polars-io/src/csv/read/splitfields.rs:266-273 | crates/polars-io/src/csv/read/splitfields.rs:355-362 — 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.
  • 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.
  • 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 4 separate duplicated blocks between them, totalling at least 77 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 (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 194) crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:8 — IRFunctionExpr::get_field has cyclomatic complexity 194 (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 127) crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:835 — IRFunctionExpr::fmt_name has cyclomatic complexity 127 (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 111) crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1201 — IRFunctionExpr::function_options has cyclomatic complexity 111 (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 76) crates/polars-core/src/datatypes/any_value.rs:423 — AnyValue::strict_cast has cyclomatic complexity 76 (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:1178 — 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 · SQLExprVisitor · ×3
  • SQLExprVisitor::visit_binary_op (cyclomatic 70) crates/polars-sql/src/sql_expr.rs:924 — 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:401 — 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_any_subquery (cyclomatic 19) crates/polars-sql/src/sql_expr.rs:1335 — 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. This is NOT this file's highest cyclomatic complexity: polars_sql::sql_expr::parse_extract_date_part (cyclomatic 46) 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:3169 — // 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:717 — 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 · BuildState · ×3
  • BuildState::finalize (cognitive 27) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:544 — 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.
  • BuildState::finalize_unordered (cognitive 20) crates/polars-stream/src/nodes/joins/equi_join.rs:876 — BuildState::finalize_unordered has cognitive complexity 20 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 5 (9 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.
  • BuildState::finalize_ordered (cognitive 18) crates/polars-stream/src/nodes/joins/equi_join.rs:773 — BuildState::finalize_ordered has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 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.
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
D30 · Dependency Vulnerabilities · Medium vulnerability · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (43 lines × 2) · ×3
  • Duplicated block (43 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:893 — crates/polars-plan/src/dsl/function_expr/mod.rs:893-935 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:911-953 — 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 11 separate duplicated blocks between them, totalling at least 496 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:307 — crates/polars-plan/src/plans/aexpr/traverse.rs:307-349 | crates/polars-plan/src/plans/aexpr/traverse.rs:419-461 — both copies are in the same file, so extract the 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 (43 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs:374 — crates/polars-plan/src/plans/aexpr/traverse.rs:374-416 | crates/polars-plan/src/plans/aexpr/traverse.rs:489-531 — both copies are in the same file, so extract the 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 (34 lines × 2) · ×3
  • Duplicated block (34 lines × 2) crates/polars-io/src/csv/read/parser.rs:483 — crates/polars-io/src/csv/read/parser.rs:483-516 | crates/polars-io/src/csv/read/parser.rs:626-659 — both copies are in the same file, so extract the 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 (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 4 separate duplicated blocks between them, totalling at least 77 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 (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.
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.
  • Duplicated block (27 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs:141 — crates/polars-plan/src/plans/aexpr/traverse.rs:141-167 | crates/polars-plan/src/plans/aexpr/traverse.rs:261-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.
  • 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.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×3
  • 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.
  • Duplicated block (25 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs:115 — crates/polars-plan/src/plans/aexpr/traverse.rs:115-139 | crates/polars-plan/src/plans/aexpr/traverse.rs:235-259 — both copies are in the same file, so extract the 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 (25 lines × 2) py-polars/src/polars/dataframe/frame.py:5120 — py-polars/src/polars/dataframe/frame.py:5120-5144 | py-polars/src/polars/lazyframe/frame.py:3013-3037 — `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 334 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 `py-polars/src/polars/lazyframe/frame.py:3013` 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.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×3
  • Duplicated block (16–17 lines × 2) crates/polars-expr/src/expressions/apply.rs:558 — crates/polars-expr/src/expressions/apply.rs:558-574 | crates/polars-expr/src/expressions/structeval.rs:309-324 — 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 6 separate duplicated blocks between them, totalling at least 80 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 (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.
  • Duplicated block (16–17 lines × 2) crates/polars-plan/src/plans/aexpr/traverse.rs:173 — crates/polars-plan/src/plans/aexpr/traverse.rs:173-189 | crates/polars-plan/src/plans/aexpr/traverse.rs:289-304 — both copies are in the same file, so extract the 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 (5 lines × 4) · ×3
  • 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:1719-1724 | crates/polars-stream/src/physical_plan/to_graph.rs:1800-1804 — 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 (5 lines × 4) crates/polars-core/src/frame/row/av_buffer.rs:195 — crates/polars-core/src/frame/row/av_buffer.rs:195-199 | crates/polars-core/src/frame/row/av_buffer.rs:245-249 | crates/polars-core/src/frame/row/av_buffer.rs:251-255 | crates/polars-core/src/frame/row/av_buffer.rs:257-261 — 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 (5 lines × 4) crates/polars-core/src/frame/row/av_buffer.rs:721 — crates/polars-core/src/frame/row/av_buffer.rs:721-725 | crates/polars-core/src/frame/row/av_buffer.rs:727-731 | crates/polars-core/src/frame/row/av_buffer.rs:733-737 | crates/polars-core/src/frame/row/av_buffer.rs:739-743 — 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.
D4 · Code Duplication · Duplicated block (4–5 lines × 3) · ×3
  • 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 32 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 (4–5 lines × 3) crates/polars-stream/src/nodes/dynamic_slice.rs:111 — crates/polars-stream/src/nodes/dynamic_slice.rs:111-115 | 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.
  • Duplicated block (4–5 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-25 | docs/source/src/rust/user-guide/concepts/expressions.rs:6-10 | docs/source/src/rust/user-guide/getting-started.rs:7-10 — 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 6 separate duplicated blocks between them, totalling at least 64 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.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×3
  • Recursive walk over a caller-supplied document has no depth cap py-polars/src/polars/testing/parametric/strategies/_utils.py:11 — `flexhash` is public and takes `elem: Any` from its caller, and it calls itself at line 11 (`flexhash`) with a piece of `elem` (and at line 13) — and nowhere in `flexhash` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `flexhash` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap py-polars/src/polars/functions/lit.py:209 — `lit` is public and takes `value: Any` from its caller, and it calls itself at line 209 (`lit`) with a piece of `value` (and at line 218, line 225, line 228) — and nowhere in `lit` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `lit` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap py-polars/src/polars/_utils/construction/utils.py:94 — `nt_unpack` is public and takes `obj: Any` from its caller, and it calls itself at line 94 (`nt_unpack`) with a piece of `obj` (and at line 96, line 98, line 100) — and nowhere in `nt_unpack` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `nt_unpack` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D1 · Cyclomatic Complexity · SQLFunctionVisitor · ×2
  • SQLFunctionVisitor::visit_function (cyclomatic 220) crates/polars-sql/src/functions.rs:1328 — SQLFunctionVisitor::visit_function has cyclomatic complexity 220 (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 26) crates/polars-sql/src/window_frames.rs:86 — SQLFunctionVisitor::visit_window_aggregate has cyclomatic complexity 26 (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:717 — 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 (cyclomatic 65) crates/polars-plan/src/plans/aexpr/schema.rs:45 — AExpr::to_field_impl 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 19) crates/polars-plan/src/plans/aexpr/mod.rs:294 — AExpr::is_fallible_top_level 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.
D1 · Cyclomatic Complexity · ParquetReadImpl · ×2
  • ParquetReadImpl::init_morsel_distributor (cyclomatic 36) crates/polars-stream/src/nodes/io_sources/parquet/init.rs:55 — 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:452 — 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 · TernaryExpr · ×2
  • TernaryExpr::evaluate_on_groups_impl (cyclomatic 30) crates/polars-expr/src/expressions/ternary.rs:212 — TernaryExpr::evaluate_on_groups_impl 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.
  • TernaryExpr::evaluate_impl (cyclomatic 19) crates/polars-expr/src/expressions/ternary.rs:110 — TernaryExpr::evaluate_impl has cyclomatic complexity 19 (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 · SampleState · ×2
  • SampleState::try_transition_to_build (cyclomatic 28) crates/polars-stream/src/nodes/joins/equi_join.rs:425 — SampleState::try_transition_to_build 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.
  • SampleState::try_transition_to_build (cyclomatic 22) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:220 — 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:1501 — 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 18) crates/polars-core/src/frame/group_by/aggregations/mod.rs:757 — ChunkedArray::agg_arg_max 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.
  • ChunkedArray::agg_arg_min (cyclomatic 17) crates/polars-core/src/frame/group_by/aggregations/mod.rs:574 — ChunkedArray::agg_arg_min 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 · CloudOptions · ×2
  • CloudOptions::build_aws (cyclomatic 17) crates/polars-io/src/cloud/options.rs:413 — 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:775 — 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:1930 — 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:1949 — 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 149) crates/polars-sql/src/functions.rs:1328 — SQLFunctionVisitor::visit_function has cognitive complexity 149 (threshold 15). Drivers by points: match/switch 36 (75 pts), if/else 38 (69 pts), boolean chains 5 (nesting depth added 70). 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 16) crates/polars-sql/src/window_frames.rs:86 — SQLFunctionVisitor::visit_window_aggregate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 7, boolean chains 2 (nesting depth added 2). To reduce it, split the body into named stages: move each independent 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 · 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 104) crates/polars-plan/src/plans/aexpr/function_expr/schema.rs:8 — IRFunctionExpr::get_field has cognitive complexity 104 (threshold 15). Drivers by points: match/switch 28 (56 pts), if/else 17 (32 pts), boolean chains 14, 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:1201 — 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 · ProbeState · ×2
  • ProbeState::partition_and_probe (cognitive 96) crates/polars-stream/src/nodes/joins/equi_join.rs:1036 — ProbeState::partition_and_probe has cognitive complexity 96 (threshold 15). Drivers by points: if/else 23 (72 pts), loops 7 (22 pts), boolean chains 2 (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ProbeState::partition_and_probe (cognitive 16) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:726 — 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 · Duration · ×2
  • 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.
  • Duration::add_inline (cognitive 25) crates/polars-defs/src/time/duration.rs:835 — Duration::add_inline has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 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 · 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:55 — 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:452 — 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 · SplitFields · ×2
  • SplitFields::next (cognitive 65) crates/polars-io/src/csv/read/splitfields.rs:215 — SplitFields::next has cognitive complexity 65 (threshold 15). Drivers by points: if/else 21 (50 pts), loops 3 (8 pts), match/switch 1 (4 pts), boolean chains 3 (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:57 — 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 · EquiJoinNode · ×2
  • EquiJoinNode::update_state (cognitive 60) crates/polars-stream/src/nodes/joins/equi_join.rs:1584 — EquiJoinNode::update_state has cognitive complexity 60 (threshold 15). Drivers by points: if/else 30 (53 pts), boolean chains 4, loops 1 (2 pts), match/switch 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.
  • EquiJoinNode::new (cognitive 16) crates/polars-stream/src/nodes/joins/equi_join.rs:1441 — 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 · SemiAntiJoinNode · ×2
  • SemiAntiJoinNode::update_state (cognitive 60) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:971 — SemiAntiJoinNode::update_state has cognitive complexity 60 (threshold 15). Drivers by points: if/else 29 (53 pts), boolean chains 4, loops 1 (2 pts), match/switch 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.
  • SemiAntiJoinNode::spawn (cognitive 18) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1130 — 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 · AExpr · ×2
  • AExpr::to_field_impl (cognitive 56) crates/polars-plan/src/plans/aexpr/schema.rs:45 — AExpr::to_field_impl 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:294 — 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:230 — 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:164 — 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 · TernaryExpr · ×2
  • TernaryExpr::evaluate_on_groups_impl (cognitive 53) crates/polars-expr/src/expressions/ternary.rs:212 — TernaryExpr::evaluate_on_groups_impl has cognitive complexity 53 (threshold 15). Drivers by points: if/else 21 (38 pts), loops 6 (8 pts), match/switch 3 (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.
  • TernaryExpr::evaluate_impl (cognitive 19) crates/polars-expr/src/expressions/ternary.rs:110 — TernaryExpr::evaluate_impl has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, match/switch 3 (5 pts), boolean chains 4 (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 · 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 · ListNameSpaceImpl · ×2
  • ListNameSpaceImpl::lst_concat (cognitive 40) crates/polars-ops/src/chunked_array/list/namespace.rs:558 — ListNameSpaceImpl::lst_concat has cognitive complexity 40 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 6 (13 pts), match/switch 5 (12 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.
  • ListNameSpaceImpl::lst_gather_every (cognitive 18) crates/polars-ops/src/chunked_array/list/namespace.rs:341 — 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 · SampleState · ×2
  • SampleState::try_transition_to_build (cognitive 36) crates/polars-stream/src/nodes/joins/equi_join.rs:425 — SampleState::try_transition_to_build has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 8, match/switch 2 (3 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.
  • SampleState::try_transition_to_build (cognitive 31) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:220 — SampleState::try_transition_to_build has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 8, 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 · 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:413 — 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:775 — 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:1930 — 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:1949 — 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 · 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:1033 — 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:1111 — 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 · 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:2130 — 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:450 — 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:1265 — 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 · BinViewDecoder · ×2
  • BinViewDecoder::initialize_predicate_equals_one_of (cognitive 17) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:105 — 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.
  • BinViewDecoder::extend_filtered_with_state (cognitive 16) crates/polars-parquet/src/arrow/read/deserialize/binview/mod.rs:712 — BinViewDecoder::extend_filtered_with_state has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 1 (3 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.
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
D4 · Code Duplication · Near-duplicate member pair (36 shared lines) · ×2
  • Near-duplicate member pair (36 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: 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.
  • 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) · ×2
  • Near-duplicate member pair (35 shared lines) crates/polars-ops/src/chunked_array/list/namespace.rs:424 — crates/polars-ops/src/chunked_array/list/namespace.rs:424-480 | crates/polars-ops/src/chunked_array/list/namespace.rs:489-556 — 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.
  • Near-duplicate member pair (35 shared lines) crates/polars-stream/src/nodes/joins/equi_join.rs:431 — crates/polars-stream/src/nodes/joins/equi_join.rs:431-560 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:226-326 — 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 · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (6 members, 50+ identical tokens) crates/polars-core/src/frame/group_by/aggregations/mod.rs:500 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:500-572 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:681-755 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:760-866 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:867-939 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:952-1031 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1036-1110 — 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-530 | 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:2487-2718 | py-polars/src/polars/lazyframe/frame.py:3576-3829 | py-polars/src/polars/lazyframe/frame.py:9532-9694 — 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/group_by/aggregations/mod.rs:500 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:500-572 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:681-755 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:952-1031 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1036-1110 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1114-1190 — 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 · 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 — 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 (41 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:483 — crates/polars-plan/src/dsl/function_expr/mod.rs:483-523 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:467-507 — 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 11 separate duplicated blocks between them, totalling at least 496 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 (38 lines × 2) · ×2
  • Duplicated block (38 lines × 2) crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1018 — crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1018-1055 | crates/polars-plan/src/plans/optimizer/predicate_pushdown/join/predicate_pruning.rs:1165-1202 — both copies are in the same file, so extract the 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 (38 lines × 2) py-polars/src/polars/dataframe/frame.py:5083 — py-polars/src/polars/dataframe/frame.py:5083-5120 | py-polars/src/polars/lazyframe/frame.py:2969-3006 — `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 334 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 (32 lines × 2) · ×2
  • Duplicated block (32 lines × 2) crates/polars-io/src/csv/read/streaming.rs:167 — crates/polars-io/src/csv/read/streaming.rs:167-198 | crates/polars-io/src/csv/read/streaming.rs:352-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.
  • Duplicated block (32 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:937 — crates/polars-plan/src/dsl/function_expr/mod.rs:937-968 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:957-988 — 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 11 separate duplicated blocks between them, totalling at least 496 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 (23–24 lines × 2) · ×2
  • Duplicated block (23–24 lines × 2) crates/polars-parquet/src/arrow/write/binary/basic.rs:81 — crates/polars-parquet/src/arrow/write/binary/basic.rs:81-104 | crates/polars-parquet/src/arrow/write/binview/basic.rs:88-110 — 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 (23–24 lines × 2) crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:108 — crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:108-130 | crates/polars-stream/src/nodes/io_sources/parquet/mod.rs:139-162 — 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.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) crates/polars-ops/src/chunked_array/list/sets.rs:129 — crates/polars-ops/src/chunked_array/list/sets.rs:129-146 | crates/polars-ops/src/chunked_array/list/sets.rs:231-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.
  • 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 (16–18 lines × 2) · ×2
  • Duplicated block (16–18 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-76 | crates/polars-stream/src/nodes/io_sinks/writers/ndjson/io_writer.rs:44-59 — 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–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.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×2
  • Duplicated block (15–16 lines × 2) crates/polars-plan/src/plans/optimizer/sortedness.rs:307 — crates/polars-plan/src/plans/optimizer/sortedness.rs:307-322 | crates/polars-plan/src/plans/optimizer/sortedness.rs:438-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.
  • Duplicated block (15–16 lines × 2) crates/polars-stream/src/physical_plan/lower_expr.rs:654 — crates/polars-stream/src/physical_plan/lower_expr.rs:654-669 | crates/polars-stream/src/physical_plan/lower_expr.rs:1718-1732 — both copies are in the same file, so extract the 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–13 lines × 3) · ×2
  • 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.
  • 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.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×2
  • 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.
  • 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.
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:532 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:532-541 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:715-724 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:820-830 — 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 (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 6 separate duplicated blocks between them, totalling at least 64 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 (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.
  • 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.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×2
  • Duplicated block (7 lines × 4) crates/polars-ops/src/series/ops/log.rs:81 — crates/polars-ops/src/series/ops/log.rs:81-87 | crates/polars-ops/src/series/ops/log.rs:104-110 | crates/polars-ops/src/series/ops/log.rs:127-133 | crates/polars-ops/src/series/ops/log.rs:158-164 — 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 (7 lines × 4) crates/polars-stream/src/nodes/io_sources/csv/builder.rs:65 — crates/polars-stream/src/nodes/io_sources/csv/builder.rs:65-72 | crates/polars-stream/src/nodes/io_sources/ipc/builder.rs:61-67 | crates/polars-stream/src/nodes/io_sources/lines.rs:53-60 | crates/polars-stream/src/nodes/io_sources/ndjson/builder.rs:60-67 — 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 5 separate duplicated blocks between them, totalling at least 54 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.
D1 · Cyclomatic Complexity · ProjectionPushdownVisitor · ×1
  • ProjectionPushdownVisitor::pushdown (cyclomatic 234) crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:215 — ProjectionPushdownVisitor::pushdown has cyclomatic complexity 234 (threshold 15). Of this number, 229 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 127) crates/polars-plan/src/dsl/function_expr/mod.rs:816 — FunctionExpr::fmt has cyclomatic complexity 127 (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 111) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:114 — TypeCoercionRule::optimize_expr has cyclomatic complexity 111 (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 110) crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs:110 — SimplifyIRNodeOrder::simplify_ir_node_orders has cyclomatic complexity 110 (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 89) crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:156 — ExprOrderSimplifier::rec has cyclomatic complexity 89 (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 87) · ×1
  • IcebergScanResolver._to_dataset_scan_impl (cyclomatic 87) py-polars/src/polars/io/iceberg/_dataset.py:368 — IcebergScanResolver._to_dataset_scan_impl 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 79) crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:227 — SlicePushDown::pushdown has cyclomatic complexity 79 (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:33 — 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 · SimplifyExprRule · ×1
  • SimplifyExprRule::optimize_expr (cyclomatic 77) crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:701 — SimplifyExprRule::optimize_expr 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 · series.sequence_to_pyseries (cyclomatic 74) · ×1
  • series.sequence_to_pyseries (cyclomatic 74) py-polars/src/polars/_utils/construction/series.py:73 — series.sequence_to_pyseries has cyclomatic complexity 74 (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 · 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:470 — 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 · CastColumnsPolicy · ×1
  • CastColumnsPolicy::should_cast_column (cyclomatic 55) crates/polars-plan/src/dsl/file_scan/mod.rs:998 — 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:324 — 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:130 — 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:4468 — 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 · 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 · ReaderStarter · ×1
  • ReaderStarter::run (cyclomatic 45) crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/reader_starter.rs:61 — ReaderStarter::run 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 · 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 · 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 · IpcFileReader · ×1
  • IpcFileReader::begin_read (cyclomatic 38) crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:199 — IpcFileReader::begin_read 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.
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 · 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 · 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:732 — 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 · EquiJoinNode · ×1
  • EquiJoinNode::update_state (cyclomatic 33) crates/polars-stream/src/nodes/joins/equi_join.rs:1584 — EquiJoinNode::update_state 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:3383 — 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 · SemiAntiJoinNode · ×1
  • SemiAntiJoinNode::update_state (cyclomatic 32) crates/polars-stream/src/nodes/joins/semi_anti_join.rs:971 — SemiAntiJoinNode::update_state 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:1257 — 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 · 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 · ApplyExpr · ×1
  • ApplyExpr::evaluate_on_groups_impl (cyclomatic 29) crates/polars-expr/src/expressions/apply.rs:479 — ApplyExpr::evaluate_on_groups_impl 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.
D1 · Cyclomatic Complexity · BinaryExpr · ×1
  • BinaryExpr::evaluate_on_groups_impl (cyclomatic 29) crates/polars-expr/src/expressions/binary.rs:348 — BinaryExpr::evaluate_on_groups_impl 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. This is NOT this file's highest cyclomatic complexity: polars_expr::expressions::binary::apply_operator (cyclomatic 32) 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 · 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:1838 — 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 · ProbeState · ×1
  • ProbeState::partition_and_probe (cyclomatic 27) crates/polars-stream/src/nodes/joins/equi_join.rs:1036 — ProbeState::partition_and_probe 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:293 — 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:36 — 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 · dataframe._expand_dict_values (cyclomatic 26) · ×1
  • dataframe._expand_dict_values (cyclomatic 26) py-polars/src/polars/_utils/construction/dataframe.py:338 — 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:4485 — 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:503 — 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:1674 — 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 · DeltaDataset.to_dataset_scan (cyclomatic 25) · ×1
  • DeltaDataset.to_dataset_scan (cyclomatic 25) REDACTED:114 — DeltaDataset.to_dataset_scan 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 · 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:327 — 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 · 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:650 — 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:230 — 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:560 — 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 · SplitFields · ×1
  • SplitFields::next (cyclomatic 23) crates/polars-io/src/csv/read/splitfields.rs:215 — SplitFields::next 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 · GroupBySink · ×1
  • GroupBySink::spawn (cyclomatic 23) crates/polars-stream/src/nodes/group_by/sink.rs:497 — GroupBySink::spawn 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:877 — 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 · LazyFrame.describe (cyclomatic 23) · ×1
  • LazyFrame.describe (cyclomatic 23) py-polars/src/polars/lazyframe/frame.py:1059 — LazyFrame.describe 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 · 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:215 — 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:1002 — 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:4204 — 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 · IcebergSinkState._commit (cyclomatic 21) · ×1
  • IcebergSinkState._commit (cyclomatic 21) py-polars/src/polars/io/iceberg/_sink.py:1255 — IcebergSinkState._commit 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:1515 — 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 · MergeJoinNode · ×1
  • MergeJoinNode::update_state (cyclomatic 20) crates/polars-stream/src/nodes/joins/merge_join.rs:187 — 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:558 — 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 · 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:8221 — 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:8966 — 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:288 — 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 · 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:1039 — 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 · 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 · AdaptiveRateController · ×1
  • AdaptiveRateController::settle_lazy_tick (cyclomatic 18) crates/polars-io/src/cloud/http_rate_limit.rs:637 — AdaptiveRateController::settle_lazy_tick 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 · ListNameSpaceImpl · ×1
  • ListNameSpaceImpl::lst_concat (cyclomatic 18) crates/polars-ops/src/chunked_array/list/namespace.rs:558 — ListNameSpaceImpl::lst_concat 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.
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:93 — 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:2363 — 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 · _sink._partition_key_exprs (cyclomatic 18) · ×1
  • _sink._partition_key_exprs (cyclomatic 18) py-polars/src/polars/io/iceberg/_sink.py:521 — _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 · ConcurrencyController · ×1
  • ConcurrencyController::spawn_control_loop (cyclomatic 17) crates/polars-io/src/cloud/concurrency/mod.rs:288 — ConcurrencyController::spawn_control_loop 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 · 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:2957 — 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 · 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:170 — 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:553 — 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 · _sink._sort_key_exprs (cyclomatic 17) · ×1
  • _sink._sort_key_exprs (cyclomatic 17) py-polars/src/polars/io/iceberg/_sink.py:743 — _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 · 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:1109 — 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:549 — 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:141 — 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:128 — 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 · 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:217 — 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 · 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 457) crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:215 — ProjectionPushdownVisitor::pushdown has cognitive complexity 457 (threshold 15). Drivers by points: if/else 145 (311 pts), loops 30 (78 pts), match/switch 12 (36 pts), boolean chains 32 (nesting depth added 238). Of this number, 450 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 178) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:114 — TypeCoercionRule::optimize_expr has cognitive complexity 178 (threshold 15). Drivers by points: if/else 45 (104 pts), match/switch 21 (51 pts), loops 6 (17 pts), boolean chains 6 (nesting depth added 100). 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:368 — 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 147) crates/polars-plan/src/plans/optimizer/simplify_ordering/mod.rs:110 — SimplifyIRNodeOrder::simplify_ir_node_orders has cognitive complexity 147 (threshold 15). Drivers by points: if/else 37 (80 pts), boolean chains 42, match/switch 7 (14 pts), loops 4 (11 pts) (nesting depth added 57). 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 126) crates/polars-plan/src/plans/optimizer/simplify_ordering/expr.rs:156 — ExprOrderSimplifier::rec has cognitive complexity 126 (threshold 15). Drivers by points: if/else 52 (102 pts), match/switch 5 (9 pts), loops 4 (8 pts), boolean chains 7 (nesting depth added 58). To reduce it, split the body into named stages: move each independent 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 109) crates/polars-stream/src/nodes/io_sources/multi_scan/pipeline/tasks/reader_starter.rs:61 — ReaderStarter::run has cognitive complexity 109 (threshold 15). Drivers by points: if/else 38 (94 pts), match/switch 4 (8 pts), boolean chains 6, loops 1 (nesting depth added 60). 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 · CastColumnsPolicy · ×1
  • CastColumnsPolicy::should_cast_column (cognitive 106) crates/polars-plan/src/dsl/file_scan/mod.rs:998 — 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 · series.sequence_to_pyseries (cognitive 99) · ×1
  • series.sequence_to_pyseries (cognitive 99) py-polars/src/polars/_utils/construction/series.py:73 — series.sequence_to_pyseries has cognitive complexity 99 (threshold 15). Drivers by points: if/else 35 (61 pts), boolean chains 20, ternaries 5 (13 pts), error handling 1 (3 pts), loops 1 (2 pts) (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.
D2 · Cognitive Complexity · SlicePushDown · ×1
  • SlicePushDown::pushdown (cognitive 98) crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs:227 — SlicePushDown::pushdown has cognitive complexity 98 (threshold 15). Drivers by points: if/else 44 (79 pts), boolean chains 9, match/switch 4 (6 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 · 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 · _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:4468 — 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 · IpcFileReader · ×1
  • IpcFileReader::begin_read (cognitive 73) crates/polars-stream/src/nodes/io_sources/ipc/mod.rs:199 — IpcFileReader::begin_read has cognitive complexity 73 (threshold 15). Drivers by points: if/else 30 (49 pts), loops 8 (15 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent 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 · GroupBySink · ×1
  • GroupBySink::spawn (cognitive 70) crates/polars-stream/src/nodes/group_by/sink.rs:497 — GroupBySink::spawn has cognitive complexity 70 (threshold 15). Drivers by points: if/else 15 (47 pts), loops 6 (19 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.
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 · SimplifyExprRule · ×1
  • SimplifyExprRule::optimize_expr (cognitive 67) crates/polars-plan/src/plans/optimizer/simplify_expr/mod.rs:701 — SimplifyExprRule::optimize_expr has cognitive complexity 67 (threshold 15). Drivers by points: match/switch 13 (39 pts), if/else 15 (27 pts), boolean chains 1 (nesting depth added 38). 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 · 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:470 — 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 · Expr · ×1
  • Expr::fmt (cognitive 58) crates/polars-plan/src/dsl/format.rs:33 — 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:130 — 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 · ApplyExpr · ×1
  • ApplyExpr::evaluate_on_groups_impl (cognitive 54) crates/polars-expr/src/expressions/apply.rs:479 — ApplyExpr::evaluate_on_groups_impl has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (33 pts), boolean chains 12, 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 · CoreReader · ×1
  • CoreReader::parse_csv (cognitive 53) crates/polars-io/src/csv/read/read_impl.rs:327 — 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:36 — 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:650 — 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 · dataframe._expand_dict_values (cognitive 48) · ×1
  • dataframe._expand_dict_values (cognitive 48) py-polars/src/polars/_utils/construction/dataframe.py:338 — 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:1838 — 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:1515 — 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 · 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 · SourcesToFileInfo · ×1
  • SourcesToFileInfo::infer_or_parse (cognitive 42) crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1674 — 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:1257 — 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:3383 — 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 · BinaryExpr · ×1
  • BinaryExpr::evaluate_on_groups_impl (cognitive 40) crates/polars-expr/src/expressions/binary.rs:348 — BinaryExpr::evaluate_on_groups_impl has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 14, 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 · SplitLines · ×1
  • SplitLines::next (cognitive 39) crates/polars-io/src/csv/read/parser.rs:549 — 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:93 — 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 · 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:128 — 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 · LazyFrame.describe (cognitive 37) · ×1
  • LazyFrame.describe (cognitive 37) py-polars/src/polars/lazyframe/frame.py:1059 — LazyFrame.describe has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 9 (19 pts), if/else 5 (8 pts), boolean chains 6, loops 3 (4 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 · 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 · DataFrame.write_parquet (cognitive 34) · ×1
  • DataFrame.write_parquet (cognitive 34) py-polars/src/polars/dataframe/frame.py:4204 — 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:732 — 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:4485 — 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 · ProjectionBuilder · ×1
  • ProjectionBuilder::build_projection (cognitive 31) crates/polars-stream/src/nodes/io_sources/multi_scan/components/projection/builder.rs:110 — ProjectionBuilder::build_projection has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (19 pts), match/switch 3 (7 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 19). 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 · dataframe.iterable_to_pydf (cognitive 31) · ×1
  • dataframe.iterable_to_pydf (cognitive 31) py-polars/src/polars/_utils/construction/dataframe.py:1002 — 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 · Shared · ×1
  • Shared::run (cognitive 30) crates/polars-stream/src/nodes/group_by/flush.rs:139 — Shared::run has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (5 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.
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:315 — 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:560 — 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 · IcebergSinkState._commit (cognitive 30) · ×1
  • IcebergSinkState._commit (cognitive 30) py-polars/src/polars/io/iceberg/_sink.py:1255 — IcebergSinkState._commit has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 3 (8 pts), boolean chains 2, error handling 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 · LazyFrame.update (cognitive 30) · ×1
  • LazyFrame.update (cognitive 30) py-polars/src/polars/lazyframe/frame.py:8966 — 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 · ConcurrencyController · ×1
  • ConcurrencyController::spawn_control_loop (cognitive 29) crates/polars-io/src/cloud/concurrency/mod.rs:288 — ConcurrencyController::spawn_control_loop has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 3 (9 pts), loops 2 (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 · 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:170 — 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 · _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:141 — 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:553 — 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 · DeltaDataset.to_dataset_scan (cognitive 28) · ×1
  • DeltaDataset.to_dataset_scan (cognitive 28) REDACTED:114 — DeltaDataset.to_dataset_scan has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 8, ternaries 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 · 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:215 — 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 · 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:217 — 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 · Series._arithmetic (cognitive 27) · ×1
  • Series._arithmetic (cognitive 27) py-polars/src/polars/series/series.py:1039 — 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 · AdaptiveRateController · ×1
  • AdaptiveRateController::settle_lazy_tick (cognitive 26) crates/polars-io/src/cloud/http_rate_limit.rs:637 — AdaptiveRateController::settle_lazy_tick has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (19 pts), match/switch 2 (4 pts), boolean chains 3 (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 · 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 · 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:503 — 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 · IcebergSinkState.new (cognitive 25) · ×1
  • IcebergSinkState.new (cognitive 25) py-polars/src/polars/io/iceberg/_sink.py:877 — IcebergSinkState.new has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 8, ternaries 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.
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 · BufferedStream · ×1
  • BufferedStream::reinsert (cognitive 24) crates/polars-stream/src/nodes/joins/mod.rs:196 — 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:288 — 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:187 — 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:253 — 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:558 — 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:743 — _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 · 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:2957 — 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:945 — 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:2363 — 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 · 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 · 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 · GroupByNode · ×1
  • GroupByNode::spawn (cognitive 21) crates/polars-stream/src/nodes/group_by/mod.rs:450 — 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 · 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 · 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 · 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:903 — 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:1258 — 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:293 — 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 · 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 · PolarsObjectStore · ×1
  • PolarsObjectStore::get_ranges_sort (cognitive 19) crates/polars-io/src/cloud/polars_object_store.rs:467 — 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:412 — 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 · DataFrame.write_delta (cognitive 19) · ×1
  • DataFrame.write_delta (cognitive 19) py-polars/src/polars/dataframe/frame.py:4904 — DataFrame.write_delta has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, ternaries 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 · _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 · LazyFrame.sink_delta (cognitive 19) · ×1
  • LazyFrame.sink_delta (cognitive 19) py-polars/src/polars/lazyframe/frame.py:2747 — LazyFrame.sink_delta has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, ternaries 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 · 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 · HashKeys · ×1
  • HashKeys::from_df (cognitive 18) crates/polars-expr/src/hash_keys.rs:123 — HashKeys::from_df 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 · 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:359 — 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 · 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 · Collector · ×1
  • Collector::collect (cognitive 18) crates/polars-plan/src/plans/optimizer/join_order/cluster.rs:480 — Collector::collect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (6 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 · 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 · 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:11870 — 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:284 — 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) REDACTED:258 — _plugin._catalog_storage_options has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 2, ternaries 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 · _sink._partition_key_exprs (cognitive 18) · ×1
  • _sink._partition_key_exprs (cognitive 18) py-polars/src/polars/io/iceberg/_sink.py:521 — _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 · 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 · SortByExpr · ×1
  • SortByExpr::evaluate_on_groups_impl (cognitive 17) crates/polars-expr/src/expressions/sortby.rs:276 — 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:125 — 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 · 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 · PolarsObjectStoreBuilder · ×1
  • PolarsObjectStoreBuilder::build (cognitive 17) crates/polars-io/src/cloud/object_store_setup.rs:383 — 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 · 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:334 — 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 · 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 · Flush · ×1
  • Flush::next_step (cognitive 17) crates/polars-stream/src/nodes/sort/flush.rs:151 — Flush::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 · 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:455 — 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:1414 — 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:2149 — 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:12240 — 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 · 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:322 — 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 · Column · ×1
  • Column::arg_sort (cognitive 16) crates/polars-core/src/frame/column/mod.rs:1109 — 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:84 — 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:230 — 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:222 — 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 · 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 · RowGroupDataFetcher · ×1
  • RowGroupDataFetcher::next (cognitive 16) crates/polars-stream/src/nodes/io_sources/parquet/row_group_data_fetch.rs:177 — 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:538 — 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:169 — 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 · 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:5827 — 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 · IcebergTableWrap.get (cognitive 16) · ×1
  • IcebergTableWrap.get (cognitive 16) py-polars/src/polars/io/iceberg/_dataset.py:143 — IcebergTableWrap.get has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (6 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.
D2 · Cognitive Complexity · LazyFrame.join_asof (cognitive 16) · ×1
  • LazyFrame.join_asof (cognitive 16) py-polars/src/polars/lazyframe/frame.py:5636 — 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:245 — TooManyFields — 46 stored fields beside 50 methods. The bar is 30 stored fields; this is 16 over it, 1.53× 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.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×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
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (3 members, 49 shared lines) · ×1
  • Near-duplicate member family (3 members, 49 shared lines) crates/polars-plan/src/plans/aexpr/traverse.rs:14 — crates/polars-plan/src/plans/aexpr/traverse.rs:14-94 | crates/polars-plan/src/plans/aexpr/traverse.rs:104-189 | crates/polars-plan/src/plans/aexpr/traverse.rs:224-304 — These 3 members are variants of one another: a block of 49 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, 24 shared lines) · ×1
  • Near-duplicate member family (3 members, 24 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:241-359 | crates/polars-ops/src/frame/join/hash_join/single_keys_dispatch.rs:366-449 — These 3 members are variants of one another: a block of 24 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, 12 shared lines) · ×1
  • Near-duplicate member family (3 members, 12 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 12 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 (280 shared lines) · ×1
  • Near-duplicate member pair (280 shared lines) crates/polars-plan/src/dsl/function_expr/mod.rs:480 — crates/polars-plan/src/dsl/function_expr/mod.rs:480-812 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:464-803 — These two members are variants of one another: 280 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 (213 shared lines) · ×1
  • Near-duplicate member pair (213 shared lines) crates/polars-plan/src/dsl/function_expr/mod.rs:816 — crates/polars-plan/src/dsl/function_expr/mod.rs:816-1047 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:835-1070 — These two members are variants of one another: 213 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:306 — crates/polars-plan/src/plans/aexpr/traverse.rs:306-416 | crates/polars-plan/src/plans/aexpr/traverse.rs:418-531 — 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:324-424 — 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 (74 shared lines) · ×1
  • Near-duplicate member pair (74 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: 74 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 (61 shared lines) · ×1
  • Near-duplicate member pair (61 shared lines) crates/polars-stream/src/nodes/joins/equi_join.rs:1761 — crates/polars-stream/src/nodes/joins/equi_join.rs:1761-1877 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:1137-1252 — These two members are variants of one another: 61 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 (59 shared lines) · ×1
  • Near-duplicate member pair (59 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: 59 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 (54 shared lines) · ×1
  • Near-duplicate member pair (54 shared lines) crates/polars-stream/src/nodes/joins/equi_join.rs:589 — crates/polars-stream/src/nodes/joins/equi_join.rs:589-647 | crates/polars-stream/src/nodes/joins/semi_anti_join.rs:355-413 — These two members are variants of one another: 54 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 (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 (37 shared lines) · ×1
  • Near-duplicate member pair (37 shared lines) crates/polars-expr/src/expressions/apply.rs:250 — crates/polars-expr/src/expressions/apply.rs:250-341 | crates/polars-expr/src/expressions/structeval.rs:74-158 — 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 · 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 (29 shared lines) · ×1
  • Near-duplicate member pair (29 shared 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 variants of one another: 29 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 (27 shared lines) · ×1
  • Near-duplicate member pair (27 shared lines) crates/polars-core/src/frame/group_by/aggregations/mod.rs:1311 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:1311-1360 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1361-1411 — These two members are variants of one another: 27 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-ops/src/chunked_array/strings/find_many.rs:165 — crates/polars-ops/src/chunked_array/strings/find_many.rs:165-237 | crates/polars-ops/src/chunked_array/strings/find_many.rs:258-329 — 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 (19 shared lines) · ×1
  • Near-duplicate member pair (19 shared lines) crates/polars-ops/src/chunked_array/list/dispersion.rs:5 — crates/polars-ops/src/chunked_array/list/dispersion.rs:5-48 | crates/polars-ops/src/chunked_array/list/sum_mean.rs:224-266 — These two members are variants of one another: 19 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) · ×1
  • 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.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×1
  • Edited copy of a member (10 corresponding lines) crates/polars-expr/src/reduce/cov.rs:70 — crates/polars-expr/src/reduce/cov.rs:70-82 | crates/polars-expr/src/reduce/cov.rs:216-228 — 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 · Edited copy of a member (12 corresponding lines) · ×1
  • 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.
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 · 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.
D4 · Code Duplication · Duplicated block (77 lines × 2) · ×1
  • Duplicated block (77 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:596 — crates/polars-plan/src/dsl/function_expr/mod.rs:596-672 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:587-663 — 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 11 separate duplicated blocks between them, totalling at least 496 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 (73 lines × 2) · ×1
  • Duplicated block (73 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:724 — crates/polars-plan/src/dsl/function_expr/mod.rs:724-796 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:709-781 — 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 11 separate duplicated blocks between them, totalling at least 496 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 (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:359-424 — 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.
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 — 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.
D4 · Code Duplication · Duplicated block (60–61 lines × 2) · ×1
  • Duplicated block (60–61 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:524 — crates/polars-plan/src/dsl/function_expr/mod.rs:524-583 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:510-570 — 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 11 separate duplicated blocks between them, totalling at least 496 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 (57–59 lines × 2) · ×1
  • Duplicated block (57–59 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:982 — crates/polars-plan/src/dsl/function_expr/mod.rs:982-1038 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:1001-1059 — 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 11 separate duplicated blocks between them, totalling at least 496 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 (52 lines × 2) · ×1
  • Duplicated block (52 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:818 — crates/polars-plan/src/dsl/function_expr/mod.rs:818-869 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:837-888 — 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 11 separate duplicated blocks between them, totalling at least 496 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 (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.
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 — 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.
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.
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:2045-2083 — both copies are in the same file, so extract the 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 (32–35 lines × 2) · ×1
  • Duplicated block (32–35 lines × 2) crates/polars-io/src/cloud/concurrency/admission.rs:42 — crates/polars-io/src/cloud/concurrency/admission.rs:42-76 | crates/polars-io/src/cloud/concurrency/admission.rs:131-162 — both copies are in the same file, so extract the 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 (35 lines × 2) · ×1
  • 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.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×1
  • Duplicated block (33 lines × 2) crates/polars-expr/src/dispatch/array.rs:200 — crates/polars-expr/src/dispatch/array.rs:200-232 | 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.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • 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.
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.
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 (30 lines × 2) · ×1
  • Duplicated block (30 lines × 2) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1132 — crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1132-1161 | crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:1228-1257 — both copies are in the same file, so extract the 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 (29 lines × 2) · ×1
  • Duplicated block (29 lines × 2) crates/polars-plan/src/dsl/function_expr/mod.rs:682 — crates/polars-plan/src/dsl/function_expr/mod.rs:682-710 | crates/polars-plan/src/plans/aexpr/function_expr/mod.rs:670-698 — 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 11 separate duplicated blocks between them, totalling at least 496 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 (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 6 separate duplicated blocks between them, totalling at least 64 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–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) crates/polars-plan/src/plans/aexpr/filter_constraint.rs:901 — crates/polars-plan/src/plans/aexpr/filter_constraint.rs:901-925 | crates/polars-plan/src/plans/aexpr/filter_constraint.rs:1112-1135 — both copies are in the same file, so extract the 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–23 lines × 2) · ×1
  • Duplicated block (21–23 lines × 2) crates/polars-expr/src/dispatch/strings.rs:680 — crates/polars-expr/src/dispatch/strings.rs:680-700 | crates/polars-expr/src/dispatch/strings.rs:734-756 — both copies are in the same file, so extract the 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–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.
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.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) crates/polars-expr/src/expressions/apply.rs:255 — crates/polars-expr/src/expressions/apply.rs:255-275 | 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 6 separate duplicated blocks between them, totalling at least 80 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.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×1
  • 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.
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.
D4 · Code Duplication · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) crates/polars-stream/src/nodes/dynamic_group_by.rs:355 — crates/polars-stream/src/nodes/dynamic_group_by.rs:355-372 | crates/polars-stream/src/nodes/rolling_fixed_window.rs:204-221 | crates/polars-stream/src/nodes/rolling_group_by.rs:295-312 | crates/polars-stream/src/nodes/sorted_group_by.rs:180-197 — 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 6 separate duplicated blocks between them, totalling at least 66 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.
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.
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.
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.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) crates/polars-plan/src/plans/aexpr/traverse.rs:51 — crates/polars-plan/src/plans/aexpr/traverse.rs:51-67 | crates/polars-plan/src/plans/aexpr/traverse.rs:141-157 | crates/polars-plan/src/plans/aexpr/traverse.rs:261-277 — 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 (16 lines × 4) · ×1
  • Duplicated block (16 lines × 4) crates/polars-python/src/conversion/mod.rs:451 — crates/polars-python/src/conversion/mod.rs:451-466 | crates/polars-python/src/conversion/mod.rs:500-515 | 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 (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.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×1
  • 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.
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.
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:1264 — crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1264-1278 | crates/polars-plan/src/plans/conversion/dsl_to_ir/scans.rs:1582-1594 — both copies are in the same file, so extract the 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 (13–14 lines × 3) · ×1
  • Duplicated block (13–14 lines × 3) crates/polars-stream/src/physical_plan/lower_expr.rs:1061 — crates/polars-stream/src/physical_plan/lower_expr.rs:1061-1073 | crates/polars-stream/src/physical_plan/lower_expr.rs:1274-1287 | crates/polars-stream/src/physical_plan/lower_expr.rs:1406-1419 — 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 (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.
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.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • 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.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×1
  • Duplicated block (10–13 lines × 2) crates/polars-io/src/utils/byte_source.rs:341 — crates/polars-io/src/utils/byte_source.rs:341-353 | crates/polars-io/src/utils/byte_source.rs:398-407 — both copies are in the same file, so extract the 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 (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.
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.
D4 · Code Duplication · Duplicated block (8–12 lines × 3) · ×1
  • Duplicated block (8–12 lines × 3) crates/polars-core/src/utils/supertype.rs:216 — crates/polars-core/src/utils/supertype.rs:216-223 | crates/polars-core/src/utils/supertype.rs:237-244 | crates/polars-core/src/utils/supertype.rs:296-307 — 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 (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:833 — crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:833-841 | crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:860-869 | crates/polars-plan/src/plans/conversion/type_coercion/mod.rs:913-923 — 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 (9–10 lines × 7) · ×1
  • Duplicated block (9–10 lines × 7) crates/polars-expr/src/reduce/any_all.rs:66 — crates/polars-expr/src/reduce/any_all.rs:66-74 | crates/polars-expr/src/reduce/any_all.rs:165-173 | crates/polars-expr/src/reduce/any_all.rs:271-280 | crates/polars-expr/src/reduce/any_all.rs:397-406 | crates/polars-expr/src/reduce/bitwise.rs:187-195 | crates/polars-expr/src/reduce/min_max.rs:466-474 | crates/polars-expr/src/reduce/min_max.rs:582-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 32 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.
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:695 — crates/polars-stream/src/physical_plan/lower_expr.rs:695-702 | crates/polars-stream/src/physical_plan/lower_expr.rs:742-751 | crates/polars-stream/src/physical_plan/lower_expr.rs:773-780 | crates/polars-stream/src/physical_plan/lower_expr.rs:2441-2448 | crates/polars-stream/src/physical_plan/lower_expr.rs:2579-2586 — 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.
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:1078 — crates/polars-stream/src/physical_plan/lower_expr.rs:1078-1086 | crates/polars-stream/src/physical_plan/lower_expr.rs:1260-1269 | crates/polars-stream/src/physical_plan/lower_expr.rs:1432-1440 — 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 (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.
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:688 — crates/polars-stream/src/physical_plan/lower_expr.rs:688-695 | crates/polars-stream/src/physical_plan/lower_expr.rs:728-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.
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:351 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:351-353 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1139-1140 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:98-106 | crates/polars-ops/src/chunked_array/nan_propagating_aggregate.rs:165-173 — 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 (6–9 lines × 2) · ×1
  • Duplicated block (6–9 lines × 2) crates/polars-parquet/src/parquet/write/compression.rs:150 — crates/polars-parquet/src/parquet/write/compression.rs:150-158 | crates/polars-parquet/src/parquet/write/compression.rs:175-180 — both copies are in the same file, so extract the 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 (7–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) crates/polars-expr/src/expressions/slice.rs:165 — crates/polars-expr/src/expressions/slice.rs:165-171 | crates/polars-expr/src/expressions/slice.rs:207-213 | crates/polars-expr/src/expressions/slice.rs:249-256 — 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.
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:1078 — crates/polars-stream/src/physical_plan/lower_expr.rs:1078-1083 | crates/polars-stream/src/physical_plan/lower_expr.rs:1260-1265 | crates/polars-stream/src/physical_plan/lower_expr.rs:1295-1300 | crates/polars-stream/src/physical_plan/lower_expr.rs:1326-1331 | crates/polars-stream/src/physical_plan/lower_expr.rs:1431-1437 — 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.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • 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.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) crates/polars-core/src/frame/group_by/aggregations/mod.rs:536 — crates/polars-core/src/frame/group_by/aggregations/mod.rs:536-541 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:719-724 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:825-830 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:899-905 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:992-998 | crates/polars-core/src/frame/group_by/aggregations/mod.rs:1057-1063 — 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.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • 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 32 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.
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 32 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.
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 32 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.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) crates/polars-expr/src/reduce/count.rs:61 — crates/polars-expr/src/reduce/count.rs:61-65 | crates/polars-expr/src/reduce/count.rs:98-102 | crates/polars-expr/src/reduce/count.rs:231-235 | crates/polars-expr/src/reduce/has_nulls.rs:51-55 | crates/polars-expr/src/reduce/is_empty.rs:58-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 (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.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • 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 5 separate duplicated blocks between them, totalling at least 54 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 (11 lines × 4) · ×1
  • 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.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:374 — crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:374-383 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:455-464 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:495-504 | crates/polars-time/src/chunkedarray/rolling_window/dispatch.rs:664-673 — 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.
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 (102–141 lines × 2) · ×1
  • Duplicated block (102–141 lines × 2) py-polars/src/polars/dataframe/frame.py:7223 — py-polars/src/polars/dataframe/frame.py:7223-7363 | py-polars/src/polars/lazyframe/frame.py:5031-5132 — `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 334 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:1419 — py-polars/src/polars/functions/lazy.py:1419-1530 | py-polars/src/polars/functions/lazy.py:1633-1695 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1419` 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:499-551 — `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 334 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:103 — py-polars/src/polars/dataframe/plotting.py:103-154 | py-polars/src/polars/dataframe/plotting.py:169-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. Read the line range as the matched WINDOW rather than a finished unit: at `py-polars/src/polars/dataframe/plotting.py: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. 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:2681-2696 | py-polars/src/polars/lazyframe/frame.py:2700-2715 | py-polars/src/polars/lazyframe/frame.py:3776-3791 | py-polars/src/polars/lazyframe/frame.py:3803-3818 — 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:491 — py-polars/src/polars/io/csv/functions.py:491-505 | py-polars/src/polars/lazyframe/frame.py:2703-2717 | py-polars/src/polars/lazyframe/frame.py:3786-3800 | py-polars/src/polars/lazyframe/frame.py:3814-3828 | py-polars/src/polars/lazyframe/frame.py:9680-9694 — 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:491` 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:447-499 — 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:2840 — py-polars/src/polars/dataframe/frame.py:2840-2896 | py-polars/src/polars/expr/meta.py:405-451 — 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: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. 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:7146 — py-polars/src/polars/dataframe/frame.py:7146-7215 | py-polars/src/polars/lazyframe/frame.py:7243-7319 — `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 334 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 (40 lines × 2) · ×1
  • 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:1398-1437 — 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 (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:1440-1476 — 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.91 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:1128 — `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:366 — The `if` guard on line 366 (`(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.
X3 · Exception handling · Swallowed exception (empty catch) · ×1
  • Swallowed exception (empty catch) py-polars/src/polars/io/iceberg/_utils.py:634 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Minor — 107 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×65
  • 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 py-polars/src/polars/functions/aggregation/horizontal.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/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 crates/polars-expr/src/reduce/cov.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/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 crates/polars-io/src/ipc/ipc_stream.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-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-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-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 py-polars/src/polars/_utils/convert.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.
  • + 40 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • 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:5097 — `credential_provider is not None and credential_provider != "auto"` appears character-identically in 4 files — py-polars/src/polars/dataframe/frame.py, py-polars/src/polars/io/delta/functions.py, py-polars/src/polars/io/lance/api.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/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:146 — `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 REDACTED:250 — `filter_columns is not None or best_effort_statistics_columns` appears character-identically in 2 files — REDACTED, py-polars/src/polars/io/iceberg/_dataset.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/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:2653 — `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:342 — `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:5118 — `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.rs:212 — `!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.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-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-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:596 — `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-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-arrow/src/array/fixed_size_list/builder.rs:124 — `group_start + group_len < idxs.len() && idxs[group_start + group_len] as usize == start_idx + group_len` appears character-identically in 2 files — crates/polars-arrow/src/array/fixed_size_list/builder.rs, crates/polars-arrow/src/array/list/builder.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-arrow/src/array/fixed_size_list/builder.rs:160 — `group_start + group_len < idxs.len() && idxs[group_start + group_len] as usize == start_idx + group_len && start_idx + group_len < other.len…` appears character-identically in 2 files — crates/polars-arrow/src/array/fixed_size_list/builder.rs, crates/polars-arrow/src/array/list/builder.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-arrow/src/array/fixed_size_list/builder.rs:174 — `group_start + group_len < idxs.len() && idxs[group_start + group_len] as usize >= other.len()` appears character-identically in 2 files — crates/polars-arrow/src/array/fixed_size_list/builder.rs, crates/polars-arrow/src/array/list/builder.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:586 — `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.
D16 · Bus Factor · Off-boarding risk · ×6
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 31 significant file(s) lose their only recent owner: crates/polars-arrow/src/io/avro/write/serialize.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, crates/polars-async/src/primitives/connector.rs (+23 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 13 significant file(s) lose their only recent owner: crates/polars-stream/src/nodes/io_sources/multi_scan/components/apply_extra_ops.rs, 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/hive.rs, crates/polars-io/src/file_cache/cache.rs, crates/polars-utils/src/row_counter.rs, py-polars/src/polars/lazyframe/resolver/_resolver.py (+5 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 11 significant file(s) lose their only recent owner: crates/polars-plan/src/plans/optimizer/join_order/cluster.rs, crates/polars-parquet/src/arrow/write/nested/dremel/tests.rs, crates/polars-stream/src/nodes/joins/runtime_filter.rs, crates/polars-plan/src/plans/optimizer/join_order/enumerate.rs, crates/polars-utils/src/bloom_filter.rs, crates/polars-stream/src/nodes/io_sources/parquet/passes.rs, crates/polars-parquet/src/arrow/write/nested/dremel/mod.rs, crates/polars-ops/src/chunked_array/strings/literal_chain.rs (+3 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 7 significant file(s) lose their only recent owner: crates/polars-io/src/cloud/dns.rs, crates/polars-compute/src/gather/list.rs, crates/polars-io/src/cloud/concurrency/admission.rs, crates/polars-io/src/cloud/concurrency/model.rs, crates/polars-stream/src/nodes/io_sources/shared/pipeline_budget.rs, crates/polars-arrow/src/io/avro/read/mod.rs, crates/polars-arrow/src/array/ffi.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 6 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-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, 3 significant file(s) lose their only recent owner: 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 (74 single-owned of 1524 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; 1524 of the 2242 production source files in this repository met that bar). They are anonymized user #7 (2 file(s)), anonymized user #8 (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 — 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/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 11 of 42 project(s) overshoot their size bounds, lowering Project Cohesion to 4.8/10. The most over is `py-polars` (107354 LoC, 388 module-visible types across 43 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
D34 · Knowledge Freshness · Orphaned files with no living knowledge · ×1
  • Orphaned files with no living knowledge — 65 of 1524 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (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; 1524 of the 2242 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one 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, py-polars/src/polars/functions/aggregation/horizontal.py, py-polars/src/polars/datatype_expr/datatype_expr.py (and 57 more). 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/5 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `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.
Minor — 28 finding(s)
D12 · Dependency Hygiene · Outdated · ×28
  • 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.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-config` and commit the updated REDACTED.
  • Outdated: aws-lc-rs — `aws-lc-rs` is locked at 1.18.0 but 1.18.2 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.155.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: 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.10 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: 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: 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.
  • Outdated: signal-hook — `signal-hook` is locked at 0.4.4 but 0.4.5 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in crates/polars-error/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p signal-hook` and commit the updated REDACTED.
  • Outdated: thiserror — `thiserror` is locked at 2.0.20 but 2.0.21 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in pyo3-polars/pyo3-polars/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p thiserror` and commit the updated REDACTED.
  • Outdated: tokio — `tokio` is locked at 1.53.1 but 1.54.1 is the current stable release on crates.io, and it already satisfies the `"1.44"` requirement declared in crates/polars-arrow/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tokio` and commit the updated REDACTED.
  • + 3 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/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-fd820190978049a394ecb5d6f53d62c4/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/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-fd820190978049a394ecb5d6f53d62c4/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/watchdog-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 .156artifacts/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 01a1760e-3233-70ab-a65c-b80de455a541 · 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