示例#1
0
    def _check_name(self, node: ast.AST, name: str) -> None:
        if is_wrong_variable_name(name, BAD_VARIABLE_NAMES):
            self.add_violation(WrongVariableNameViolation(node, text=name))

        min_length = self.options.min_variable_length
        if is_too_short_variable_name(name, min_length=min_length):
            self.add_violation(TooShortVariableNameViolation(node, text=name))

        if is_private_variable(name):
            self.add_violation(PrivateNameViolation(node, text=name))
    def _check_name(self, node: ast.AST, name: str) -> None:
        if variables.is_wrong_variable_name(name, VARIABLE_NAMES_BLACKLIST):
            self.add_violation(WrongVariableNameViolation(node, text=name))

        min_length = self.options.min_variable_length
        if variables.is_too_short_variable_name(name, min_length=min_length):
            self.add_violation(TooShortVariableNameViolation(node, text=name))

        if variables.is_private_variable(name):
            self.add_violation(PrivateNameViolation(node, text=name))

        if variables.is_variable_name_with_underscored_number(name):
            self.add_violation(UnderScoredNumberNameViolation())