-
Notifications
You must be signed in to change notification settings - Fork 508
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
findings: values should be exported consts owned by the probe #3641
Comments
Could you write a short example for this? |
This came up in the SAST/Maintained checks: scorecard/probes/commitsInLast90Days/impl.go Lines 62 to 64 in 6dd91c0
And then consumer (evaluation code) need to remember "commitsWithinThreshold" scorecard/checks/evaluation/maintained.go Lines 65 to 75 in 6dd91c0
Not to mention all the tests: scorecard/checks/evaluation/maintained_test.go Lines 37 to 39 in 6dd91c0
So if the probe defined the values it can produce (if known) as a const, then it creates a single source of truth for the key value. const (
Probe = "commitsInLast90Days"
// I'm not set on the name
CommitsValue = "commitsWithinThreshold"
) |
All the places in our code that read values in a finding shouldn't need to redefine what the key is.
The text was updated successfully, but these errors were encountered: