Skip to content

Commit

Permalink
docs: Add package name dir matching
Browse files Browse the repository at this point in the history
Signed-off-by: Charlie Egan <[email protected]>
  • Loading branch information
charlieegan3 committed Aug 27, 2024
1 parent 9d135a9 commit 4c7c854
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4c7c854

Please sign in to comment.