mirror of
https://github.com/neovim/neovim.git
synced 2025-09-20 10:18:18 +00:00
clint: detect MAYBE and recommend TriState
Vim uses MAYBE for 3-value boolean with FALSE/TRUE/MAYBE. Use TriState type instead to restrict to 3 values, kFalse/kTrue/kNone.
This commit is contained in:
@@ -3299,6 +3299,13 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
|
|||||||
error(filename, linenum, 'readability/bool', 4,
|
error(filename, linenum, 'readability/bool', 4,
|
||||||
'Use %s instead of %s.' % (token.lower(), token))
|
'Use %s instead of %s.' % (token.lower(), token))
|
||||||
|
|
||||||
|
# Detect MAYBE
|
||||||
|
match = Search(r'\b(MAYBE)\b', line)
|
||||||
|
if match:
|
||||||
|
token = match.group(1)
|
||||||
|
error(filename, linenum, 'readability/bool', 4,
|
||||||
|
'Use kNONE from TriState instead of %s.' % token)
|
||||||
|
|
||||||
# Detect preincrement/predecrement
|
# Detect preincrement/predecrement
|
||||||
match = Match(r'^\s*(?:\+\+|--)', line)
|
match = Match(r'^\s*(?:\+\+|--)', line)
|
||||||
if match:
|
if match:
|
||||||
|
Reference in New Issue
Block a user