mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
build: remove clint checks and style text covered by uncrustify
This commit is contained in:
parent
ab2aad509d
commit
675522af18
@ -817,47 +817,6 @@ example, `"\uFEFF"`, is the Unicode zero-width no-break space character, which
|
||||
would be invisible if included in the source as straight UTF-8.
|
||||
|
||||
|
||||
Function Calls ~
|
||||
|
||||
On one line if it fits; otherwise, wrap arguments at the parenthesis.
|
||||
|
||||
Function calls have the following format: >c
|
||||
|
||||
bool retval = do_something(argument1, argument2, argument3);
|
||||
|
||||
If the arguments do not all fit on one line, they should be broken up onto
|
||||
multiple lines, with each subsequent line aligned with the first argument. Do
|
||||
not add spaces after the open paren or before the close paren: >c
|
||||
|
||||
bool retval = do_something(averyveryveryverylongargument1,
|
||||
argument2, argument3);
|
||||
|
||||
If the function has many arguments, consider having one per line if this makes
|
||||
the code more readable: >c
|
||||
|
||||
bool retval = do_something(argument1,
|
||||
argument2,
|
||||
argument3,
|
||||
argument4);
|
||||
|
||||
Arguments may optionally all be placed on subsequent lines, with one line per
|
||||
argument: >c
|
||||
|
||||
if (...) {
|
||||
...
|
||||
...
|
||||
if (...) {
|
||||
do_something(
|
||||
argument1, // 4 space indent
|
||||
argument2,
|
||||
argument3,
|
||||
argument4);
|
||||
}
|
||||
|
||||
In particular, this should be done if the function signature is so long that
|
||||
it cannot fit within the maximum line length.
|
||||
|
||||
|
||||
Braced Initializer Lists ~
|
||||
|
||||
Format a braced list exactly like you would format a function call in its
|
||||
@ -959,11 +918,6 @@ Horizontal Whitespace ~
|
||||
|
||||
Use of horizontal whitespace depends on location.
|
||||
|
||||
General ~
|
||||
>c
|
||||
int x[] = { 0 }; // Spaces inside braces for braced-init-list.
|
||||
<
|
||||
|
||||
Variables ~
|
||||
>c
|
||||
int long_variable = 0; // Don't align assignments.
|
||||
@ -980,26 +934,6 @@ Use of horizontal whitespace depends on location.
|
||||
};
|
||||
<
|
||||
|
||||
|
||||
Operators ~
|
||||
>c
|
||||
x = 0; // Assignment operators always have spaces around
|
||||
// them.
|
||||
x = -5; // No spaces separating unary operators and their
|
||||
x++; // arguments.
|
||||
if (x && !y)
|
||||
<
|
||||
|
||||
Vertical Whitespace ~
|
||||
|
||||
Minimize use of vertical whitespace.
|
||||
|
||||
The basic principle is: The more code that fits on one screen, the easier it
|
||||
is to follow and understand the control flow of the program. Of course,
|
||||
readability can suffer from code being too dense as well as too spread out, so
|
||||
use your judgment. But in general, minimize use of vertical whitespace.
|
||||
|
||||
|
||||
==============================================================================
|
||||
Parting Words
|
||||
|
||||
|
53
src/clint.py
53
src/clint.py
@ -749,53 +749,6 @@ BRACES = {
|
||||
}
|
||||
|
||||
|
||||
CLOSING_BRACES = {v: k for k, v in BRACES.items()}
|
||||
|
||||
|
||||
def GetExprBracesPosition(clean_lines, linenum, pos):
|
||||
"""List positions of all kinds of braces
|
||||
|
||||
If input points to ( or { or [ then function proceeds until finding the
|
||||
position which closes it.
|
||||
|
||||
Args:
|
||||
clean_lines: A CleansedLines instance containing the file.
|
||||
linenum: Current line number.
|
||||
pos: A position on the line.
|
||||
|
||||
Yields:
|
||||
A tuple (linenum, pos, brace, depth) that points to each brace.
|
||||
Additionally each new line (linenum, pos, 's', depth) is yielded, for each
|
||||
line end (linenum, pos, 'e', depth) is yielded and at the very end it
|
||||
yields (linenum, pos, None, None).
|
||||
"""
|
||||
depth = 0
|
||||
yielded_line_start = True
|
||||
startpos = pos
|
||||
while linenum < clean_lines.NumLines() - 1:
|
||||
line = clean_lines.elided_with_space_strings[linenum]
|
||||
if not line.startswith('#') or yielded_line_start:
|
||||
# Ignore #ifdefs, but not if it is macros that are checked
|
||||
for i, brace in enumerate(line[startpos:]):
|
||||
pos = i + startpos
|
||||
if brace != ' ' and not yielded_line_start:
|
||||
yield (linenum, pos, 's', depth)
|
||||
yielded_line_start = True
|
||||
if brace in BRACES:
|
||||
depth += 1
|
||||
yield (linenum, pos, brace, depth)
|
||||
elif brace in CLOSING_BRACES:
|
||||
yield (linenum, pos, brace, depth)
|
||||
depth -= 1
|
||||
if depth == 0:
|
||||
yield (linenum, pos, None, None)
|
||||
return
|
||||
yield (linenum, len(line) - 1, 'e', depth)
|
||||
yielded_line_start = False
|
||||
startpos = 0
|
||||
linenum += 1
|
||||
|
||||
|
||||
def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar):
|
||||
"""Find the position just after the matching endchar.
|
||||
|
||||
@ -1665,8 +1618,7 @@ def CheckSpacing(filename, clean_lines, linenum, error):
|
||||
line[commentpos - 1] not in string.whitespace) or
|
||||
(commentpos >= 2 and
|
||||
line[commentpos - 2] not in string.whitespace))):
|
||||
error(filename, linenum, 'whitespace/comments', 2,
|
||||
'At least two spaces is best between code and comments')
|
||||
return
|
||||
# There should always be a space between the // and the comment
|
||||
commentend = commentpos + 2
|
||||
if commentend < len(line) and not line[commentend] == ' ':
|
||||
@ -1777,8 +1729,7 @@ def CheckSpacing(filename, clean_lines, linenum, error):
|
||||
# There shouldn't be space around unary operators
|
||||
match = Search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line)
|
||||
if match:
|
||||
error(filename, linenum, 'whitespace/operators', 4,
|
||||
'Extra space for operator %s' % match.group(1))
|
||||
return
|
||||
|
||||
# For if/for/while/switch, the left and right parens should be
|
||||
# consistent about how many spaces are inside the parens, and
|
||||
|
Loading…
Reference in New Issue
Block a user