Skip to content

False positives for google_checks when using switch expression in lambda #16949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Abdelrhmansersawy
Copy link
Contributor

Issue #16762

@Abdelrhmansersawy Abdelrhmansersawy force-pushed the false-postive-switch-lambda-indentation branch from 827139e to 43cd3db Compare April 25, 2025 18:59
@Abdelrhmansersawy Abdelrhmansersawy marked this pull request as draft April 27, 2025 18:49
@romani
Copy link
Member

romani commented Apr 30, 2025

@Abdelrhmansersawy , ping.

Copy link

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid dry if possible

Comment on lines +88 to +97
// Check for assignment context (from PR #16418)
if (TokenUtil.isOfType(grandParent, TokenTypes.ASSIGN)) {
indentLevel = new IndentLevel(indentLevel,
getIndentCheck().getLineWrappingIndentation());
}
// Check for lambda context
else if (TokenUtil.isOfType(grandParent, TokenTypes.LAMBDA)) {
indentLevel = new IndentLevel(indentLevel,
getIndentCheck().getLineWrappingIndentation());
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Check for assignment context (from PR #16418)
if (TokenUtil.isOfType(grandParent, TokenTypes.ASSIGN)) {
indentLevel = new IndentLevel(indentLevel,
getIndentCheck().getLineWrappingIndentation());
}
// Check for lambda context
else if (TokenUtil.isOfType(grandParent, TokenTypes.LAMBDA)) {
indentLevel = new IndentLevel(indentLevel,
getIndentCheck().getLineWrappingIndentation());
}
// Check for assignment and lambda context (from PR #16418)
if (TokenUtil.isOfType(grandParent, TokenTypes.ASSIGN) || TokenUtil.isOfType(grandParent, TokenTypes.LAMBDA)) {
indentLevel = new IndentLevel(indentLevel,
getIndentCheck().getLineWrappingIndentation());
}

avoid dry if possible

@Abdelrhmansersawy
Copy link
Contributor Author

@Abdelrhmansersawy , ping.

I’ve stopped working on this PR because there is another PR#16721 that addresses a different false-positive issue, which also happens to resolve this one.

What’s your opinion on continuing to solve this issue separately, or should we rely on the open PRs since they’ve made significant progress and only need a few more steps to be completed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants