Skip to content

migrate prefer early return rule with tests#232

Merged
andrew-bekhiet-solid merged 7 commits into
analysis_server_migrationfrom
migrate/prefer_early_return
Jun 8, 2026
Merged

migrate prefer early return rule with tests#232
andrew-bekhiet-solid merged 7 commits into
analysis_server_migrationfrom
migrate/prefer_early_return

Conversation

@Islam-Shaaban-Ibrahim

Copy link
Copy Markdown

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the prefer_early_return lint rule to align with the AnalysisRule API, simplifying the rule definition and its associated visitor. Review feedback identifies a regression where if statements with else blocks are no longer excluded from reporting, potentially leading to undesirable lint triggers. There is also a concern regarding the use of RecursiveAstVisitor with addBlockFunctionBody, which may result in duplicate diagnostics for nested functions.

Comment thread lib/src/lints/prefer_early_return/visitors/prefer_early_return_visitor.dart Outdated
Comment thread lib/src/lints/prefer_early_return/prefer_early_return_rule.dart Outdated
Comment thread lib/src/lints/prefer_early_return/visitors/prefer_early_return_visitor.dart Outdated
Comment thread lib/src/lints/prefer_early_return/visitors/prefer_early_return_visitor.dart Outdated
Comment thread lib/src/lints/prefer_early_return/prefer_early_return_rule.dart Outdated
Comment thread test/prefer_early_return_rule_test.dart Outdated
Comment thread test/prefer_early_return_rule_test.dart Outdated
@solid-software solid-software deleted a comment from Andrew-Bekhiet Jun 4, 2026
test: add nested 3 ifs test case
@andrew-bekhiet-solid andrew-bekhiet-solid merged commit adfd585 into analysis_server_migration Jun 8, 2026
0 of 2 checks passed
@andrew-bekhiet-solid andrew-bekhiet-solid deleted the migrate/prefer_early_return branch June 8, 2026 19:15
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.

5 participants