diff options
author | Lembrun <amadeusk7@free.fr> | 2021-02-27 18:07:28 +0100 |
---|---|---|
committer | Lembrun <amadeusk7@free.fr> | 2021-02-27 18:07:28 +0100 |
commit | f767188abfaad6b5d798c93297e0fe2ac0e3486c (patch) | |
tree | dc38f78ee7b8fa6d3506fd28f3d9e531e528e4e3 /scripts/dev/misc_checks.py | |
parent | a013b81896b1e742cece41c0fbe5ae43cabdbb2e (diff) | |
download | qutebrowser-f767188abfaad6b5d798c93297e0fe2ac0e3486c.tar.gz qutebrowser-f767188abfaad6b5d798c93297e0fe2ac0e3486c.zip |
Generic regexp to detect Camel case qtbot methods
Diffstat (limited to 'scripts/dev/misc_checks.py')
-rw-r--r-- | scripts/dev/misc_checks.py | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/scripts/dev/misc_checks.py b/scripts/dev/misc_checks.py index 5a17cac1c..7c74b3e35 100644 --- a/scripts/dev/misc_checks.py +++ b/scripts/dev/misc_checks.py @@ -175,10 +175,15 @@ def check_spelling(args: argparse.Namespace) -> Optional[bool]: "Common misspelling or non-US spelling" ) for w in words ] + + qtbot_methods = {'keyClick', 'keyClicks', 'mousePress', 'keyPress'} + + excluding = '|'.join(qtbot_methods) + patterns += [ ( re.compile(r'(?i)# noqa(?!: )'), - "Don't use a blanket 'noqa', use something like 'noqa: X123' instead.", + "Don't use a blanket 'noqa', use something like 'noqa: X123' instead." ), ( re.compile(r'# type: ignore[^\[]'), @@ -225,43 +230,11 @@ def check_spelling(args: argparse.Namespace) -> Optional[bool]: ( re.compile(r'IOError'), "use OSError", - ), ( - re.compile(r'qtbot.addWidget'), - "Snake-case available", - ), - ( - re.compile(r'qtbot.waitActive'), - "Snake-case available", - ), - ( - re.compile(r'qtbot.waitExposed'), - "Snake-case available", - ), - ( - re.compile(r'qtbot.waitForWindowShown'), - "Snake-case available", - ), - ( - re.compile(r'qtbot.waitSignal'), - "Snake-case available", - ), - ( - re.compile(r'qtbot.waitSignals'), - "Snake-case available", - ), - ( - re.compile(r'qtbot.assertNotEmitted'), - "Snake-case available", - ), - ( - re.compile(r'qtbot.waitUntil'), - "Snake-case available", ), ( - re.compile(r'qtbot.waitCallback'), + re.compile(r'qtbot\.(?!{})[a-z]+[A-Z].*'.format(excluding)), "Snake-case available", ) - ] # Files which should be ignored, e.g. because they come from another |