diff --git a/style-guide.md b/style-guide.md index e8c537b..de9ccf6 100644 --- a/style-guide.md +++ b/style-guide.md @@ -51,6 +51,8 @@ Rego policies. If you enjoy this style guide, make sure to check it out! * [Avoid using the last argument for the return value](#avoid-using-the-last-argument-for-the-return-value) * [Regex](#regex) * [Use raw strings for regex patterns](#use-raw-strings-for-regex-patterns) +* [Packages](#packages) + * [Package name should make file location](#package-name-should-make-file-location) * [Imports](#imports) * [Prefer importing packages over rules and functions](#prefer-importing-packages-over-rules-and-functions) * [Avoid importing `input`](#avoid-importing-input) @@ -966,6 +968,32 @@ You can lint for this recommendation using the [`non-raw-regex-pattern`](https:/ Regal rule. Get started with [Regal, the Rego linter](https://docs.styra.com/regal). ::: +## Packages + +### Package name should make file location + +When naming packages, the package name should reflect the file's location. This +makes the package implementation easier to find when looking up from elsewhere +in a project as well. + +**Avoid** + +```rego +# foo/bar.rego +package bar.foo + +# ... +``` + +**Prefer** + +```rego +# foo/bar.rego +package foo.bar + +# ... +``` + ## Imports ### Prefer importing packages over rules and functions