Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add template support to evaluation details. #4532

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

blkt
Copy link
Contributor

@blkt blkt commented Sep 18, 2024

Summary

This change extends error type available for use in evaluation engines with support for go templates. This error type supports rendering complex templates along with the usual string rendering. Despite the type itself being the same, a new constructor was added to avoid a bigger refactoring. Ideally, the old constructor should be deprecated and all places returning an ErrEvaluationFailed error should use the new one instead.

Templates are internal to Minder and cannot be customized by the end user. Also, template engine choice was arbitrary and can be changed at any time.

Fixes #4525
Fixes #4526

Change Type

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Unit tests.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@blkt blkt self-assigned this Sep 18, 2024
@blkt blkt force-pushed the enh/improved-vulncheck-evaluation-detail branch 7 times, most recently from 700b242 to 78f408b Compare September 19, 2024 11:25
@blkt blkt marked this pull request as ready for review September 19, 2024 11:25
@coveralls
Copy link

coveralls commented Sep 19, 2024

Coverage Status

coverage: 52.713% (+0.01%) from 52.699%
when pulling ebf8c8a on enh/improved-vulncheck-evaluation-detail
into d869bce on main.

@blkt blkt force-pushed the enh/improved-vulncheck-evaluation-detail branch from 78f408b to ebf8c8a Compare September 19, 2024 12:05
eleftherias
eleftherias previously approved these changes Sep 19, 2024
}

var buf strings.Builder
w := LimitedWriter(&buf, 1<<10)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1<<10 could be extracted to a constant

This change extends error type available for use in evaluation engines
with support for go templates. This error type supports rendering
complex templates along with the usual string rendering. Despite the
type itself being the same, a new constructor was added to avoid a
bigger refactoring. Ideally, the old constructor should be deprecated
and all places returning an `ErrEvaluationFailed` error should use the
new one instead.

Templates are internal to Minder and cannot be customized by the end
user. Also, template engine choice was arbitrary and can be changed at
any time.

Fixes #4525
Fixes #4526
@blkt blkt merged commit 04921fb into main Sep 20, 2024
21 checks passed
@blkt blkt deleted the enh/improved-vulncheck-evaluation-detail branch September 20, 2024 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add template for vulncheck detail messages Add error type supporting templates
3 participants