Skip to content

Commit

Permalink
Updated the way opa-fmt creates its documentation url, changing from …
Browse files Browse the repository at this point in the history
…path.Join to using concat, added small section to development.md on how to generate the table in the readme and regenerated the table with the new changes. (#159)

Signed-off-by: Peter Macdonald <macdonald.peter90@gmail.com>
  • Loading branch information
Parsifal-M committed Jun 12, 2023
1 parent 562d430 commit 00258cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ The following rules are currently available:
| style | [avoid-get-and-list-prefix](https://github.com/StyraInc/regal/blob/main/docs/rules/style/avoid-get-and-list-prefix.md) | Avoid get_ and list_ prefix for rules and functions |
| style | [prefer-snake-case](https://github.com/StyraInc/regal/blob/main/docs/rules/style/prefer-snake-case.md) | Prefer snake_case for names |
| style | [function-arg-return](https://github.com/StyraInc/regal/blob/main/docs/rules/style/function-arg-return.md) | Function argument used for return value |
| style | [opa-fmt](https:/github.com/StyraInc/regal/blob/main/docs/rules/style/opa-fmt.md) | File should be formatted with `opa fmt` |
| style | [opa-fmt](https://github.com/StyraInc/regal/blob/main/docs/rules/style/opa-fmt.md) | File should be formatted with `opa fmt` |
| testing | [file-missing-test-suffix](https://github.com/StyraInc/regal/blob/main/docs/rules/testing/file-missing-test-suffix.md) | Files containing tests should have a _test.rego suffix |
| testing | [identically-named-tests](https://github.com/StyraInc/regal/blob/main/docs/rules/testing/identically-named-tests.md) | Multiple tests with same name |
| testing | [todo-test](https://github.com/StyraInc/regal/blob/main/docs/rules/testing/todo-test.md) | TODO test encountered |
Expand Down
7 changes: 7 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ gci write \
-s blank \
-s dot .
```
## Documentation

The table in the [Rules](../README.md#rules) section of the README is generated with the following command:

```shell
go run main.go table --write-to-readme bundle
```
3 changes: 1 addition & 2 deletions pkg/rules/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"context"
"fmt"
"path"

"github.com/open-policy-agent/opa/format"

Expand Down Expand Up @@ -86,7 +85,7 @@ func (f *OpaFmtRule) Description() string {
}

func (f *OpaFmtRule) Documentation() string {
return path.Join(docs.DocsBaseURL, category, title+".md")
return docs.DocsBaseURL + "/" + category + "/" + title + ".md"
}

func (f *OpaFmtRule) Config() config.Rule {
Expand Down

0 comments on commit 00258cc

Please sign in to comment.