def visit_KeywordCall(self, node): # noqa if self.inside_if_block and node.keyword and node.keyword.lower( ) in self.else_statements: self.report("else-not-upper-case", node=node, col=keyword_col(node)) self.check_keyword_naming(node.keyword, node)
def visit_If(self, node): # noqa for keyword in node.body: if isinstance(keyword, KeywordCall): if keyword.keyword.lower() in self.else_if: self.report("else-not-upper-case", node=keyword, col=keyword_col(keyword)) self.generic_visit(node)
def check_if_keyword_is_reserved(self, keyword_name, node): # if there is typo in syntax, it is interpreted as keyword reserved = self.reserved_words[ROBOT_VERSION.major] if keyword_name.lower() not in reserved: return False if keyword_name.lower( ) in self.else_statements and self.inside_if_block: return False # handled by else-not-upper-case error_msg = reserved[keyword_name.lower()] col = keyword_col(node) if isinstance( node, KeywordCall) else keyword_col(node.header) self.report( "keyword-name-is-reserved-word", keyword_name=keyword_name, error_msg=error_msg, node=node, col=col, ) return True
def visit_KeywordCall(self, node): # noqa if not node.keyword: return if normalize_robot_name( node.keyword, remove_prefix="builtin.") in self.run_keyword_variants: col = keyword_col(node) self.report("if-can-be-used", run_keyword=node.keyword, node=node, col=col)
def visit_KeywordCall(self, node): # noqa if node.errors or self.loops: return if normalize_robot_name(node.keyword, remove_prefix="builtin.") in self.for_keyword: self.report( "statement-outside-loop", name=f"'{node.keyword}'", statement_type="keyword", node=node, col=keyword_col(node), )