Skip to content

Commit 7b64a08

Browse files
authored
docs: update some sections with outdated content (#1548)
- Move down the OPA 1.0+ section, as it's not news any more - Update the strict mode section for 1.0+ - Consistent style of headings - Update benchmark numbers since new rule was added Signed-off-by: Anders Eknert <anders@styra.com>
1 parent 9746dc3 commit 7b64a08

2 files changed

Lines changed: 20 additions & 28 deletions

File tree

README.md

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Regal
22

33
[![Build Status](https://github.com/styrainc/regal/workflows/Build/badge.svg?branch=main)](https://github.com/styrainc/regal/actions)
4-
![OPA v1.3.0](https://openpolicyagent.org/badge/v1.3.0)
4+
![OPA v1.4.2](https://openpolicyagent.org/badge/v1.4.2)
55
[![codecov](https://codecov.io/github/StyraInc/regal/graph/badge.svg?token=EQK01YF3X3)](https://codecov.io/github/StyraInc/regal)
66
[![Downloads](https://img.shields.io/github/downloads/styrainc/regal/total.svg)](https://github.com/StyraInc/regal/releases)
77

@@ -22,14 +22,6 @@ development, whether you're an experienced Rego developer or just starting out.
2222
2323
\- [Merriam Webster](https://www.merriam-webster.com/dictionary/regal)
2424

25-
## **New!** Regal and OPA 1.0+
26-
27-
OPA 1.0 was [recently released](https://blog.openpolicyagent.org/announcing-opa-1-0-a-new-standard-for-policy-as-code-a6d8427ee828),
28-
and starting from version v0.30.0, Regal supports working with both OPA 1.0+ policies and Rego from earlier versions
29-
of OPA. While everything should work without additional configuration, we recommend checking out our documentation on
30-
using Regal with [OPA 1.0](https://docs.styra.com/regal/opa-one-dot-zero) and later for the best possible experience
31-
managing projects of any given Rego version, or even a mix of them.
32-
3325
## Goals
3426

3527
- Deliver an outstanding policy development experience by providing the best possible tools for that purpose
@@ -459,7 +451,7 @@ It's also possible to ignore messages on a per-file basis. The available methods
459451
- [Ignoring Files Globally](#ignoring-files-globally) or
460452
[Ignoring a Rule in Some Files](#ignoring-a-rule-in-some-files).
461453

462-
### Ignoring a Rule In Config
454+
### Ignoring a Rule in Config
463455

464456
If you want to ignore a rule, set its level to `ignore` in the configuration file:
465457

@@ -471,7 +463,7 @@ rules:
471463
level: ignore
472464
```
473465

474-
### Ignoring a Category In Config
466+
### Ignoring a Category in Config
475467

476468
If you want to ignore a category of rules, set its default level to `ignore` in the configuration file:
477469

@@ -482,7 +474,7 @@ rules:
482474
level: ignore
483475
```
484476

485-
### Ignoring All Rules In Config
477+
### Ignoring All Rules in Config
486478

487479
If you want to ignore all rules, set the default level to `ignore` in the configuration file:
488480

@@ -757,20 +749,12 @@ are:
757749

758750
## OPA Check and Strict Mode
759751

760-
Linting with Regal assumes syntactically correct Rego. If there are errors parsing any files during linting, the
761-
process is aborted and any parser errors are logged similarly to OPA. OPA itself provides a "linter" of sorts,
762-
via the `opa check` command and its `--strict` flag. This checks the provided Rego files not only for syntax errors,
763-
but also for OPA [strict mode](https://www.openpolicyagent.org/docs/latest/policy-language/#strict-mode) violations.
764-
765-
> **Note** It is recommended to run `opa check --strict` as part of your policy build process, and address any violations
766-
> reported there before running Regal. Why both commands? Couldn't the strict mode checks be integrated in Regal?
767-
> That would certainly be an option. However, most of the strict mode checks will be made default / mandatory as part
768-
> of a future OPA 1.0 release, at which point they'd be made immediately obsolete as part of Regal. There are a few
769-
> strict mode checks that likely will remain optional in OPA, and we may choose to integrate them into Regal in the
770-
> future.
771-
>
772-
> Until then, the recommendation is to run both `opa check --strict` and `regal lint` as part of your policy build
773-
> and test process.
752+
OPA itself provides a "linter" of sorts, via the `opa check` command and its `--strict` flag. This checks the provided
753+
Rego files not only for syntax errors, but also for OPA
754+
[strict mode](https://www.openpolicyagent.org/docs/latest/policy-language/#strict-mode) violations. Most of the strict
755+
mode checks from before OPA 1.0 have now been made default checks in OPA, and only two additional checks are currently
756+
provided by the `--strict` flag. Those are both important checks not covered by Regal though, so our recommendation is
757+
to run `opa check --strict` against your policies before linting with Regal.
774758

775759
## Regal Language Server
776760

@@ -814,6 +798,14 @@ for an extensive overview of all features, and their meaning.
814798

815799
See the [Editor Support](/docs/editor-support.md) page for information about Regal support in different editors.
816800

801+
## Regal and OPA 1.0+
802+
803+
Starting from version v0.30.0, Regal supports working with both
804+
[OPA 1.0+]((https://blog.openpolicyagent.org/announcing-opa-1-0-a-new-standard-for-policy-as-code-a6d8427ee828))
805+
policies and Rego from earlier versions of OPA. While everything should work without additional configuration,
806+
we recommend checking out our documentation on using Regal with [OPA 1.0](https://docs.styra.com/regal/opa-one-dot-zero)
807+
and later for the best possible experience managing projects of any given Rego version, or even a mix of them.
808+
817809
## Resources
818810

819811
### Documentation

pkg/linter/linter_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ import data.unresolved`,
728728
}
729729
}
730730

731-
// 1014243250 ns/op 3038609032 B/op 58135767 allocs/op
731+
// 1035519750 ns/op 3059417808 B/op 58536544 allocs/op
732732
// ...
733733
func BenchmarkRegalLintingItself(b *testing.B) {
734734
conf, err := config.FromPath(filepath.Join("..", "..", ".regal", "config.yaml"))
@@ -758,7 +758,7 @@ func BenchmarkRegalLintingItself(b *testing.B) {
758758
}
759759
}
760760

761-
// 949510938 ns/op 2982001764 B/op 57011741 allocs/op
761+
// 955670792 ns/op 3004937416 B/op 57408554 allocs/op
762762
// ...
763763
func BenchmarkRegalLintingItselfPrepareOnce(b *testing.B) {
764764
conf, err := config.FromPath(filepath.Join("..", "..", ".regal", "config.yaml"))

0 commit comments

Comments
 (0)