def _check_module_name(self) -> None: if logical.is_wrong_name(self.stem, constants.MODULE_NAMES_BLACKLIST): self.add_violation(naming.WrongModuleNameViolation()) if access.is_magic(self.stem): if self.stem not in constants.MAGIC_MODULE_NAMES_WHITELIST: self.add_violation(naming.WrongModuleMagicNameViolation()) if access.is_private(self.stem): self.add_violation(naming.PrivateNameViolation(text=self.stem)) if logical.does_contain_unicode(self.stem): self.add_violation(naming.UnicodeNameViolation(text=self.stem))
def check_name( self, node: ast.AST, name: str, is_first_argument: bool = False, ) -> None: if logical.is_wrong_name(name, VARIABLE_NAMES_BLACKLIST): self._error_callback( naming.WrongVariableNameViolation(node, text=name), ) if not is_first_argument: if logical.is_wrong_name(name, SPECIAL_ARGUMENT_NAMES_WHITELIST): self._error_callback( naming.ReservedArgumentNameViolation(node, text=name), ) if logical.does_contain_unicode(name): self._error_callback(naming.UnicodeNameViolation(node, text=name)) self._ensure_length(node, name) self._ensure_underscores(node, name)