summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-07 12:41:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-07 15:00:23 +0200
commitc356f669e294ca978e9a41e1e8e7ccbb4e9a1a09 (patch)
tree4549254f9835172a170c877b86c134a566a2a5b9 /bin
parentcbe60ec7e1cd4f696182764d8a43a120c775e0d7 (diff)
lint-ui: add exclusions for remaining capitalisation warnings
Change-Id: I572f914fa9a51f992110585ab032fb500f998bc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104055 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/lint-ui.py36
1 files changed, 33 insertions, 3 deletions
diff --git a/bin/lint-ui.py b/bin/lint-ui.py
index 8860547bef58..16feed37e678 100755
--- a/bin/lint-ui.py
+++ b/bin/lint-ui.py
@@ -28,7 +28,7 @@ ALIGNMENT_TOP_PADDING = '6'
MESSAGE_BOX_SPACING = '24'
MESSAGE_BORDER_WIDTH = '12'
-IGNORED_WORDS = ['the', 'of', 'to', 'for', 'a', 'and', 'as', 'from', 'on', 'into', 'by', 'at', 'or', 'do', 'in', 'when']
+IGNORED_WORDS = ['the', 'of', 'to', 'for', 'a', 'and', 'as', 'from', 'on', 'into', 'by', 'at', 'or', 'do', 'in', 'when', 'no']
# Hook the XML parser and add line number attributes
class LineNumberingParser(ET.XMLParser):
@@ -164,14 +164,44 @@ def check_title_labels(root):
first = True
for word in words:
if len(word) and word[0].islower() and (word not in IGNORED_WORDS) and not first:
- lint_assert(False, "The word '" + word + "' should be capitalized", label)
+ context = title.attrib['context']
+ # exclude a couple of whole sentences
+ if sys.argv[1] == "cui/uiconfig/ui/optpathspage.ui" and context == "optpathspage|label1":
+ pass
+ elif sys.argv[1] == "dbaccess/uiconfig/ui/password.ui" and context == "password|label1":
+ pass
+ elif sys.argv[1] == "sc/uiconfig/scalc/ui/datastreams.ui" and context == "datastreams|label4":
+ pass
+ elif sys.argv[1] == "sc/uiconfig/scalc/ui/scgeneralpage.ui" and context == "scgeneralpage|label6":
+ pass
+ elif sys.argv[1] == "sfx2/uiconfig/ui/documentfontspage.ui" and context == "documentfontspage|fontScriptFrameLabel":
+ pass
+ elif sys.argv[1] == "sw/uiconfig/swriter/ui/testmailsettings.ui" and context == "testmailsettings|label8":
+ pass
+ elif sys.argv[1] == "sw/uiconfig/swriter/ui/optcomparison.ui" and context == "optcomparison|setting":
+ pass
+ elif sys.argv[1] == "sw/uiconfig/swriter/ui/optcompatpage.ui" and context == "optcompatpage|label11":
+ pass
+ elif sys.argv[1] == "sw/uiconfig/swriter/ui/optcaptionpage.ui" and context == "optcaptionpage|label1":
+ pass
+ elif sys.argv[1] == "sw/uiconfig/swriter/ui/mmresultemaildialog.ui" and context == "mmresultemaildialog|attachft":
+ pass
+ elif sys.argv[1] == "sw/uiconfig/swriter/ui/mailmerge.ui" and context == "mailmerge|singledocument":
+ pass
+ elif sys.argv[1] == "cui/uiconfig/ui/acorexceptpage.ui" and context == "acorexceptpage|label2":
+ pass
+ elif sys.argv[1] == "dbaccess/uiconfig/ui/dbwizmysqlintropage.ui" and context == "dbwizmysqlintropage|label1":
+ pass
+ else:
+ lint_assert(False, "The word '" + word + "' should be capitalized", label)
first = False
def main():
tree = ET.parse(sys.argv[1], parser=LineNumberingParser())
root = tree.getroot()
- lint_assert('domain' in root.attrib, "interface needs to specific translation domain")
+ if sys.argv[1] != "libreofficekit/qa/gtktiledviewer/gtv.ui":
+ lint_assert('domain' in root.attrib, "interface needs to specify translation domain")
top_level_widgets = [element for element in root.findall('object') if element.attrib['class'] not in IGNORED_TOP_LEVEL_WIDGETS]
lint_assert( len(top_level_widgets) <= 1, "should be only one top-level widget for us to analyze, found " + str(len(top_level_widgets)))