Skip to content

Commit

Permalink
Add W304 for untranslated messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb authored and John Vandenberg committed Oct 13, 2021
1 parent 318f781 commit d8e92ae
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion dennis/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,32 @@ def tokenize(text):
return msgs


class EmptyLintRule(LintRule):
num = "W304"
name = "empty"
desc = "Untranslated string"

def lint(self, vartok, linted_entry):
msgs = []

for trstr in linted_entry.strs:
if trstr.msgstr_string:
continue

msgs.append(
LintMessage(
WARNING,
linted_entry.poentry.linenum,
0,
self.num,
"String is untranslated",
linted_entry.poentry,
)
)

return msgs


class InvalidVarsLintRule(LintRule):
num = "E201"
name = "invalidvars"
Expand Down Expand Up @@ -580,7 +606,7 @@ def verify_file(self, filename_or_string):
"""
po = parse_pofile(filename_or_string)
msgs = []
for entry in po.translated_entries():
for entry in po:
msgs.extend(self.lint_poentry(entry))

return msgs

0 comments on commit d8e92ae

Please sign in to comment.