Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f5dd12a authored by Anton Hansson's avatar Anton Hansson
Browse files

Add linter for strings attribute names

Only one bad example for now, which is a misspelling that's not
entirely uncommon and can lead to real problems (see linked bug).

Example output:
Line 58: 'my_new': Misspelled <string> attribute.
        Actual: translateable
        Example: translatable

Bug: 119884572
Test: with a misspelled attribute
Change-Id: If61412fe318a34191920781c4834584363080e11
parent abbcfb2d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -145,6 +145,13 @@ def lint(path):
            if "translatable" in child.attrib and child.attrib["translatable"].lower() == "false":
                continue

            misspelled_attributes = [
              ("translateable", "translatable"),
            ]
            for misspelling, expected in misspelled_attributes:
                if misspelling in child.attrib:
                    error(child, "Misspelled <string> attribute.", misspelling, expected)

            limit = re.search("CHAR[ _-]LIMIT=(\d+|NONE|none)", comment.text)
            if limit is None:
                info(child, "Missing CHAR LIMIT to aid translation",