PyCharm fails to apply inspection rule when error is in a private method

PyCharm fails to apply inspection rule when error is in a private method. Specifically when I define a field outside of __init__ in a private method, there is no error generated by PyCharm. Doing the same for a public method has the expected response, an error is indicated. The settings are:

And the issue is shown here: 

What am I doing wrong here? I would like for an error to be shown any time a field is created outside __init__. Here is the code: 

class Class:
def __init__(self):
self.name = None

def _foo(self):
self.bob = 3 # this should generate an error based on the settings

def foo(self):
self.bob = 3 # this generates an error as expected
评论操作 固定链接

@snake io i don't under stands your flow, when i'm development, i never use this flow

 

 

0

请先登录再写评论。