astral-sh / astral-sh/ruff

Rule for cohesion (LCOM4 or similar)

Open
#20,135 2 comments 0 reactions 0 assignees View on GitHub
needs-decision rule
Dominant language
Rust
Stars
49.7k
Forks
2.4k
Avg merge
2d 1h
Merged PRs (30d)
458

Description

### Summary

Hi! 👋

I was looking at rules that measure cohesion in ruff, and I did not find much.

There is this library https://github.com/mschwager/cohesion, which can work as a flake8 plugin, with a rule (`H601 class has low cohesion`).

Any plans to implement something similar? Or maybe something like this already exists in ruff and I missed it?

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start by reviewing Ruff's existing rule set and the linked cohesion library, especially its H601 flake8 rule. Determine whether a cohesion rule belongs in Ruff and define the intended LCOM4 or similar metric, supported Python constructs, diagnostics, and tests before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.