protolint  by yoheimuta

CLI tool for Protocol Buffer linting and style enforcement

created 6 years ago
643 stars

Top 52.8% on sourcepulse

GitHubView on GitHub
Project Summary

Protolint is a pluggable linter and fixer for Protocol Buffer files, designed to enforce style and conventions. It targets developers working with Protocol Buffers who need to maintain code quality and consistency, offering automatic fixes and customizable rules to streamline the development workflow.

How It Works

Protolint operates by parsing Protocol Buffer files directly, without relying on the protoc compiler, which significantly speeds up execution. It enforces rules that align precisely with the official Protocol Buffer style guide. The tool can automatically fix many violations and allows for disabling specific rules via comments within the .proto files, which is crucial for maintaining API compatibility during gradual adoption. Its pluggable architecture enables the integration of custom linting rules.

Quick Start & Requirements

  • Installation:
    • Homebrew (macOS/Linux): brew tap yoheimuta/protolint && brew install protolint
    • GitHub Releases: Download pre-built binaries from https://github.com/yoheimuta/protolint/releases
    • Docker: docker run --volume "$(pwd):/workspace" --workdir /workspace yoheimuta/protolint lint _example/proto
    • Go: go install github.com/yoheimuta/protolint/cmd/protolint@latest
    • Node.js: npm install protolint --save-dev
    • Python: pip install protolint-bin
  • Prerequisites: Go (for building from source), Node.js (for npm/yarn integration), Python (for pip integration). No specific OS or hardware requirements are mentioned beyond standard system compatibility for the chosen installation method.
  • Configuration: Optional .protolint.yaml file for custom rules and settings.

Highlighted Details

  • Fast execution due to parsing without protoc.
  • Automatic fixing of violations and support for auto_disable comments to maintain compatibility.
  • Pluggable architecture for custom rules and multiple built-in reporters (e.g., junit, json, sarif).
  • Integrates with pre-commit, various editors (VS Code, JetBrains IDEs, Vim), and CI/CD platforms (GitHub Actions, Jenkins).

Maintenance & Community

The project is actively maintained by yoheimuta. Community interaction channels are not explicitly listed in the README, but GitHub is the primary platform for development and issues.

Licensing & Compatibility

  • License: MIT License.
  • Compatibility: Permissive MIT license allows for commercial use and integration into closed-source projects.

Limitations & Caveats

Some rules are not fixable or auto-disableable, requiring manual intervention or specific configuration. The README notes that some rules might not support auto_disable if fixes do not break compatibility, implying a need to review rule behavior.

Health Check
Last commit

1 week ago

Responsiveness

1 week

Pull Requests (30d)
5
Issues (30d)
0
Star History
21 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.