mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
src/clint.py: flake8 fixes [ci skip] (#10631)
This commit is contained in:
parent
256608a13b
commit
05fa1cb3f4
14
src/clint.py
14
src/clint.py
@ -48,7 +48,6 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
import copy
|
import copy
|
||||||
import fileinput
|
|
||||||
import getopt
|
import getopt
|
||||||
import math # for log
|
import math # for log
|
||||||
import os
|
import os
|
||||||
@ -566,6 +565,7 @@ class _CppLintState(object):
|
|||||||
return
|
return
|
||||||
self.record_errors_file = open(fname, 'w')
|
self.record_errors_file = open(fname, 'w')
|
||||||
|
|
||||||
|
|
||||||
_cpplint_state = _CppLintState()
|
_cpplint_state = _CppLintState()
|
||||||
|
|
||||||
|
|
||||||
@ -2123,7 +2123,7 @@ def CheckExpressionAlignment(filename, clean_lines, linenum, error, startpos=0):
|
|||||||
'Inner expression indentation should be 4')
|
'Inner expression indentation should be 4')
|
||||||
else:
|
else:
|
||||||
if (pos != level_starts[depth][0] + 1
|
if (pos != level_starts[depth][0] + 1
|
||||||
+ (level_starts[depth][2] == '{')):
|
+ (level_starts[depth][2] == '{')):
|
||||||
if depth not in ignore_error_levels:
|
if depth not in ignore_error_levels:
|
||||||
error(filename, linenum, 'whitespace/alignment', 2,
|
error(filename, linenum, 'whitespace/alignment', 2,
|
||||||
('Inner expression should be aligned '
|
('Inner expression should be aligned '
|
||||||
@ -2296,7 +2296,7 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
|
|||||||
line = clean_lines.elided[linenum] # get rid of comments and strings
|
line = clean_lines.elided[linenum] # get rid of comments and strings
|
||||||
|
|
||||||
# Don't try to do spacing checks for operator methods
|
# Don't try to do spacing checks for operator methods
|
||||||
line = re.sub(r'operator(==|!=|<|<<|<=|>=|>>|>)\(', 'operator\(', line)
|
line = re.sub(r'operator(==|!=|<|<<|<=|>=|>>|>)\(', r'operator\(', line)
|
||||||
|
|
||||||
# We allow no-spaces around = within an if: "if ( (a=Foo()) == 0 )".
|
# We allow no-spaces around = within an if: "if ( (a=Foo()) == 0 )".
|
||||||
# Otherwise not. Note we only check for non-spaces on *both* sides;
|
# Otherwise not. Note we only check for non-spaces on *both* sides;
|
||||||
@ -2597,8 +2597,8 @@ def CheckBraces(filename, clean_lines, linenum, error):
|
|||||||
if (not Search(r'[,;:}{(]\s*$', prevline) and
|
if (not Search(r'[,;:}{(]\s*$', prevline) and
|
||||||
not Match(r'\s*#', prevline)):
|
not Match(r'\s*#', prevline)):
|
||||||
error(filename, linenum, 'whitespace/braces', 4,
|
error(filename, linenum, 'whitespace/braces', 4,
|
||||||
'{ should almost always be at the end'
|
'{ should almost always be at the end'
|
||||||
' of the previous line')
|
' of the previous line')
|
||||||
|
|
||||||
# Brace must appear after function signature, but on the *next* line
|
# Brace must appear after function signature, but on the *next* line
|
||||||
if Match(r'^(?:\w+(?: ?\*+)? )+\w+\(', line):
|
if Match(r'^(?:\w+(?: ?\*+)? )+\w+\(', line):
|
||||||
@ -3178,8 +3178,8 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
|
|||||||
if not Search(r'eval/typval\.[ch]$', filename):
|
if not Search(r'eval/typval\.[ch]$', filename):
|
||||||
match = Search(r'(?:\.|->)'
|
match = Search(r'(?:\.|->)'
|
||||||
r'(?:lv_(?:first|last|refcount|len|watch|idx(?:_item)?'
|
r'(?:lv_(?:first|last|refcount|len|watch|idx(?:_item)?'
|
||||||
r'|copylist|lock)'
|
r'|copylist|lock)'
|
||||||
r'|li_(?:next|prev|tv))\b', line)
|
r'|li_(?:next|prev|tv))\b', line)
|
||||||
if match:
|
if match:
|
||||||
error(filename, linenum, 'runtime/deprecated', 4,
|
error(filename, linenum, 'runtime/deprecated', 4,
|
||||||
'Accessing list_T internals directly is prohibited (hint: see commit d46e37cb4c71)')
|
'Accessing list_T internals directly is prohibited (hint: see commit d46e37cb4c71)')
|
||||||
|
Loading…
Reference in New Issue
Block a user