Skip to content

Investigate Bumpy Road semantic discrepancy with CodeScene #357

Description

@coderabbitai

Summary

Investigate the semantic difference between Whitaker's bumpy_road_function lint and CodeScene's Bumpy Road diagnostic.

Whitaker does run the lint. The non-finding is due to rule semantics, not rule absence.

The discrepancy was identified while assessing leynos/rstest-bdd#657, specifically:

  • crates/rstest-bdd-macros/src/codegen/tracking/mod.rs
  • TrackedFeaturePath::relative_to_manifest

CodeScene reports this function because it contains two nested conditional blocks. Whitaker does not report it.

Current Whitaker behaviour

Whitaker builds a weighted, per-line complexity signal. It reports only when it finds at least two separated bumps after smoothing.

Each bump must meet the current defaults:

  • Weighted smoothed score of at least 2.5.
  • Span of at least 2 contiguous lines.
  • Survival through a centred moving-average window of 3.

TrackedFeaturePath::relative_to_manifest does not meet these conditions:

  • The prefix-validation if has a predicate contribution of 0.5 and a body-depth contribution of 1.0.
  • The common-prefix loop's if has the same maximum local contribution.
  • The while let condition is a let pattern. Whitaker excludes let predicates from scoring.
  • The let Some(text) = ... else construct does not create a scored if cluster.

The repository has no [bumpy_road_function] override in dylint.toml.

Expected investigation

Determine whether Whitaker should provide a mode, configuration, or supplementary diagnostic that detects CodeScene-style Bumpy Road cases. CodeScene treats two nested conditional blocks as a finding even when they do not form two sustained, separated weighted bumps.

Document the intended relationship between the two models if their semantics must remain different.

Affected area

  • crates/bumpy_road_function/
  • Bumpy Road configuration and user documentation
  • The score, smoothing, and bump-segmentation logic

Acceptance criteria

  • Reproduce and document the outcome for TrackedFeaturePath::relative_to_manifest, or an equivalent minimal Rust fixture.
  • State whether semantic alignment with CodeScene is a project goal.
  • If alignment is a goal, define an implementation approach and tests for this two-nested-conditional case.
  • If alignment is not a goal, document the difference, including the score threshold, minimum span, smoothing window, and excluded let predicates.
  • Update user-facing configuration or documentation so users can select or understand the applicable Bumpy Road model.

Source

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or requesttestingTest coverage, test infrastructure, and verification tooling work.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions