Skip to content

Commit

Permalink
Prevent console outputs "HTTP 404: Not Found" due to /community/profi…
Browse files Browse the repository at this point in the history
…le 🔇

When scanning user/org repositories, do not output "HTTP 404: Not Found" into
console output anymore.

Before:

	go run main.go -user nicokosi

	HTTP 404: Not Found (https://api.github.com/repos/nicokosi/adr-tools/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/assertj/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/blog-1/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/build-your-own-jira-with-rust/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/chocoblast/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/clojure-koans/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/daggerverse/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/discoapi/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/dotfiles/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/exceptional-monkeys-game-clojure-server/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/fpinscala/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/gilded-rose-kata/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/git-extras/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/glowroot/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/gradle/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/HaskellKoans/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/helloworld-rustx/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/hemingway/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/homebrew-core/community/profile)HTTP 404: Not Found (https://api.github.com/repos/nicokosi/hugo-redlounge/community/profile)^Csignal

Now:

	go run main.go -user nicokosi
  • Loading branch information
nicokosi committed Aug 20, 2024
1 parent 555fbea commit 9ab9510
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,12 @@ func scanCommunityScore(config config, repoWithOrg string) string {
err = client.Get(
"repos/"+repoWithOrg+"/community/profile",
&communityProfile)
if err != nil {
fmt.Print(err)
return ""
if err != nil && len(err.Error()) > 0 {
if strings.HasPrefix(err.Error(), "HTTP 404") {
// 🤫
} else {
fmt.Print(err)
}
}
message := ""
if config.verbose {
Expand Down

0 comments on commit 9ab9510

Please sign in to comment.