github / github/codeql

False positive py/uninitialized-local-variable

未關閉
#18,390 3 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
false-positive Python
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

**Description of the false positive**

**Code samples or links to source code**

```python
class Foo:
def foo(self, a, b, c=0):
start = 0
visible = not (a == b and c)
end = start if visible else None
return end

```

CodeQL Version: 2.18.3

Alert : Local variable 'visible' may be used before it is initialized.

I suspect that the issue is caused by EssaVariable being unable to locate the assignment statement for the variable visible, but I'm not sure how to modify the ql statement.

貢獻指南

開啟貢獻指南

研究方向

根據提供的 Python 範例,檢查 py/uninitialized-local-variable 查詢及其對 EssaVariable 的處理。確認對於此程式碼,關於 visible 的錯誤警示不再出現,同時預期的未初始化區域變數偵測仍維持完整。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
security
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。