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: small QOL changes #32

Merged
merged 4 commits into from
Feb 19, 2024
Merged

fix: small QOL changes #32

merged 4 commits into from
Feb 19, 2024

Conversation

jamestelfer
Copy link
Member

@jamestelfer jamestelfer commented Feb 17, 2024

This PR has 4 small changes:

  1. ensuring that autogold is imported in packages where it's not used, so the -update flag doesn't cause spurious errors.
  2. all agent calls to be disabled in dev via an environment variable ECRSCANRESULTS_DISABLE_AGENT
  3. Restrict the number of results returned by the scan results waiter: these are discarded, so there's a small efficiency gain here.
  4. documentation updates that hopefully clarify a couple of points of confusion.

This has the side effect of defining the update flag to the test package.

Without this, using the -update flag to update golden files in the other packages causes a non-fatal error to be printed.
Makes it easier to test the rest of the plugin locally.
This will make it slightly quicker to receive and
parse (as it's then thrown away).
Clarifies that the plugin will only fail a step if
finding thresholds are specified.

There was some confusion around the placement of
ignore configuration. I've tried to make this more
clear by rewording the README and rewriting much
of the ignore documentation.
@@ -5,6 +5,7 @@ import (
"time"

"github.com/cultureamp/ecrscanresults/findingconfig"
_ "github.com/hexops/autogold/v2"
Copy link
Contributor

@therealvio therealvio Feb 19, 2024

Choose a reason for hiding this comment

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

That's pretty whack (why you have to include this in the first place), I had a quick browse of the repo and I didn't immediately find an issue relating to this. Is there an issue you found where this was the suggestion?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I had to work it out

Copy link
Member Author

Choose a reason for hiding this comment

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

The underlying issue seemed to stem from this change: hexops/autogold#45, but I'm not 100% sure.

The Go test tool doesn't like it when a flag is present but not consumed by code, and writes a long message to that effect. However, since go test generates a main function to run tests, and doesn't load _test files from other packages, if the autogold package isn't referenced by the package itself, the flag isn't consumed.

So when you run go test ./... -update and it iterates over all the packages, some of them write a failure about the unused flag, because they're not using "golden" files.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry for the short reply earlier.

@jamestelfer jamestelfer merged commit 7d8231d into main Feb 19, 2024
6 checks passed
@jamestelfer jamestelfer deleted the minor-fixes branch February 19, 2024 05:34
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.

2 participants