checkstyle / checkstyle/checkstyle

Add configurable maximum method length threshold for lambda expressions

Open
#19,392 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.6k
Forks
4.2k
Avg merge
22h 23m
Merged PRs (30d)
232

Description

### Problem Description

Checkstyle currently provides checks for method length, but similar validation is not consistently applied to lambda expressions.

With the increasing use of lambda expressions in modern Java, large and complex lambdas can reduce readability and maintainability, yet they are not flagged by existing checks.

### Example

```java
list.stream().forEach(item -> {
// 40+ lines of logic
int a = item.getA();
int b = item.getB();
int c = a + b;
if (c > 10) {
// multiple nested conditions
}
// more complex logic...
});

Contributor guide

Open the contributing guide

Research direction

No file, test, or entry point is named. Start by locating the existing method-length check and its tests, then determine how lambda expressions are represented and configured; done means a configurable lambda-length threshold is enforced with coverage for the example behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.