protolint-alignment

command module
v0.0.0-...-ce74e69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2025 License: MIT Imports: 3 Imported by: 0

README

protolint alignment plugin build  Coverage Status

The alignment_rule plugin is a custom rule for Protolint that helps ensure consistent formatting in your Protocol Buffer (.proto) files. It focuses on aligning elements like fields, enums, and messages to improve readability and maintainability.

Why use alignment_rule?

  • Consistent Formatting: Ensures elements in your .proto files are properly aligned, making the code easier to read and understand.
  • Fix Mode Support: Automatically corrects alignment issues, saving you time on manual adjustments.
  • Customizable Severity: Set the rule's strictness level to match your team's coding standards.
  • Seamless Integration: Works as part of Protolint, fitting naturally into your linting workflow.
  • Team Collaboration: Helps maintain a uniform style across your .proto files, reducing inconsistencies in team projects.

Examples

before:
syntax     = "proto3";

message outer {
    option (my_option).a = true;
    message inner {
        int64 ival = 1;
    }
    repeated inner inner_message = 2;
    EnumAllowingAlias enum_field = 3;
    map<int32, string> my_map = 4;

    enum enumAllowingAlias {
        option allow_alias = true;
        UNKNOWN = 0;
        STARTED   = 1;
        RUNNING  = 2 [(custom_option) = "hello world"];
    }
}
after:
syntax = "proto3";

message outer {
    option (my_option).a = true;
    message inner {
        int64 ival = 1;
    }
    repeated inner inner_message = 2;
    EnumAllowingAlias enum_field = 3;
    map<int32, string> my_map    = 4;

    enum enumAllowingAlias {
        option allow_alias = true;
        UNKNOWN            = 0;
        STARTED            = 1;
        RUNNING            = 2 [(custom_option) = "hello world"];
    }
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL