All packages, except for `cmd` and `internal`, have been moved into a new `v1` root package.
Old packages are kept for backwards-compatibility reasons. All contained code is replaced with simple type aliases and proxy functions to `v1` implementations.
Old packages default to the Rego v0 syntax, new `v1` packages default to the Rego v1 syntax.
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Perhaps it looks prettier, but this is only reported in
JSON output, so I don't think we should decide on what
precision to use there.
On coverage < threshold error, we still print using 2
decimals, which is Pretty (tm).
Fixes#6307
Signed-off-by: Anders Eknert <anders@eknert.com>
Printing lines not covered when test coverage threshold isn't met for `opa test --threshold`, and `--verbose` flag is enabled.
Fixes: #2562
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Adds `covered_lines` and `not_covered_lines` to the test coverage report
for each file and the total. This allows custom scripts to parse the
output and calculate its own coverage numbers skipping certain files.
Signed-off-by: FarisR99 <farisrehman@hotmail.co.uk>
Using the newer `topdown.QueryTracer` interface yields a significant
performance improvement for the tracer (up to ~10% for relevant
benchmarks).
Signed-off-by: Patrick East <east.patrick@gmail.com>
Similar treatment as what we do with the `Profiler`, the coverage
tracer will now signal via configuration that it doesn't need local
variable metadata.
This improves the speed of evaluations with only coverage enabled by
a pretty substantial amount, in particular with many/larger variables.
Signed-off-by: Patrick East <east.patrick@gmail.com>
They would previously show up as not-covered in any report. This
changes to simply omit them. They will never be int the resulting
covered or not-covered lists, or count against the % covered.
Fixes: #1972
Signed-off-by: Patrick East <east.patrick@gmail.com>
The helper function to compute coverage doesn't have to be exported
since the coverage is set as a field on the FileReport. Removing the
helper function in the spirit of minimizing the surface area of the
package.
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
Compute the code coverage percentage of each file and the overall one.
Allow the user to specify a coverage threshold when running the `opa test`
command. The program execution will fail when the global file coverage
doesn't respect the required threshold.
`opa test` will exit with error code 2 when the coverage doesn't meet
the specified threshold.
Fixes issue #1029.
Signed-off-by: Flavio Castelli <fcastelli@suse.com>