Fix disabling FILE_NAMES_LOWER_SNAKE_CASE #474
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several changes to enhance the functionality of proto file linting, primarily by refactoring the
Finally
methods across various visitors to accept a*parser.Proto
parameter. Additionally, it improves handling of file name rules and introduces new test cases to validate these updates.Refactoring of Visitor Methods:
Updated the
Finally
method inBaseVisitor
,BaseFixableVisitor
, and other visitor implementations (indentVisitor
,orderVisitor
, etc.) to accept a*parser.Proto
parameter for better context during finalization. [1] [2] [3] [4] [5]Modified the
extendedAutoDisableVisitor
andextendedDisableRuleVisitor
to pass the*parser.Proto
object to their inner visitors during theFinally
method call. [1] [2]File Name Rule Enhancements:
Introduced support for disabling the
FILE_NAMES_LOWER_SNAKE_CASE
rule using a directive (// protolint:disable FILE_NAMES_LOWER_SNAKE_CASE
) in proto files.Adjusted the
fileNamesLowerSnakeCaseVisitor
to rename files only when the rule is not disabled and updated itsFinally
method for clarity.Test Case Additions:
Added test cases to verify that the
FILE_NAMES_LOWER_SNAKE_CASE
rule is correctly disabled when the directive is present and that no renaming occurs in such cases. [1] [2]Enhanced the test suite for
Finally
method behavior, ensuring proper handling of the*parser.Proto
parameter across various scenarios.Interface and Usage Adjustments:
HasExtendedVisitor
interface to remove theOnStart
method and modify theFinally
method to accept a*parser.Proto
parameter. Adjusted theRunVisitorAutoDisable
function accordingly. [1] [2]