Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

CLI: connectivity check prints diagnostics to stdout, breaking piped output

オープン 初心者向け
#548 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
cli

調査の方向性

check_connectivity() とその呼び出し元である @test_connection を collectoss/application/cli/__init__.py で確認し부터始めます。Issue の Python 再現コマンドを実行して、stdout の診断出力と traceback を観察します。成功したチェックでは stdout がクリーンなままであること、失敗したチェックでは診断出力が stderr または logging 経由で報告されること、エラーメッセージで捕捉した例外が使用されることを確認します。プロジェクトの既存のテスト構造がそれを提供している場合は、対象を絞った CLI テストを追加または更新します。

索引モデルが issue の本文から書いたものです。

説明

Description:
check_connectivity() in collectoss/application/cli/__init__.py (used by @test_connection) reports failures with print(), so they go to stdout. It prints for every failed URL even when a later URL succeeds and the command runs normally, and for network/protocol errors it also prints a full traceback. This puts stray lines at the top of a working command's stdout and breaks piping, e.g. JSON output. The "no way to get connection to the database" error also goes to stdout.

Also, the network/protocol error messages print the exception class ({httpx.NetworkError}) instead of the caught exception ({e}).

Question for maintainers: is CLI output a stable API surface, and should diagnostics go to stderr? Found while working on #547 .

How to reproduce:
Run, with the first URL unreachable and the second reachable: uv run python -c “from collectoss.application.cli import check_connectivity as c; c([‘http://10.255.255.1','http://github.com’])” 2>/dev/null

stdout gets Connectivity test Request 0 Network Error: <class 'httpx.NetworkError'> plus a traceback, even though the function returns True. In normal use this happens when any of chaoss.community, github.com or gitlab.com is slow or unreachable.

Expected behavior:
Diagnostics go to stderr (or logging), and only when the check actually fails, so collectoss <command> > out.json gives valid output. Error messages include the caught exception.

Screenshots
N/A

Log files
Full output (~55 lines):

Software versions:

  • CollectOSS: 4027f1212
  • OS: macOS 12.6.7 (21G651)
  • Browser: N/A
主要言語
Python
スター
17
フォーク
27
平均マージ
3日 10時間
マージ済み PR(30日)
10

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

chaoss/CollectOSS のほかの issue

chaoss/CollectOSS の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。