Skip to content

Fail the README badge test on a static badge whose value the linked file holds only inside longer words, or that links back to README.md (#56) - #59

Merged
thebenignhacker merged 1 commit into
mainfrom
integrate/2026-10-17-r15
Oct 18, 2026
Merged

thebenignhacker merged 1 commit into
mainfrom
integrate/2026-10-17-r15

Conversation

@thebenignhacker

Copy link
Copy Markdown
Member

This pull request lands 1 commit in cmd/cryptodeps/docs_badges_test.go.

Included

Verified on this exact tree

  • go build ./...: exit 0
  • go vet ./...: exit 0
  • golangci-lint run ./... with golangci-lint 2.12.2: exit 3, can't load config: unsupported version of the configuration: ""; the same error and exit 3 on origin/main (pre-existing)
  • golangci-lint run --no-config --default=none -E errcheck -E govet -E ineffassign -E staticcheck -E unused ./cmd/cryptodeps/: 3 issues (errcheck: 2, staticcheck: 1), in cmd/cryptodeps/offline_test.go and cmd/cryptodeps/main.go; the same 3 issues on origin/main
  • go test -p 4 -race -count=1 -json ./...: exit 0; packages: 13 ok, 0 failed, 3 with no test files; top-level tests: 528 passed, 0 failed, 1 skipped (TestIntegration_FetchPyPIPackage: pip not available, skipping test); subtests: 1099 passed, 0 failed, 0 skipped
  • Changelog check: this repository has none

Not included

Closes

Fixes #56

How to merge

Rebase and merge, so that each change stays its own commit on main.

…ile holds only inside longer words, or that links back to README.md (#56)

TestDocsReadmeBadgesTakeTheirValuesFromASource passed a shields.io static
badge when the file it linked to contained each word of the badge value as
a substring, ignoring case. With
[![Go Report Card](https://img.shields.io/badge/go%20report-A-brightgreen)](go.mod)
inserted after README.md line 7 the test passed, because go.mod has the
letter a inside words such as cobra and yaml. It also passed with the same
badge linking to README.md, and with
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE),
because LICENSE has mit inside submit, submitted, limited and limitation.

repoFileHolds now looks for each word of the value as a whole word, with no
letter, number or underscore beside it, still ignoring case. Whole words
alone would still pass the badge that links to README.md, which has the
word a on 8 lines, so a link back to the file the badge is drawn in does
not count either. With the three badges above inserted after README.md
line 7, the test fails at README.md:8, 9 and 10, and the Apache 2.0
License badge that links to LICENSE still passes. The same go report: A
badge linking to goreportcard.com, and a B+ grade linking to go.mod, still
fail.

TestHoldsWords covers the whole-word match, including the value B+, which
\b would not match before a newline or at the end of the text.
TestRepoFileHolds runs repoFileHolds on the badges above; against the old
repoFileHolds, its go.mod, README.md, ./README.md#readme and MIT cases
fail.

Fixes #56
@thebenignhacker
thebenignhacker merged commit 224f6ed into main Oct 18, 2026
3 checks passed
@thebenignhacker
thebenignhacker deleted the integrate/2026-10-17-r15 branch October 18, 2026 00:27
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.

README badge test accepts a static badge whose value is a substring of any linked file

1 participant