aboutsummaryrefslogtreecommitdiff
path: root/clint.py
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-04-13 02:40:41 +0300
committerZyX <kp-pav@yandex.ru>2016-04-13 03:06:34 +0300
commit0cb2c39ec4b5649667619441b2ef3407e0bf9759 (patch)
treea5ce47fa46e9346ad3116d2369872fac19f47e85 /clint.py
parentf47a20a266f89be31e20f727de59708759795345 (diff)
downloadrneovim-0cb2c39ec4b5649667619441b2ef3407e0bf9759.tar.gz
rneovim-0cb2c39ec4b5649667619441b2ef3407e0bf9759.tar.bz2
rneovim-0cb2c39ec4b5649667619441b2ef3407e0bf9759.zip
clint: Add diagnostics for things like `char* foo` or `(char*)`
Asterisk should be preceded by a space except the following cases: 1. `foo[*idx_ptr]` 2. `++*foo` (though I would prefer to write this as `++(*foo)`) 3. `(*foo)->bar`, `if (*p)` 4. `char **foo` 5. `/* comment */` 6. `!*p` Note: `[^ (*/![]` is followed by `+` to make error position easier to find. It is not needed to find location of the problem.
Diffstat (limited to 'clint.py')
-rwxr-xr-xclint.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/clint.py b/clint.py
index fc081dcd14..60e44cdf36 100755
--- a/clint.py
+++ b/clint.py
@@ -2291,6 +2291,11 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
# there's too little whitespace, we get concerned. It's hard to tell,
# though, so we punt on this one for now. TODO.
+ match = Search(r'(?:[^ (*/![])+(?<!\+\+|--)\*', line)
+ if match:
+ error(filename, linenum, 'whitespace/operators', 2,
+ 'Missing space before asterisk in %s' % match.group(0))
+
# You should always have whitespace around binary operators.
#
# Check <= and >= first to avoid false positives with < and >, then