(macOS下)Python:variable in function(argument、function) name should be lowercase 处理方式

用pyCharm(PyCharm 2021.2.1 (Community Edition))时,常会出现警告信息:

function name should be lowercase --表示函数名应该是小写字母

argument name should be lowercase --表示参数名应该是小写字母

variable in function should be lowercase --表示变量应该是小写字母

这时强迫症捉急了,这可能与以往的习惯不大一样,全是小写字母,将这样的警告忽略的方法如下:

PyCharm→Preferences->Editor→Inspections→Python→PEP 8 naming convention violation

加上

N802

N803

N806

分别对应上面的三种提示。

 

 

拓展:

code    sample message

N801    class names should use CapWords convention #类名应使用大写字母约定
N802    function name should be lowercase #函数名应该是小写字母
N803    argument name should be lowercase #参数名应该是小写字母
N804    first argument of a classmethod should be named 'cls' #classmethod的第一个参数应命名为“cls”
N805    first argument of a method should be named 'self' #方法的第一个参数应命名为“self”
N806    variable in function should be lowercase #表示变量应该是小写字母
N811    constant imported as non constant  #常量作为非常量导入
N812    lowercase imported as non lowercase #小写作为非小写导入
N813    camelcase imported as lowercase #camelcase以小写形式导入
N814    camelcase imported as constant #camelcase作为常量导入

 

posted on 2021-09-27 17:17  生活是用来折腾的  阅读(904)  评论(0)    收藏  举报