Skip to content

Migrated prefer_early_return and its tests#233

Open
Dariaa14 wants to merge 2 commits intoanalysis_server_migrationfrom
fix-232-prefer-early-return
Open

Migrated prefer_early_return and its tests#233
Dariaa14 wants to merge 2 commits intoanalysis_server_migrationfrom
fix-232-prefer-early-return

Conversation

@Dariaa14
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

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

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 migrates the PreferEarlyReturnRule from SolidLintRule to AnalysisRule and updates the PreferEarlyReturnVisitor to report diagnostics directly via the rule instance. It also introduces a comprehensive test suite to verify the lint's behavior in various scenarios. A minor grammatical correction was suggested for the lint message to ensure consistency with the rule's description.

/// Lint code
static const LintCode _code = LintCode(
lintName,
"Use reverse if reduce nesting",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The lint message is missing the word 'to', which makes it grammatically incorrect and inconsistent with the rule's description on line 48. It should be updated to 'Use reverse if to reduce nesting'.

Suggested change
"Use reverse if reduce nesting",
"Use reverse if to reduce nesting",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Dariaa14, please take a look. Also, I believe we can extract it into a constant to reuse.

Copy link
Copy Markdown
Collaborator

@solid-vovabeloded solid-vovabeloded left a comment

Choose a reason for hiding this comment

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

Well done, @Dariaa14!
I added one minor suggestion here, but approving it right away since it is minor.

/// Lint code
static const LintCode _code = LintCode(
lintName,
"Use reverse if reduce nesting",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Dariaa14, please take a look. Also, I believe we can extract it into a constant to reuse.

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.

2 participants