# package-naming

Source: https://apigenie.pl/docs/linter/protobuf/rules/package-naming

This rule checks whether the package name of a Protobuf file consists of `lower_snake_case`
components separated by dots.

## Rule Details

Package names such as `acme.pet_store.v1` map cleanly to directories and to the package and
namespace names of the generated code in every language.

The `package-naming` rule splits the package name at dots and checks that every component is
`lower_snake_case`: it starts with a lower-case letter, and contains only lower-case letters,
digits and single underscores, with no underscore at the end. If a component is not, the rule
reports `Package name '<name>' should be lower_snake_case components separated by dots`,
followed by a suggestion such as `, e.g. 'acme.pet_store.v1'` when converting the components
gives a different name.

To build the suggestion, each component is split into words at underscores and other
separators, at lower-to-upper case changes and before the last capital of an acronym (so that
`HTTPServer` becomes `http_server`), and the words are joined in lower case with underscores.

Files without a package are not checked; see the `package-defined` rule.

## Configuration

This rule has no options.

## Examples

**Good**.

```proto
syntax = "proto3";

package acme.pet_store.v1;

message Pet {
  string name = 1;
}
```

**Bad**. The linter reports `Package name 'Acme.PetStore.v1' should be lower_snake_case
components separated by dots, e.g. 'acme.pet_store.v1'`.

```proto
syntax = "proto3";

package Acme.PetStore.v1;

message Pet {
  string name = 1;
}
```

## When Not to Use It

You may disable this rule if the package names are dictated by an existing API that you cannot
rename.

## Compatibility

This rule is compatible with proto3 files. proto2 and editions files are rejected by the reader
and are not linted.
