checkstyle / checkstyle/checkstyle
Add configurable maximum method length threshold for lambda expressions
- 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
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