Replace and rewrite "assert" statements in non-test code
評估
研究方向
從連結的 GitHub 程式碼搜尋開始,尋找 aboutcode-org 儲存庫中非測試程式碼裡的 Python assert 陳述式。對於主要程式碼中的每個 assert,判斷應使用哪個明確的執行階段例外和訊息來取代它,然後執行相關的專案測試。完成的標準是:非測試程式碼中的 assert 已被移除或說明其合理性,且行為仍由測試涵蓋。
由索引模型根據 Issue 內容生成。
描述
See https://www.reddit.com/r/learnpython/comments/zd217y/is_using_assert_considered_good_practice/
assert statements should only be used for debugging purposes. They are removed when not running in debug mode (i.e. when invoking the Python command with the -O or -OO options).
Instead use a raise statement to throw a proper, informative runtime exception, if you need to. That would definitely be best practice when there'd otherwise be no sensible return value for the function.
We are using a few asserts in our main code. See https://github.com/search?q=org%3Aaboutcode-org+NOT+path%3A*test*++"assert"++language%3APython&type=code
- 主要語言
- Batchfile
- 星號
- 310
- 分支
- 255
- 平均合併
- 10 小時 5 分鐘
- 30 天內合併 PR
- 1
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
aboutcode-org/aboutcode 的其他 Issue
-
Cross-reference OpenChain CRA Compliance Checklist可能重新可做 @PaulitePavitra 於 23 天前認領,目前沒有進行中的 PR。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
aboutcode-org/aboutcode#309 · 6 則留言 ·
-
難度 5/5 一週以上 新手友好度 30/100
aboutcode-org/aboutcode#314 · 4 則留言 ·
-
Project: 5C: Continuous Code Compliance Control Center可能重新可做 @nt5504289-oss 於 35 天前認領,目前沒有進行中的 PR。 未關閉
難度 5/5 一週以上 新手友好度 15/100
aboutcode-org/aboutcode#291 · 3 則留言 ·
-
Remove Projects section in README可能已有人在做 @mjherzog 於 247 天前認領。 未關閉documentation
aboutcode-org/aboutcode#277 · 6 則留言 · 已指派 1 人 ·
-
RFC: Create AI policy可能重新可做 @tdruez 於 254 天前認領,目前沒有進行中的 PR。 未關閉policy
aboutcode-org/aboutcode#265 · 10 則留言 · 已指派 1 人 ·
查看 aboutcode-org/aboutcode 的全部 Issue
相似的 Issue
-
[Bug]: Responses API 500s on assistant message with empty content list可能已有人在做 @shadowmodder 今天認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 66/100
vllm-project/vllm#64940 ·
維護者通常 1 天內回覆
-
limits
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 2 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 70/100
redlib-org/redlib#611 ·
維護者通常 1 天內回覆
-
Data Manager offers a one-click purge of the onboard tools registry, labelled "Tool execution data"未關閉data-safety effort:low model:light plan planner:opus-5-5
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆