Repository navigation
Batch: 3 fixes, one commit each - #59
Merged
Merged
Conversation
…eft out (#55) cryptoscan pqc on a tree whose one file sits under examples/ printed "Nothing was checked: no files were scanned under t" and nothing about that file or --include-skipped, while cryptoscan scan on the same tree prints "1 file in 1 directory was not scanned (default rules: examples)." and "Scan them with --include-skipped.". The command prints that notice on stderr for --format json and none for text, since the scan text report prints the two lines itself; the pqc text view did not. When the directories the default rules left out hold files, the pqc text view now prints those two lines, the count in yellow as in the scan report, after the readiness block and the withheld-findings note. For a tree with one file each under examples/, fixtures/ and testdata/ it prints "3 files in 3 directories were not scanned (default rules: examples, fixtures, testdata)." and the hint, and writes nothing to stderr. pqc --format json prints the same stdout and stderr as before for that tree and for the one above. A reporter test checks that the view prints the text report's two lines once, for a scan with findings and for one that read no files, and neither line when the skipped directories hold no files. A command test runs pqc on the tree from the report in text and JSON, and with --include-skipped, where the view lists the MD5 call. Both fail on the previous commit. The comment above TestIncludeSkippedOnEveryCommandThatScans now says which pqc format prints which, and the unreleased changelog entry for --include-skipped names the pqc text view. Fixes #55
…and out of --include-skipped (#56) A scan of a repository URL clones the repository into a temporary directory and walks the clone. The clone's .git directory, which git clone creates, was counted like a .git directory inside a scanned folder. With git 2.53.0, a scan of a repository served over HTTP whose only file is src/a.py printed "29 files in 1 directory were not scanned (default rules: .git)." and "Scan them with --include-skipped." in the text report, printed the same on stderr for --format json and --format sarif, carried it as the SARIF note, and wrote "skipped":{"files":29,"directories":1,"rules":[".git"],"paths":[".git"]} in JSON. gate, cbom and pqc printed the same notice. With --include-skipped, scan read 29 files and reported findings in the clone's .git/hooks/prepare-commit-msg.sample and .git/hooks/update.sample. For a URL scan, the scanner now records the path of the clone's .git directory and leaves that directory out of the walk before any default rule is checked, so it is not counted and --include-skipped does not walk it. On the same repository, scan, gate, cbom and pqc print no skipped-directory notice, JSON output has "skipped":{"files":0,"directories":0,"rules":[],"paths":[]}, and with --include-skipped scan reads 1 file and reports findings in src/a.py only. A local scan of a checkout still counts the checkout's .git directory. A scanner test serves a repository holding src/a.py and examples/b.py over smart HTTP on the loopback interface and scans its URL: only examples is counted, --include-skipped scans the two files and the report names no .git path, and a local scan of the checkout lists .git and examples. It fails on the previous commit. The changelog entry for the skipped-directory count and the scan section of docs/commands.md say that the clone's .git directory is neither counted nor scanned. Fixes #56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request lands 3 commits in pkg/scanner, pkg/reporter, internal/cli, docs and the changelog.
Included
Verified on this exact tree
go build -p 4 ./...: exit 0go vet -p 4 ./...: exit 0golangci-lint run --concurrency 4(golangci-lint 2.12.2, no repository config): exit 1, 21 issues (errcheck 15, staticcheck 6); the same command on a detached worktree oforigin/mainat 05a3f86: exit 1, 21 issues (errcheck 15, staticcheck 6), pre-existinggo test -race -p 4 -json ./...: exit 0; 9 packages, 8 pass, 1 with no test files; named tests including subtests: 1168 passed, 0 failed, 0 skippedgit ls-files '*_test.go' | wc -l: 60Not included
None
Closes
Fixes #55
Fixes #56
Fixes #58
How to merge
Rebase and merge, so that each change stays its own commit on
main.