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 refactors the
protolint
codebase to improve modularity by introducing a newlibinternal
package and updating the usage of linting functionality across the project. It also includes changes to streamline testing and enhance error handling. Below is a summary of the most important changes:Refactoring for Modularity
libinternal
package to encapsulate core linting logic, including theLint
function,LintRunner
interface, and error definitions (ErrLintFailure
andErrInternalFailure
). This improves separation of concerns and reduces coupling between internal components (internal/libinternal/lint.go
).lib
package to delegate linting logic tolibinternal
, simplifying its implementation. Thelib.Lint
function now auto-initializes the default runner if none is set (lib/lint.go
). [1] [2]Code Adjustments for Refactoring
lib
package withlibinternal
in various files, such ascmd/lint_runner.go
andmcp/tools.go
, to align with the new modular structure. This includes changes to function calls and error handling (internal/cmd/lint_runner.go
,mcp/tools.go
). [1] [2] [3] [4]Testing Enhancements
LintRunner
into a separate test package (lib_test
) and introduced aNewMockLintRunner
function for cleaner test setup. This ensures the original runner is restored after tests (lib/mock_lint_runner_test.go
). [1] [2]lib/lint_test.go
to use the newNewMockLintRunner
function for testing, ensuring isolation and maintainability of test cases.Documentation Updates
README.md
file to include a more comprehensive example of usingprotolint
from Go code, demonstrating error handling and output processing (README.md
).