{"id":13498691,"url":"https://github.com/yoheimuta/protolint","last_synced_at":"2025-05-14T02:07:24.048Z","repository":{"id":38848203,"uuid":"161958912","full_name":"yoheimuta/protolint","owner":"yoheimuta","description":"A pluggable linter and fixer to enforce Protocol Buffer style and conventions. ","archived":false,"fork":false,"pushed_at":"2025-05-09T03:49:52.000Z","size":24010,"stargazers_count":625,"open_issues_count":46,"forks_count":53,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-09T04:28:01.806Z","etag":null,"topics":["cli","fixer","golang","lint","linter","plugin-architecture","proto3","protobuf","protocol-buffers","style-linter"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yoheimuta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-12-16T01:47:50.000Z","updated_at":"2025-05-09T03:47:11.000Z","dependencies_parsed_at":"2023-02-14T13:15:25.375Z","dependency_job_id":"c8c85a28-636e-4269-8cab-c341a913ccf5","html_url":"https://github.com/yoheimuta/protolint","commit_stats":{"total_commits":518,"total_committers":20,"mean_commits":25.9,"dds":0.3204633204633205,"last_synced_commit":"8fa63cd9beddc229f476ee492636caf2a057bcec"},"previous_names":[],"tags_count":109,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoheimuta%2Fprotolint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoheimuta%2Fprotolint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoheimuta%2Fprotolint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoheimuta%2Fprotolint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yoheimuta","download_url":"https://codeload.github.com/yoheimuta/protolint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253722710,"owners_count":21953485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","fixer","golang","lint","linter","plugin-architecture","proto3","protobuf","protocol-buffers","style-linter"],"created_at":"2024-07-31T21:00:41.021Z","updated_at":"2025-05-14T02:07:19.032Z","avatar_url":"https://github.com/yoheimuta.png","language":"Go","funding_links":[],"categories":["Supported Linters","Protocol Buffers","Content Creation","Go","Other"],"sub_categories":["Tools"],"readme":"# protolint\n![Action](https://github.com/yoheimuta/protolint/workflows/Go/badge.svg)\n[![Release](https://img.shields.io/github/v/release/yoheimuta/protolint?include_prereleases)](https://github.com/yoheimuta/protolint/releases)[\n![Go Report Card](https://goreportcard.com/badge/github.com/yoheimuta/protolint)](https://goreportcard.com/report/github.com/yoheimuta/protolint)\n[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/yoheimuta/protolint/blob/master/LICENSE)\n[![Docker](https://img.shields.io/docker/pulls/yoheimuta/protolint)](https://hub.docker.com/r/yoheimuta/protolint)\n\nprotolint is the pluggable linting/fixing utility for Protocol Buffer files (proto2+proto3):\n\n- Runs fast because this works without compiler.\n- Easy to follow the official style guide. The rules and the style guide correspond to each other exactly.\n  - Fixer automatically fixes all the possible official style guide violations.\n- Allows to disable rules with a comment in a Protocol Buffer file.\n  - It is useful for projects which must keep API compatibility while enforce the style guide as much as possible.\n  - Some rules can be automatically disabled by inserting comments to the spotted violations.\n- Loads plugins to contain your custom lint rules.\n- Undergone testing for all rules.\n- Many integration supports.\n  - protoc plugin\n  - Editor integration\n  - GitHub Action\n  - CI Integration\n\n## Demo\n\nFor example, vim-protolint works like the following.\n\n\u003cimg src=\"_doc/demo-v2.gif\" alt=\"demo\" width=\"600\"/\u003e\n\n## Installation\n\n### Via Homebrew\n\nprotolint can be installed for Mac or Linux using Homebrew via the [yoheimuta/protolint](https://github.com/yoheimuta/homebrew-protolint) tap.\n\n```sh\nbrew tap yoheimuta/protolint\nbrew install protolint\n```\n\nSince [homebrew-core](https://github.com/Homebrew/homebrew-core/pkgs/container/core%2Fprotolint) includes `protolint,` you can also install it by just `brew install protolint.` This is the default tap that is installed by default. It's easier, but not maintained by the same author. To keep it updated, I recommend you run `brew tap yoheimuta/protolint` first.\n\n\n### Via GitHub Releases\n\nYou can also download a pre-built binary from this release page:\n\n- https://github.com/yoheimuta/protolint/releases\n\nIn the downloads section of each release, you can find pre-built binaries in .tar.gz packages.\n\n### Use the maintained Docker image\n\nprotolint ships a Docker image [yoheimuta/protolint](https://hub.docker.com/r/yoheimuta/protolint) that allows you to use protolint as part of your Docker workflow.\n\n```\n❯❯❯ docker run --volume \"$(pwd):/workspace\" --workdir /workspace yoheimuta/protolint lint _example/proto\n[_example/proto/invalidFileName.proto:1:1] File name should be lower_snake_case.proto.\n[_example/proto/issue_88/oneof_options.proto:11:5] Found an incorrect indentation style \"    \". \"  \" is correct.\n[_example/proto/issue_88/oneof_options.proto:12:5] Found an incorrect indentation style \"    \". \"  \" is correct.\n```\n\n### From Source\n\nThe binary can be installed from source if Go is available.\nHowever, I recommend using one of the pre-built binaries instead because it doesn't include the version info.\n\n```sh\ngo install github.com/yoheimuta/protolint/cmd/protolint@latest\n```\n\n### Within JavaScript / TypeScript\n\nYou can use `protolint` using your nodejs package manager like `npm` or `yarn`.\n\n```sh\n$ npm install protolint --save-dev\n```\n\nThis will add a reference to a development dependency to your local `package.json`.\n\nDuring install, the [install.mjs](bdist/js/install.mjs) script will be called. It will download the matching `protolint` from github. Just like [@electron/get](https://github.com/electron/get/), you can bypass the download using the following environment variables:\n\n| Environment Variable          | Default value                         | Description                                   |\n|-------------------------------|---------------------------------------|-----------------------------------------------|\n| PROTOLINT_MIRROR_HOST         | https://github.com                    | HTTP/Web server base url hosting the binaries |\n| PROTOLINT_MIRROR_REMOTE_PATH  | yoheimuta/protolint/download/releases | Path to the archives on the remote host       |\n| PROTOLINT_MIRROR_USERNAME     |                                       | HTTP Basic auth user name                     |\n| PROTOLINT_MIRROR_PASSWORD     |                                       | HTTP Basic auth password                      |\n| PROTOLINT_PROXY               |                                       | HTTP(S) Proxy with optional auth data         |\n\nWithin the remote path, the archives from the [releases](https://github.com/yoheimuta/protolint/releases/latest/) page must be\nmirrored.\n\nAfter that, you can use `npx protolint` (with all supplied protolint arguments) within your dev-scripts.\n\n```json\n{\n  ...\n  \"scripts\": {\n    \"protoc\": \"....\",\n    \"preprotoc\": \"npx protolint\"\n  },\n  ...\n}\n```\n\nYou can add a `protolint` node to your `package.json` which may contain the content of `protolint.yml` below the `lint` node, i.e. the root element of the configuration will be `protolint`.\n\nIf you want to get an output that matches the TSC compiler, use reporter `tsc`.\n\n### Within Python projects\n\nYou can use `protolint` as a linter within your python projects, the wheel `protolint-bin` on [pypi](https://pypi.org) contains the pre-compiled binaries for various platforms. Just add the desired version to\nyour `pyproject.toml` or `requirements.txt`.\n\nThe wheels downloaded will contain the compiled go binaries for `protolint` and `protoc-gen-protolint`. Your platform must\nbe compatible with the supported binary platforms.\n\nYou can add the linter configuration to the `tools.protolint` package in `pyproject.toml`.\n\n## Usage\n\n```sh\nprotolint lint example.proto example2.proto # file mode, specify multiple specific files\nprotolint lint .                            # directory mode, search for all .proto files recursively\nprotolint .                                 # same as \"protolint lint .\"\nprotolint lint -config_path=path/to/your_protolint.yaml . # use path/to/your_protolint.yaml\nprotolint lint -config_dir_path=path/to .   # search path/to for .protolint.yaml\nprotolint lint -fix .                       # automatically fix some of the problems reported by some rules\nprotolint lint -fix -auto_disable=next .    # this is preferable when you want to fix problems while maintaining the compatibility. Automatically fix some problems and insert disable comments to the other problems. The available values are next and this.\nprotolint lint -auto_disable=next .         # automatically insert disable comments to the other problems. \nprotolint lint -v .                         # with verbose output to investigate the parsing error\nprotolint lint -no-error-on-unmatched-pattern . # exits with success code even if no file is found (file \u0026 directory mode)\nprotolint lint -reporter junit .            # output results in JUnit XML format\nprotolint lint -output_file=path/to/out.txt # output results to path/to/out.txt\nprotolint lint -plugin ./my_custom_rule1 -plugin ./my_custom_rule2 .   # run custom lint rules.\nprotolint list                              # list all current lint rules being used\nprotolint version                           # print protolint version\n```\n\nprotolint does not require configuration by default, for the majority of projects it should work out of the box.\n\n## Version Control Integration\n\nprotolint is available as a [pre-commit](https://pre-commit.com) hook.  Add this to your `.pre-commit-config.yaml` in your repository to run protolint with Go:\n```yaml\nrepos:\n  - repo: https://github.com/yoheimuta/protolint\n    rev: \u003cversion\u003e # Select a release here like v0.44.0\n    hooks:\n      - id: protolint\n```\nor alternatively use this to run protolint with Docker:\n```yaml\nrepos:\n  - repo: https://github.com/yoheimuta/protolint\n    rev: \u003cversion\u003e # Select a release here like v0.44.0\n    hooks:\n      - id: protolint-docker\n```\n\n## Editor Integration\n\nVisual Studio Code\n\n- [vscode-protolint](https://github.com/plexsystems/vscode-protolint)\n\nJetBrains IntelliJ IDEA, GoLand, WebStorm, PHPStorm, PyCharm...\n\n- [intellij-protolint](https://github.com/yoheimuta/intellij-protolint)\n\nVim([ALE engine](https://github.com/dense-analysis/ale))\n\n- [ale](https://github.com/dense-analysis/ale)'s [built-in support](https://github.com/dense-analysis/ale/blob/master/supported-tools.md)\n\nVim([Syntastic](https://github.com/vim-syntastic/syntastic))\n\n- [vim-protolint](https://github.com/yoheimuta/vim-protolint)\n\n## GitHub Action\n\nA [GitHub Action](https://github.com/features/actions) to run protolint in your workflows\n\n- [github/super-linter](https://github.com/github/super-linter)\n- [plexsystems/protolint-action](https://github.com/plexsystems/protolint-action)\n- [yoheimuta/action-protolint](https://github.com/yoheimuta/action-protolint) - Integrated with [reviewdog](https://github.com/reviewdog/reviewdog)\n\n## CI Integration\n\nJenkins Plugins\n\n- [warnings-ng](https://github.com/jenkinsci/warnings-ng-plugin) and any that use [violatons-lib](https://github.com/tomasbjerre/violations-lib)\n\n### Environment specific output\n\nIt is possible to format your linting according to the formatting of the CI/CD environment. The environment must be set using the output format. Currently, the following output is realized:\n\n| Environment | Command Line Value | Description | Example |\n|-------------|--------------------|-------------|---------|\n| Github Actions | ci-gh | [Github Help](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message) | `::warning file=example.proto,line=10,col=20,title=ENUM_NAMES_UPPER_CAMEL_CASE::EnumField name \\\"SECOND.VALUE\\\" must be CAPITALS_WITH_UNDERSCORES` |\n| Azure DevOps | ci-az | [Azure DevOps Help](https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops\u0026tabs=bash#task-commands) | `##vso[task.logissue type=warning;sourcepath=example.proto;linenumber=10;columnnumber=20;code=ENUM_NAMES_UPPER_CAMEL_CASE;]EnumField name \\\"SECOND.VALUE\\\" must be CAPITALS_WITH_UNDERSCORES` |\n| Gitlab CI/CD | ci-glab | Reverse Engineered from Examples | `WARNING: ENUM_NAMES_UPPER_CAMEL_CASE  example.proto(10,20) : EnumField name \\\"SECOND.VALUE\\\" must be CAPITALS_WITH_UNDERSCORES` |\n\nYou can also use the generic `ci` formatter, which will create a generic problem matcher.\n\nWith the `ci-env` value, you can specify the template from the following environment variables:\n\n| Environment Variable | Priority | Meaning |\n|----------------------|----------|---------|\n| PROTOLINT_CIREPORTER_TEMPLATE_STRING | 1 | String containing a Go-template |\n| PROTOLINT_CIREPORTER_TEMPLATE_FILE | 2 | Path to a file containing a Go-template |\n\nThe resulting line-feed must not be added, as it will be added automatically.\n\nThe following fields are available:\n\n`Severity`\n: The severity as string (either note, warning or error)\n\n`File`\n: Path to the file containing the error\n\n`Line`\n: Line within the `file` containing the error (starting position)\n\n`Column`\n: Column within the `file` containing the error (starting position)\n\n`Rule`\n: The name of the rule that is faulting\n\n`Message`\n: The error message that descibes the error\n\n### Producing an output file and an CI/CD Error stream\n\nYou can create a specific output matching your CI/CD environment and also create an output file, e.g. for your static code analysis tools like github CodeQL or SonarQube.\n\nThis can be done by adding the `--add-reporter` flag.\nPlease note, that the value must be formatted `\u003creporter-name\u003e:\u003coutput-file-path\u003e` (omitting `\u003c` and `\u003e`).\n\n```shell\n$ protolint --reporter ci-gh --add-reporter sarif:/path/to/my/output.sarif.json proto/*.proto\n```\n\n## Use as a protoc plugin\n\nprotolint also maintains a binary [protoc-gen-protolint](cmd/protoc-gen-protolint) that performs the lint functionality as a protoc plugin.\nSee [cmd/protoc-gen-protolint/README.md](https://github.com/yoheimuta/protolint/blob/master/cmd/protoc-gen-protolint/README.md) in detail.\n\nThis is useful in situations where you already have a protoc plugin workflow.\n\n## Call from Go code\n\nYou can also use protolint from Go code.\nSee [Go Documentation](https://pkg.go.dev/github.com/yoheimuta/protolint/lib) and [lib/lint_test.go](https://github.com/yoheimuta/protolint/blob/master/lib/lint_test.go) in detail.\n\n```go\nargs := []string{\"-config_path\", \"path/to/your_protolint.yaml\", \".\"}\nvar stdout bytes.Buffer\nvar stderr bytes.Buffer\n\nerr := lib.Lint(test.inputArgs, \u0026stdout, \u0026stderr)\n```\n\n## Rules\n\nSee `internal/addon/rules` in detail.\n\nThe rule set follows:\n\n- [Official Style Guide](https://protobuf.dev/programming-guides/style/). This is enabled by default. Basically, these rules can fix the violations by appending `-fix` option.\n- Unofficial Style Guide. This is disabled by default. You can enable each rule with `.protolint.yaml`.\n\nThe `-fix` option on the command line can automatically fix all the problems reported by fixable rules.\nSee Fixable columns below.\n\nThe `-auto_disable` option on the command line can automatically disable all the problems reported by auto-disable rules.\nThis feature is helpful when fixing the existing violations breaks the compatibility.\nSee AutoDisable columns below.\n\n- *1: These rules are not supposed to support AutoDisable because the fixes don't break their compatibilities. You should run the protolint with `-fix`.\n\n| Official | Fixable | AutoDisable | ID                                | Purpose                                                                  |\n|----------|---------|---------|-----------------------------------|--------------------------------------------------------------------------|\n| Yes | ✅ | ✅ | ENUM_FIELD_NAMES_PREFIX | Verifies that enum field names are prefixed with its ENUM_NAME_UPPER_SNAKE_CASE.        |\n| Yes | ✅ | ✅ | ENUM_FIELD_NAMES_UPPER_SNAKE_CASE | Verifies that all enum field names are CAPITALS_WITH_UNDERSCORES.        |\n| Yes | ✅ | ✅ | ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH | Verifies that the zero value enum should have the suffix (e.g. \"UNSPECIFIED\", \"INVALID\"). The default is \"UNSPECIFIED\". You can configure the specific suffix with `.protolint.yaml`. |\n| Yes | ✅ | ✅ | ENUM_NAMES_UPPER_CAMEL_CASE       | Verifies that all enum names are CamelCase (with an initial capital).    |\n| Yes | ✅ | *1 | FILE_NAMES_LOWER_SNAKE_CASE       | Verifies that all file names are lower_snake_case.proto. You can configure the excluded files with `.protolint.yaml`. |\n| Yes | ✅ | ✅ | FIELD_NAMES_LOWER_SNAKE_CASE      | Verifies that all field names are underscore_separated_names.            |\n| Yes | ✅ | *1 | IMPORTS_SORTED                    | Verifies that all imports are sorted. |\n| Yes | ✅ | ✅ | MESSAGE_NAMES_UPPER_CAMEL_CASE    | Verifies that all message names are CamelCase (with an initial capital). |\n| Yes | ✅ | *1 | ORDER                             | Verifies that all files should be ordered in the specific manner. |\n| Yes | ✅ | *1 | PACKAGE_NAME_LOWER_CASE           | Verifies that the package name should only contain lowercase letters. |\n| Yes | ✅ | ✅ | RPC_NAMES_UPPER_CAMEL_CASE        | Verifies that all rpc names are CamelCase (with an initial capital).     |\n| Yes | ✅ | ✅ | SERVICE_NAMES_UPPER_CAMEL_CASE    | Verifies that all service names are CamelCase (with an initial capital). |\n| Yes | ✅ | ✅ | REPEATED_FIELD_NAMES_PLURALIZED   | Verifies that repeated field names are pluralized names.            |\n| Yes | ✅ | *1 | QUOTE_CONSISTENT   | Verifies that the use of quote for strings is consistent. The default is double quoted. You can configure the specific quote with `.protolint.yaml`.          |\n| Yes | ✅ | *1 | INDENT    | Enforces a consistent indentation style. The default style is 2 spaces. Inserting appropriate new lines is also forced by default. You can configure the detail with `.protolint.yaml`. |\n| Yes | ✅ | *1 | PROTO3_FIELDS_AVOID_REQUIRED      | Verifies that all fields should avoid required for proto3.            |\n| Yes | _  | ✅ | PROTO3_GROUPS_AVOID      | Verifies that all groups should be avoided for proto3.            |\n| Yes | _  | *1 | MAX_LINE_LENGTH    | Enforces a maximum line length. The length of a line is defined as the number of Unicode characters in the line. The default is 80 characters. You can configure the detail with `.protolint.yaml`. |\n| No | _  | - | SERVICE_NAMES_END_WITH    | Enforces a consistent suffix for service names. You can configure the specific suffix with `.protolint.yaml`. |\n| No | _  | - | FIELD_NAMES_EXCLUDE_PREPOSITIONS | Verifies that all field names don't include prepositions (e.g. \"for\", \"during\", \"at\"). You can configure the specific prepositions and excluded keywords with `.protolint.yaml`. |\n| No | _  | - | MESSAGE_NAMES_EXCLUDE_PREPOSITIONS | Verifies that all message names don't include prepositions (e.g. \"With\", \"For\"). You can configure the specific prepositions and excluded keywords with `.protolint.yaml`. |\n| No | _  | - | RPC_NAMES_CASE        | Verifies that all rpc names conform to the specified convention. You need to configure the specific convention with `.protolint.yaml`.     |\n| No | _  | - | MESSAGES_HAVE_COMMENT | Verifies that all messages have a comment. You can configure to enforce Golang Style comments with `.protolint.yaml`. |\n| No | _  | - | SERVICES_HAVE_COMMENT | Verifies that all services have a comment. You can configure to enforce Golang Style comments with `.protolint.yaml`. |\n| No | _  | - | RPCS_HAVE_COMMENT | Verifies that all rps have a comment. You can configure to enforce Golang Style comments with `.protolint.yaml`. |\n| No | _  | - | FIELDS_HAVE_COMMENT | Verifies that all fields have a comment. You can configure to enforce Golang Style comments with `.protolint.yaml`. |\n| No | _  | - | ENUMS_HAVE_COMMENT | Verifies that all enums have a comment. You can configure to enforce Golang Style comments with `.protolint.yaml`. |\n| No | _  | - | ENUM_FIELDS_HAVE_COMMENT | Verifies that all enum fields have a comment. You can configure to enforce Golang Style comments with `.protolint.yaml`. |\n| No | _  | - | FILE_HAS_COMMENT | Verifies that a file starts with a doc comment. |\n| No | _  | - | SYNTAX_CONSISTENT | Verifies that syntax is a specified version. The default is proto3. You can configure the version with `.protolint.yaml`. |\n\nI recommend that you add `all_default: true` in `.protolint.yaml`, because all linters above are automatically enabled so that you can always enjoy maximum benefits whenever protolint is updated.\n\nHere are some examples that show good style enabled by default.\n`-` is a bad style, `+` is a good style:\n\n__ENUM_FIELD_NAMES_PREFIX__\n\n```diff\nenum FooBar {\n-  UNSPECIFIED = 0;\n+  FOO_BAR_UNSPECIFIED = 0;\n}\n```\n\n__ENUM_FIELD_NAMES_UPPER_SNAKE_CASE__\n\n```diff\nenum Foo {\n-  firstValue = 0;\n+  FIRST_VALUE = 0;\n-  second_value = 1;\n+  SECOND_VALUE = 1;\n}\n```\n\n__ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH__\n\n```diff\nenum Foo {\n-  FOO_FIRST = 0;\n+  FOO_UNSPECIFIED = 0;\n}\n```\n\n__ENUM_NAMES_UPPER_CAMEL_CASE__\n\n```diff\n- enum foobar {\n+ enum FooBar {\n  FIRST_VALUE = 0;\n  SECOND_VALUE = 1;\n}\n```\n\n__FIELD_NAMES_LOWER_SNAKE_CASE__\n\n```diff\nmessage SongServerRequest {\n-  required string SongName = 1;\n+  required string song_name = 1;\n}\n```\n\n__IMPORTS_SORTED__\n\n```diff\n- import public \"new.proto\";\n+ import \"myproject/other_protos.proto\";\n- import \"myproject/other_protos.proto\";\n+ import public \"new.proto\";\n\nimport \"google/protobuf/empty.proto\";\nimport \"google/protobuf/timestamp.proto\";\n```\n\n__MESSAGE_NAMES_UPPER_CAMEL_CASE__\n\n```diff\n- message song_server_request {\n+ message SongServerRequest {\n  required string SongName = 1;\n  required string song_name = 1;\n}\n```\n\n__ORDER__\n\n```diff\n- option java_package = \"com.example.foo\";\n- syntax = \"proto3\";\n- package examplePb;\n- message song_server_request { }\n- import \"other.proto\";\n+ syntax = \"proto3\";\n+ package examplePb;\n+ import \"other.proto\";\n+ option java_package = \"com.example.foo\";\n+ message song_server_request { }\n```\n\n__PACKAGE_NAME_LOWER_CASE__\n\n```diff\n- package myPackage\n+ package my.package\n```\n\n__RPC_NAMES_UPPER_CAMEL_CASE__\n\n```diff\nservice FooService {\n-  rpc get_something(FooRequest) returns (FooResponse);\n+  rpc GetSomething(FooRequest) returns (FooResponse);\n}\n```\n\n__RPC_NAMES_UPPER_CAMEL_CASE__\n\n```diff\n- service foo_service {\n+ service FooService {\n  rpc get_something(FooRequest) returns (FooResponse);\n  rpc GetSomething(FooRequest) returns (FooResponse);\n}\n```\n\n__REPEATED_FIELD_NAMES_PLURALIZED__\n\n```diff\n-  repeated string song_name = 1;\n+  repeated string song_names = 1;\n```\n\n__INDENT__\n\n```diff\n enum enumAllowingAlias {\n   UNKNOWN = 0;\n-        option allow_alias = true;\n+  option allow_alias = true;\n   STARTED = 1;\n-     RUNNING = 2 [(custom_option) = \"hello world\"];\n+  RUNNING = 2 [(custom_option) = \"hello world\"];\n- }\n+}\n```\n\n```diff\n-   message TestMessage { string test_field = 1; }\n+ message TestMessage {\n+  string test_field = 1;\n+}\n```\n\n__QUOTE_CONSISTENT__\n\n```diff\n option java_package = \"com.example.foo\";\n- option go_package = 'example';\n+ option go_package = \"example\";\n```\n\n## Creating your custom rules\n\nprotolint is the pluggable linter so that you can freely create custom lint rules.\n\nA complete sample project (aka plugin) is included in this repo under the [_example/plugin](_example/plugin) directory.\n\n## Reporters\n\nprotolint comes with several built-in reporters(aka. formatters) to control the appearance of the linting results.\n\nYou can specify a reporter using the -reporter flag on the command line. For example, `-reporter junit` uses the junit reporter.\n\nThe built-in reporter options are:\n\n- plain (default)\n- junit\n- json\n- sarif\n- sonar (SonarQube generic issue format)\n- unix\n- tsc (compatible to TypeScript compiler)\n\n## Configuring\n\n__Disable rules in a Protocol Buffer file__\n\nRules can be disabled with a comment inside a Protocol Buffer file with the following format.\nThe rules will be disabled until the end of the file or until the linter sees a matching enable comment:\n\n```\n// protolint:disable \u003cruleID1\u003e [\u003cruleID2\u003e \u003cruleID3\u003e...]\n...\n// protolint:enable \u003cruleID1\u003e [\u003cruleID2\u003e \u003cruleID3\u003e...]\n```\n\nIt's also possible to modify a disable command by appending :next or :this for only applying the command to this(current) or the next line respectively.\n\nFor example:\n\n```proto\nenum Foo {\n  // protolint:disable:next ENUM_FIELD_NAMES_UPPER_SNAKE_CASE\n  firstValue = 0;    // no error\n  second_value = 1;  // protolint:disable:this ENUM_FIELD_NAMES_UPPER_SNAKE_CASE\n  THIRD_VALUE = 2;   // spits out an error\n}\n```\n\nSetting the command-line option `-auto_disable` to `next` or `this` inserts disable commands whenever spotting problems. \n\nYou can specify `-fix` option together. The rules supporting auto_disable suppress the violations instead of fixing them that cause a schema incompatibility.\n\n__Config file__\n\nprotolint can operate using a config file named `.protolint.yaml`.\n\nRefer to [_example/config/.protolint.yaml](_example/config/.protolint.yaml) for the config file specification.\n\nprotolint will automatically search a current working directory for the config file by default\nand successive parent directories all the way up to the root directory of the filesystem.\nAnd it can search the specified directory with `-config_dir_path` flag.\nIt can also search the specified file with `--config_path` flag.\n\n## Exit codes\n\nWhen linting files, protolint will exit with one of the following exit codes:\n\n- `0`: Linting was successful and there are no linting errors.\n- `1`: Linting was successful and there is at least one linting error.\n- `2`: Linting was unsuccessful due to all other errors, such as parsing, internal, and runtime errors.\n\n## Motivation\n\nThere exists the similar protobuf linters as of 2018/12/20.\n\nOne is a plug-in for Google's Protocol Buffers compiler.\n\n- When you just want to lint the files, it may be tedious to create the compilation environment.\n- And it generally takes a lot of time to compile the files than to parse the files.\n\nOther is a command line tool which also lints Protocol Buffer files.\n\n- While it has a lot of features other than lint, it seems cumbersome for users who just want the linter.\n- The lint rule slants towards to be opinionated.\n- Further more, the rule set and the official style guide don't correspond to each other exactly. It requires to understand both rules and the guide in detail, and then to combine the rules accurately.\n\n### Other tools\n\nI wrote an article comparing various Protocol Buffer Linters, including protolint, on 2019/12/17.\n\n- https://qiita.com/yoheimuta/items/da7678fcd046b93a2637\n  - NOTE: This one is written in Japanese.\n\n## Dependencies\n\n- [go-protoparser](https://github.com/yoheimuta/go-protoparser)\n\n## License\n\nThe MIT License (MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoheimuta%2Fprotolint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoheimuta%2Fprotolint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoheimuta%2Fprotolint/lists"}