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(quant): corpus-line option, output improvements #404

Merged
merged 2 commits into from
Nov 20, 2024
Merged

Conversation

M4tteoP
Copy link
Member

@M4tteoP M4tteoP commented Nov 19, 2024

Closes #391

  • fixes corpus-line option not working
  • Adds a json output even if there have not been false positives detected (before empty output):
{"count":1,"falsePositives":0,"falsePositivesPerRule":{},"skipped":0,"totalTimeSeconds":0.088605792}
  • Adds some details about the run even if there have not been false positives detected:

Before:

No false positives detected with the passed corpus

After:

Run 1 payloads (1 skipped) in 86.454458ms
No false positives detected with the passed corpus
  • Adds the skipped counter to make the output clearer on some complex combinations of options.
# In this case I'm running just up to 1 line, and I also ask to run just the 10th line.
# The output tells me that 1 payload have been evaluated and it has been also skipped
▶ go run main.go quantitative --crs-path ~/Repo/coreruleset --corpus-size "10k" -n=10 --lines 1
11:22PM INF ⏳Running quantitative tests with 10 goroutines
Run 1 payloads (1 skipped) in 92.97825ms
No false positives detected with the passed corpus
# When a specific line is required, it is now explicit that all the other payloads have been skipped.
▶ go run main.go quantitative --crs-path ~/Repo/coreruleset --corpus-size "10k" -n=10 --lines 100
11:23PM INF ⏳Running quantitative tests with 10 goroutines
Run 100 payloads (99 skipped) in 99.074584ms
No false positives detected with the passed corpus

@M4tteoP M4tteoP marked this pull request as ready for review November 19, 2024 22:30
Copy link
Member

@fzipi fzipi left a comment

Choose a reason for hiding this comment

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

LGTM!

@M4tteoP M4tteoP merged commit 305be08 into main Nov 20, 2024
4 checks passed
@M4tteoP M4tteoP deleted the fix_line_number branch November 20, 2024 15:55
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.

quantitative: corpus-line option doesn't work
2 participants