mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Update bindings to include newer APIs (#250)
- c, cpp - csharp - ffi - go - Java - Python - WASM `arc` feature is turned on for all bindings Use pretty string instead of colored string. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
33fe9d5039
commit
d09c445add
@@ -240,7 +240,7 @@ impl Engine {
|
||||
&self.modules
|
||||
}
|
||||
|
||||
/// Evaluate rule(s) at given path.
|
||||
/// Evaluate specified rule(s).
|
||||
///
|
||||
/// [`Engine::eval_rule`] is often faster than [`Engine::eval_query`] and should be preferred if
|
||||
/// OPA style [`QueryResults`] are not needed.
|
||||
@@ -280,10 +280,10 @@ impl Engine {
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn eval_rule(&mut self, path: String) -> Result<Value> {
|
||||
pub fn eval_rule(&mut self, rule: String) -> Result<Value> {
|
||||
self.prepare_for_eval(false)?;
|
||||
self.interpreter.clean_internal_evaluation_state();
|
||||
self.interpreter.eval_rule_in_path(path)
|
||||
self.interpreter.eval_rule_in_path(rule)
|
||||
}
|
||||
|
||||
/// Evaluate a Rego query.
|
||||
|
||||
@@ -402,7 +402,7 @@ pub mod coverage {
|
||||
///
|
||||
/// <img src="https://github.com/microsoft/regorus/blob/main/docs/coverage.png?raw=true">
|
||||
|
||||
pub fn to_colored_string(&self) -> anyhow::Result<String> {
|
||||
pub fn to_string_pretty(&self) -> anyhow::Result<String> {
|
||||
let mut s = String::default();
|
||||
s.push_str("COVERAGE REPORT:\n");
|
||||
for file in self.files.iter() {
|
||||
@@ -411,7 +411,7 @@ pub mod coverage {
|
||||
continue;
|
||||
}
|
||||
|
||||
s.push_str(&format!("{}:", file.path));
|
||||
s.push_str(&format!("{}:\n", file.path));
|
||||
for (line, code) in file.code.split('\n').enumerate() {
|
||||
let line = line as u32 + 1;
|
||||
if file.not_covered.contains(&line) {
|
||||
|
||||
Reference in New Issue
Block a user