Skip to content

feat: add use_nearest_context rule (#190)#293

Open
solid-illiaaihistov wants to merge 2 commits into
solid-software:analysis_server_migrationfrom
solid-illiaaihistov:issue-190-implement-use_nearest_context
Open

feat: add use_nearest_context rule (#190)#293
solid-illiaaihistov wants to merge 2 commits into
solid-software:analysis_server_migrationfrom
solid-illiaaihistov:issue-190-implement-use_nearest_context

Conversation

@solid-illiaaihistov

Copy link
Copy Markdown
Contributor

Closes #190

@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 introduces the use_nearest_context lint rule along with two quick fixes (RenameNearestContextParameterFix and ReplaceWithNearestContextParameterFix) to ensure BuildContext is accessed from the nearest available scope. It also updates isBuildContext to support nullable types and includes comprehensive unit tests. The review feedback highlights two important improvements: first, ReplaceWithNearestContextParameterFix should be extended to handle direct usage of context (not just property accesses on this); second, the visitor can be simplified by using element.nameOffset directly to avoid an unnecessary null check.

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.

@solid-illiaaihistov

Copy link
Copy Markdown
Contributor 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 introduces the use_nearest_context lint rule, which encourages using the BuildContext from the nearest available scope. It includes the rule implementation, a visitor, utility functions, unit tests, and two quick fixes: RenameNearestContextParameterFix and ReplaceWithNearestContextParameterFix. The feedback highlights an issue in the ReplaceWithNearestContextParameterFix where plain SimpleIdentifiers (like plain context usage) are not replaced, and suggests adding a fallback. Additionally, it recommends simplifying the scope check in UseNearestContextVisitor by using element.nameOffset directly to avoid null checks.

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.

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.

1 participant