Skip to content

Commit

Permalink
internal/scan: put -show <option> into single quotes
Browse files Browse the repository at this point in the history
This establishes a convention where we wrap examples and mentions of
flag usage into single quotes to indicate proper usage. For instance,
this indicates that the verbose mode is triggered when both `-show`
and `verbose` are used at the same time one after another. The same goes
for other flags, such as scan.

Change-Id: I45cdc6499f9203d0ef73246cb8985c7b420cfacd
Reviewed-on: https://go-review.googlesource.com/c/vuln/+/560815
Reviewed-by: Maceo Thompson <maceothompson@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
  • Loading branch information
zpavlinovic committed Feb 5, 2024
1 parent c02416c commit f50d9a6
Show file tree
Hide file tree
Showing 29 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion cmd/govulncheck/testdata/strip/strip.ct
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Vulnerability #2: GO-2020-0015
Your code is affected by 2 vulnerabilities from 1 module.
This scan found no other vulnerabilities in packages you import or modules you
require.
Use -show verbose for more details.
Use '-show verbose' for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ Your code is affected by 3 vulnerabilities from 2 modules.
This scan also found 0 vulnerabilities in packages you import and 1
vulnerability in modules you require, but your code doesn't appear to call these
vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ Vulnerability #4: GO-2020-0015

Your code may be affected by 4 vulnerabilities.

Use -scan=symbol for more fine grained vulnerability detection.
Use '-scan symbol' for more fine grained vulnerability detection.
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ Vulnerability #3: GO-2021-0054

Your code may be affected by 3 vulnerabilities.
This scan also found 1 vulnerability in modules you require.
Use -scan=symbol for more fine grained vulnerability detection and -show verbose
for more details.
Use '-scan symbol' for more fine grained vulnerability detection and '-show
verbose' for more details.
2 changes: 1 addition & 1 deletion cmd/govulncheck/testdata/testfiles/convert/convert_text.ct
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ Your code is affected by 2 vulnerabilities from 2 modules.
This scan also found 1 vulnerability in packages you import and 0
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Your code is affected by 3 vulnerabilities from 2 modules.
This scan also found 0 vulnerabilities in packages you import and 1
vulnerability in modules you require, but your code doesn't appear to call these
vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.

# Test extract mode. Due to the size of the blob even for smallest programs, we
# directly compare its output to a target vuln_blob.json file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Your code is affected by 3 vulnerabilities from 2 modules.
This scan also found 0 vulnerabilities in packages you import and 2
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.

#####
# Test of basic govulncheck in source mode with expanded traces
Expand Down Expand Up @@ -98,7 +98,7 @@ Your code is affected by 3 vulnerabilities from 2 modules.
This scan also found 0 vulnerabilities in packages you import and 2
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.

#####
# Test of basic govulncheck in source mode with the -show verbose flag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Your code is affected by 0 vulnerabilities.
This scan also found 1 vulnerability in packages you import and 1 vulnerability
in modules you require, but your code doesn't appear to call these
vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Your code is affected by 1 vulnerability from 1 module.
This scan also found 0 vulnerabilities in packages you import and 1
vulnerability in modules you require, but your code doesn't appear to call these
vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.

#####
# Test for multple call stacks in source mode with expanded traces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Your code is affected by 1 vulnerability from 1 module.
This scan also found 0 vulnerabilities in packages you import and 2
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Vulnerability #1: GO-2022-0969
Your code is affected by 1 vulnerability from the Go standard library.
This scan found no other vulnerabilities in packages you import or modules you
require.
Use -show verbose for more details.
Use '-show verbose' for more details.

#####
# Test finding stdlib vulnerability in source mode with expanded traces
Expand All @@ -44,4 +44,4 @@ Vulnerability #1: GO-2022-0969
Your code is affected by 1 vulnerability from the Go standard library.
This scan found no other vulnerabilities in packages you import or modules you
require.
Use -show verbose for more details.
Use '-show verbose' for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Your code is affected by 1 vulnerability from 1 module.
This scan also found 0 vulnerabilities in packages you import and 2
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.

#####
# Test govulncheck runs on the subdirectory of a module
Expand All @@ -48,4 +48,4 @@ Your code is affected by 1 vulnerability from 1 module.
This scan also found 0 vulnerabilities in packages you import and 2
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ Your code is affected by 1 vulnerability from 1 module.
This scan also found 0 vulnerabilities in packages you import and 1
vulnerability in modules you require, but your code doesn't appear to call these
vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Vulnerability #2: GO-2021-0113

Your code may be affected by 2 vulnerabilities.

Use -scan=symbol for more fine grained vulnerability detection.
Use '-scan symbol' for more fine grained vulnerability detection.

#####
# -show verbose flag should only show module results with scan level module
Expand Down Expand Up @@ -57,4 +57,4 @@ Vulnerability #2: GO-2021-0113

Your code may be affected by 2 vulnerabilities.

Use -scan=symbol for more fine grained vulnerability detection.
Use '-scan symbol' for more fine grained vulnerability detection.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Vulnerability #1: GO-2021-0113

Your code may be affected by 1 vulnerability.
This scan also found 1 vulnerability in modules you require.
Use -scan=symbol for more fine grained vulnerability detection and -show verbose
for more details.
Use '-scan symbol' for more fine grained vulnerability detection and '-show
verbose' for more details.

#####
# Test for package level scan with the -show verbose flag
Expand Down Expand Up @@ -50,4 +50,4 @@ Vulnerability #1: GO-2022-0969

Your code may be affected by 1 vulnerability.
This scan also found 1 vulnerability in modules you require.
Use -scan=symbol for more fine grained vulnerability detection.
Use '-scan symbol' for more fine grained vulnerability detection.
2 changes: 1 addition & 1 deletion internal/scan/testdata/binary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Vulnerability #2: GO-0000-0001
Your code is affected by 2 vulnerabilities from 1 module and the Go standard library.
This scan found no other vulnerabilities in packages you import or modules you
require.
Use -show verbose for more details.
Use '-show verbose' for more details.
2 changes: 1 addition & 1 deletion internal/scan/testdata/mixed-calls.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Vulnerability #1: GO-0000-0001
Your code is affected by 1 vulnerability from 1 module.
This scan found no other vulnerabilities in packages you import or modules you
require.
Use -show verbose for more details.
Use '-show verbose' for more details.
2 changes: 1 addition & 1 deletion internal/scan/testdata/module-vuln.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Vulnerability #1: GO-0000-0001

Your code may be affected by 1 vulnerability.

Use -scan=symbol for more fine grained vulnerability detection.
Use '-scan symbol' for more fine grained vulnerability detection.
2 changes: 1 addition & 1 deletion internal/scan/testdata/multi-stack-modlevel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Vulnerability #2: GO-0000-0001

Your code may be affected by 2 vulnerabilities.

Use -scan=symbol for more fine grained vulnerability detection.
Use '-scan symbol' for more fine grained vulnerability detection.
2 changes: 1 addition & 1 deletion internal/scan/testdata/multi-stacks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Vulnerability #1: GO-0000-0001
Your code is affected by 1 vulnerability from the Go standard library.
This scan found no other vulnerabilities in packages you import or modules you
require.
Use -show verbose for more details.
Use '-show verbose' for more details.
4 changes: 2 additions & 2 deletions internal/scan/testdata/package-vuln.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Vulnerability #1: GO-0000-0001

Your code may be affected by 1 vulnerability.
This scan also found 0 vulnerabilities in modules you require.
Use -scan=symbol for more fine grained vulnerability detection and -show verbose
for more details.
Use '-scan symbol' for more fine grained vulnerability detection and '-show
verbose' for more details.
2 changes: 1 addition & 1 deletion internal/scan/testdata/platform-all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Your code is affected by 0 vulnerabilities.
This scan also found 1 vulnerability in packages you import and 0
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
2 changes: 1 addition & 1 deletion internal/scan/testdata/platform-one-arch-only.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Your code is affected by 0 vulnerabilities.
This scan also found 1 vulnerability in packages you import and 0
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
2 changes: 1 addition & 1 deletion internal/scan/testdata/platform-one-import.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Your code is affected by 0 vulnerabilities.
This scan also found 1 vulnerability in packages you import and 0
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
2 changes: 1 addition & 1 deletion internal/scan/testdata/platform-two-imports.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Your code is affected by 0 vulnerabilities.
This scan also found 1 vulnerability in packages you import and 0
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
2 changes: 1 addition & 1 deletion internal/scan/testdata/platform-two-os-only.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Your code is affected by 0 vulnerabilities.
This scan also found 1 vulnerability in packages you import and 0
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
2 changes: 1 addition & 1 deletion internal/scan/testdata/source.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Your code is affected by 1 vulnerability from the Go standard library.
This scan also found 0 vulnerabilities in packages you import and 1
vulnerability in modules you require, but your code doesn't appear to call these
vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
2 changes: 1 addition & 1 deletion internal/scan/testdata/source_traces.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Your code is affected by 1 vulnerability from the Go standard library.
This scan also found 0 vulnerabilities in packages you import and 1
vulnerability in modules you require, but your code doesn't appear to call these
vulnerabilities.
Use -show verbose for more details.
Use '-show verbose' for more details.
4 changes: 2 additions & 2 deletions internal/scan/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ const (

noOtherVulnsMessage = `No other vulnerabilities found.`

verboseMessage = `-show verbose for more details`
verboseMessage = `'-show verbose' for more details`

symbolMessage = `-scan=symbol for more fine grained vulnerability detection`
symbolMessage = `'-scan symbol' for more fine grained vulnerability detection`
)

func (h *TextHandler) Show(show []string) {
Expand Down

0 comments on commit f50d9a6

Please sign in to comment.