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

Fix typos and minor mistakes #196

Merged
merged 1 commit into from
Feb 8, 2022

Conversation

willbeason
Copy link
Member

I ran inspect code to find typos and various unintentional bits of code.
All of these changes are minor and don't result in any behavioral
changes. Generally they show up as I'm editing code, and this makes them
go away.

Signed-off-by: Will Beason willbeason@google.com

@codecov-commenter
Copy link

Codecov Report

Merging #196 (c29a4a8) into master (0f61a46) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #196   +/-   ##
=======================================
  Coverage   46.82%   46.82%           
=======================================
  Files          59       59           
  Lines        2819     2819           
=======================================
  Hits         1320     1320           
  Misses       1255     1255           
  Partials      244      244           
Flag Coverage Δ
unittests 46.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...works/constraint/pkg/client/drivers/local/local.go 64.46% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f61a46...c29a4a8. Read the comment docs.

Copy link
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

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

Thank you! LGTM

Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

once the error is added, LGTM

func (d *Driver) RemoveTemplate(ctx context.Context, templ *templates.ConstraintTemplate) error {
if err := validateTargets(templ); err != nil {
func (d *Driver) RemoveTemplate(templ *templates.ConstraintTemplate) error {
if len(templ.Spec.Targets) != 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

we probably want to return an error here to avoid failing silently if we forget to update this code when multi-target templates become a thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

If we return an error here, it's possible to get into a bad state where a template can't be deleted.

  1. Add valid Template
  2. Update Template to have multiple targets and wait for reconcile error
  3. Delete Template

As-is, this code is probably broken if someone does a similar change. I'd rather investigate and resolve in a dedicated PR than add the test/logic necessary to deal with this case here. Thus, I'd rather not modify the code and possibly introduce a bug (or modify the behavior of an existing one) and feel it safer to leave as-is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also - this will be made moot by compiler sharding since we'll fix this anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Filed #197 in the compiler sharding milestone.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also added TODO.

I ran inspect code to find typos and various unintentional bits of code.
All of these changes are minor and don't result in any behavioral
changes. Generally they show up as I'm editing code, and this makes them
go away.

Signed-off-by: Will Beason <willbeason@google.com>
Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

LGTM

@willbeason willbeason merged commit bcbf44f into open-policy-agent:master Feb 8, 2022
@willbeason willbeason deleted the typos branch February 8, 2022 15:05
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.

None yet

4 participants