# Protobuf linter rules

Source: https://apigenie.pl/docs/linter/protobuf
See also: [Linter rules](https://apigenie.pl/docs/linter.md), [Recommended ruleset](https://apigenie.pl/docs/linter/protobuf/rulesets/recommended.md), [Strict ruleset](https://apigenie.pl/docs/linter/protobuf/rulesets/strict.md), [All ruleset](https://apigenie.pl/docs/linter/protobuf/rulesets/all.md).

The linter reads proto3 files; the reader rejects proto2 and editions files.

## Rulesets

- [Recommended ruleset](/docs/linter/protobuf/rulesets/recommended.md)
- [Strict ruleset](/docs/linter/protobuf/rulesets/strict.md)
- [All ruleset](/docs/linter/protobuf/rulesets/all.md)

## Rules

| Rule | What it checks | Since |
| --- | --- | --- |
| [`directory-same-package`](/docs/linter/protobuf/rules/directory-same-package.md) | This rule checks whether all the `.proto` files of a directory declare the same package. | 0.9.0 |
| [`enum-comment-defined`](/docs/linter/protobuf/rules/enum-comment-defined.md) | This rule checks whether every enum of a Protobuf file has a leading comment. | 0.9.0 |
| [`enum-naming`](/docs/linter/protobuf/rules/enum-naming.md) | This rule checks whether the name of every enum of a Protobuf file is in `PascalCase`. | 0.9.0 |
| [`enum-no-allow-alias`](/docs/linter/protobuf/rules/enum-no-allow-alias.md) | This rule checks whether any enum sets the `allow_alias` option. | 0.9.0 |
| [`enum-value-comment-defined`](/docs/linter/protobuf/rules/enum-value-comment-defined.md) | This rule checks whether every enum value of a Protobuf file has a leading comment. | 0.9.0 |
| [`enum-value-naming`](/docs/linter/protobuf/rules/enum-value-naming.md) | This rule checks whether the name of every enum value of a Protobuf file is in `UPPER_SNAKE_CASE`. | 0.9.0 |
| [`enum-value-prefix`](/docs/linter/protobuf/rules/enum-value-prefix.md) | This rule checks whether the names of the values of every enum start with the name of the enum in `UPPER_SNAKE_CASE`, for example `PET_KIND_DOG` in the enum `PetKind`. | 0.9.0 |
| [`enum-zero-value-suffix`](/docs/linter/protobuf/rules/enum-zero-value-suffix.md) | This rule checks whether the zero value of every enum ends with a suffix, `_UNSPECIFIED` by default. | 0.9.0 |
| [`field-comment-defined`](/docs/linter/protobuf/rules/field-comment-defined.md) | This rule checks whether every field of a Protobuf file has a leading comment. | 0.9.0 |
| [`field-naming`](/docs/linter/protobuf/rules/field-naming.md) | This rule checks whether the name of every field of a Protobuf file is in `lower_snake_case`. | 0.9.0 |
| [`file-naming`](/docs/linter/protobuf/rules/file-naming.md) | This rule checks whether the name of every Protobuf file is in `lower_snake_case`, with the `.proto` extension. | 0.9.0 |
| [`import-no-cycle`](/docs/linter/protobuf/rules/import-no-cycle.md) | This rule checks whether Protobuf files import each other in a cycle. | 0.9.0 |
| [`import-no-public`](/docs/linter/protobuf/rules/import-no-public.md) | This rule checks whether a Protobuf file uses `import public`. | 0.9.0 |
| [`import-no-weak`](/docs/linter/protobuf/rules/import-no-weak.md) | This rule checks whether a Protobuf file uses `import weak`. | 0.9.0 |
| [`import-resolved`](/docs/linter/protobuf/rules/import-resolved.md) | This rule checks whether every file imported by a Protobuf file can be found. | 0.9.0 |
| [`import-used`](/docs/linter/protobuf/rules/import-used.md) | This rule checks whether every file imported by a Protobuf file is actually used. | 0.9.0 |
| [`imports-sorted`](/docs/linter/protobuf/rules/imports-sorted.md) | This rule checks whether the import statements of a Protobuf file are sorted by path. | 0.9.0 |
| [`message-comment-defined`](/docs/linter/protobuf/rules/message-comment-defined.md) | This rule checks whether every message of a Protobuf file has a leading comment. | 0.9.0 |
| [`message-naming`](/docs/linter/protobuf/rules/message-naming.md) | This rule checks whether the name of every message of a Protobuf file is in `PascalCase`. | 0.9.0 |
| [`oneof-comment-defined`](/docs/linter/protobuf/rules/oneof-comment-defined.md) | This rule checks whether every oneof of a Protobuf file has a leading comment. | 0.9.0 |
| [`oneof-naming`](/docs/linter/protobuf/rules/oneof-naming.md) | This rule checks whether the name of every oneof of a Protobuf file is in `lower_snake_case`. | 0.9.0 |
| [`package-defined`](/docs/linter/protobuf/rules/package-defined.md) | This rule checks whether every Protobuf file declares a package. | 0.9.0 |
| [`package-directory-match`](/docs/linter/protobuf/rules/package-directory-match.md) | This rule checks whether every Protobuf file is in the directory that corresponds to its package, for example `acme/pets/v1` for the package `acme.pets.v1`. | 0.9.0 |
| [`package-naming`](/docs/linter/protobuf/rules/package-naming.md) | This rule checks whether the package name of a Protobuf file consists of `lower_snake_case` components separated by dots. | 0.9.0 |
| [`package-no-import-cycle`](/docs/linter/protobuf/rules/package-no-import-cycle.md) | This rule checks whether packages import each other in a cycle. | 0.9.0 |
| [`package-options-consistent`](/docs/linter/protobuf/rules/package-options-consistent.md) | This rule checks whether the files of a package set the same language-specific file options, such as `go_package` and `java_package`. | 0.9.0 |
| [`package-same-directory`](/docs/linter/protobuf/rules/package-same-directory.md) | This rule checks whether all the files of a package are in the same directory. | 0.9.0 |
| [`package-version-suffix`](/docs/linter/protobuf/rules/package-version-suffix.md) | This rule checks whether the last component of the package name of a Protobuf file is a version, such as `v1` or `v1beta2`. | 0.9.0 |
| [`rpc-comment-defined`](/docs/linter/protobuf/rules/rpc-comment-defined.md) | This rule checks whether every RPC of a Protobuf file has a leading comment. | 0.9.0 |
| [`rpc-naming`](/docs/linter/protobuf/rules/rpc-naming.md) | This rule checks whether the name of every RPC of a Protobuf file is in `PascalCase`. | 0.9.0 |
| [`rpc-no-client-streaming`](/docs/linter/protobuf/rules/rpc-no-client-streaming.md) | This rule checks whether any RPC uses client streaming. | 0.9.0 |
| [`rpc-no-server-streaming`](/docs/linter/protobuf/rules/rpc-no-server-streaming.md) | This rule checks whether any RPC uses server streaming. | 0.9.0 |
| [`rpc-request-response-unique`](/docs/linter/protobuf/rules/rpc-request-response-unique.md) | This rule checks whether every message is used as the request or the response of a single RPC. | 0.9.0 |
| [`rpc-request-standard-name`](/docs/linter/protobuf/rules/rpc-request-standard-name.md) | This rule checks whether the request type of every RPC is named after the RPC, for example `GetPetRequest` for the RPC `GetPet`. | 0.9.0 |
| [`rpc-response-standard-name`](/docs/linter/protobuf/rules/rpc-response-standard-name.md) | This rule checks whether the response type of every RPC is named after the RPC, for example `GetPetResponse` for the RPC `GetPet`. | 0.9.0 |
| [`service-comment-defined`](/docs/linter/protobuf/rules/service-comment-defined.md) | This rule checks whether every service of a Protobuf file has a leading comment. | 0.9.0 |
| [`service-naming`](/docs/linter/protobuf/rules/service-naming.md) | This rule checks whether the name of every service of a Protobuf file is in `PascalCase`. | 0.9.0 |
| [`service-suffix`](/docs/linter/protobuf/rules/service-suffix.md) | This rule checks whether the name of every service ends with a suffix, `Service` by default. | 0.9.0 |
| [`spell-check`](/docs/linter/protobuf/rules/spell-check.md) | This rule checks the spelling of the comments of a Protobuf file. | 0.9.0 |
