mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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.
This commit is contained in:
parent
f47a20a266
commit
0cb2c39ec4
5
clint.py
5
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,
|
# there's too little whitespace, we get concerned. It's hard to tell,
|
||||||
# though, so we punt on this one for now. TODO.
|
# 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.
|
# You should always have whitespace around binary operators.
|
||||||
#
|
#
|
||||||
# Check <= and >= first to avoid false positives with < and >, then
|
# Check <= and >= first to avoid false positives with < and >, then
|
||||||
|
Loading…
Reference in New Issue
Block a user