def lint(self, vartok, linted_entry): msgs = [] idstr = linted_entry.str for s in idstr.msgid_strings: if not s: continue msgid_tokens = vartok.extract_tokens(s) msgid_tokens = [ vartok.extract_variable_name(token) for token in msgid_tokens ] for token in msgid_tokens: if len(token) == 1 and token.isalpha(): msgs.append( LintMessage( WARNING, linted_entry.poentry.linenum, 0, self.num, 'one character variable name "{}"'.format(token), linted_entry.poentry, )) return msgs
def lint(self, vartok, linted_entry): msgs = [] idstr = linted_entry.str for s in idstr.msgid_strings: if not s: continue msgid_tokens = vartok.extract_tokens(s) msgid_tokens = [ vartok.extract_variable_name(token) for token in msgid_tokens ] for token in msgid_tokens: if token in self.hard_to_read: msgs.append( LintMessage( WARNING, linted_entry.poentry.linenum, 0, self.num, 'hard to read variable name "{}"'.format(token), linted_entry.poentry, )) return msgs
def lint(self, vartok, linted_entry): msgs = [] idstr = linted_entry.str for s in idstr.msgid_strings: if not s: continue msgid_tokens = vartok.extract_tokens(s, unique=False) msgid_tokens = [ vartok.extract_variable_name(token) for token in msgid_tokens ] if msgid_tokens.count('') > 1: msgs.append( LintMessage(WARNING, linted_entry.poentry.linenum, 0, self.num, u'multiple variables with no name.', linted_entry.poentry)) return msgs