Increase the usage of augmented assignment statements
- 主要語言
- Python
- 星號
- 93.9k
- 分支
- 7.7k
- 平均合併
- 2 天 13 小時
- 30 天內合併 PR
- 4
描述
:eyes: Some source code analysis tools can help to find opportunities for improving software components.
:thought_balloon: I propose to [increase the usage of augmented assignment statements](https://docs.python.org/3/reference/simple_stmts.html#augmented-assignment-statements "Augmented assignment statements") accordingly.
Would you like to integrate anything from a transformation result which can be generated by a command like the following?
(:point_right: Please check also for questionable change suggestions because of an evolving search pattern.)
```
[Markus_Elfring@fedora lokal]$ perl -p -i.orig -0777 -e 's/^(?\s+)(?\S+)\s*=\s*\k\s*(?[+\-%&|^@]|\*\*?|\/\/?|<<|>>)/$+{indentation}$+{target} $+{operator}=/gm' $(find ~/Projekte/manim/lokal -name '*.py')
```
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
該 issue 建議在 Python 檔案中使用 Perl one-liner 查找並取代類似 'x = x + y' 為 'x += y' 的模式。首先,從 Python 文件中理解增強賦值(augmented assignment)語法。接著,在儲存庫中的一小部分 .py 檔案上測試該 Perl 指令,查看它會做出哪些更改。請仔細檢查 diff,確保沒有非預期的修改,因為模式可能會演進。最後,選擇性地套用這些更改,並透過執行現有測試來驗證程式碼仍然正常運作。
由索引模型根據 Issue 內容生成。
評估
- 領域
- tooling
- Issue 類型
- 重構
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100