Skip to content

refactor: migrate no_empty_block#299

Merged
solid-illiaaihistov merged 4 commits into
solid-software:analysis_server_migrationfrom
solid-illiaaihistov:254-migrate-no_empty_block
Jun 25, 2026
Merged

refactor: migrate no_empty_block#299
solid-illiaaihistov merged 4 commits into
solid-software:analysis_server_migrationfrom
solid-illiaaihistov:254-migrate-no_empty_block

Conversation

@solid-illiaaihistov

Copy link
Copy Markdown
Collaborator

Closes #254

@solid-illiaaihistov solid-illiaaihistov linked an issue Jun 24, 2026 that may be closed by this pull request

@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 no_empty_block lint rule to utilize the updated custom lint API, migrating from CustomLintResolver to RuleContext and RuleVisitorRegistry. It also introduces a comprehensive unit test suite in no_empty_block_rule_test.dart to replace the previous manual test file. Feedback on this PR highlights a bug in the _isPrecedingCommentToDo helper method of NoEmptyBlockVisitor, which fails to traverse the linked list of preceding comments and may incorrectly report a lint if a TODO comment is not the first comment in the block.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread test/src/lints/no_empty_block/no_empty_block_rule_test.dart
@solid-illiaaihistov

Copy link
Copy Markdown
Collaborator Author

/gemini review

@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 no_empty_block lint rule to align with the updated custom lint rule structure, registers it in the main plugin, and adds comprehensive unit tests. The review feedback suggests traversing up all ancestor declarations when checking for exclusions to correctly handle nested closures or local functions, and making the TODO comment check case-insensitive to improve usability.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread lib/src/lints/no_empty_block/visitors/no_empty_block_visitor.dart
Comment thread lib/src/lints/no_empty_block/visitors/no_empty_block_visitor.dart

@solid-danylosafonov solid-danylosafonov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, one minor suggestion

exclude:
- method_name: excludeMethod
- class_name: Exclude
method_name: excludeMethod

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should rename it so that we can be sure that it's not ignored because of the above - method_name: excludeMethod

Suggested change
method_name: excludeMethod
method_name: excludeClassMethod

@solid-illiaaihistov solid-illiaaihistov merged commit f32d2ae into solid-software:analysis_server_migration Jun 25, 2026
1 check failed
@solid-illiaaihistov solid-illiaaihistov deleted the 254-migrate-no_empty_block branch June 25, 2026 13:50
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.

Migrate no_empty_block

2 participants