pycharm一些減少程式碼warning的拼寫檢查設定

赵青青發表於2024-09-08

在pycharm中開啟單個python檔案後,減少warning的數量

Python3不支援此語法。print 語句已替換為 print() 函式

開啟Settings > Editor > Inspections(檢查),在Python中搜尋"Code compatibility inspection"(程式碼與特定的Python版本不相容)。

檢查您在Options上選擇的python版本,只勾除2.7,請取消其它的。

PEP 8: E231 missing whitespace after ','

在python下找到 PEP8 coding style violation(違反編碼風格),在右邊下面的Ignore errors裡可以新增忽略的警告資訊ID,把ID新增進去忽略

image-20240725143023441

每種警告資訊對應的ID表:Introduction — pycodestyle 2.11.1 documentation (pep8.readthedocs.io)

關閉程式碼規範檢查

在python下找到 PEP8 coding style violation(違反編碼風格),取消勾選

缺失 docstring

開啟Settings > Editor > Inspections(檢查),搜尋空docstring,取消勾選

相關文章