Replace CK001 line-count heuristic with CK007 LCOM4 cohesion analysis #6

Manually merged
tvidal merged 1 commit from feat/006-replace-ck001-line-count-heuristic-with-ck007 into master 2026-03-17 17:29:26 +01:00
Owner

Replace CK001 line-count heuristic with CK007 LCOM4 cohesion analysis

Touches 6 files: ckeditor-lint/src/rules/ck007_lack_of_cohesion.rs, ckeditor-lint/src/rules/mod.rs, ckeditor/src/app_layout/ai_actions.rs, ckeditor/src/app_layout/mod.rs, ckeditor/src/app_layout/project_poll.rs, ckeditor/src/git/mod.rs.

Replace CK001 line-count heuristic with CK007 LCOM4 cohesion analysis Touches 6 files: `ckeditor-lint/src/rules/ck007_lack_of_cohesion.rs`, `ckeditor-lint/src/rules/mod.rs`, `ckeditor/src/app_layout/ai_actions.rs`, `ckeditor/src/app_layout/mod.rs`, `ckeditor/src/app_layout/project_poll.rs`, `ckeditor/src/git/mod.rs`.
tvidal approved these changes 2026-03-17 11:58:18 +01:00
tvidal left a comment

A clear improvement. The change in ckeditor-lint/src/rules/ck007_lack_of_cohesion.rs is the part I would have argued for.

A clear improvement. The change in `ckeditor-lint/src/rules/ck007_lack_of_cohesion.rs` is the part I would have argued for.
@ -0,0 +306,4 @@
// Formatting: human-readable cluster report
// ---------------------------------------------------------------------------
fn format_clusters(components: &[Vec<String>], info: &ImplInfo) -> String {
Owner

format_clusters reads, decides and writes in one function. The deciding part is the piece I would want to test on its own. Worth splitting?

`format_clusters` reads, decides and writes in one function. The deciding part is the piece I would want to test on its own. Worth splitting?
Author
Owner

Split. The decision in format_clusters is a pure function now, with its own tests in ckeditor-lint/src/rules/ck007_lack_of_cohesion.rs.

Split. The decision in `format_clusters` is a pure function now, with its own tests in `ckeditor-lint/src/rules/ck007_lack_of_cohesion.rs`.
CK001 used a 300-line file limit as a proxy for single responsibility —
blunt and prone to false positives. CK007 replaces it with LCOM4 (Lack
of Cohesion of Methods), a graph-theoretic metric that proves whether a
struct violates single responsibility by computing connected components
over shared field access. Also fixes the two violations it found:
extracts poll_project_tree to its own file and removes dead worktree
config accessors.
tvidal manually merged commit c2cec3352b into master 2026-03-17 17:29:26 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
northgale/ckeditor!6
No description provided.