aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-06-10 22:13:31 +0300
committerZyX <kp-pav@yandex.ru>2016-06-11 00:08:54 +0300
commit3d64bd2b3a87d22542cac03c1cc6a20a7ee13d1d (patch)
tree44868118a54c354864239c4bf2a9dfed01240216
parenta160590e40342f013b7da45d2ab0e1c6ed636d35 (diff)
downloadrneovim-3d64bd2b3a87d22542cac03c1cc6a20a7ee13d1d.tar.gz
rneovim-3d64bd2b3a87d22542cac03c1cc6a20a7ee13d1d.tar.bz2
rneovim-3d64bd2b3a87d22542cac03c1cc6a20a7ee13d1d.zip
clint: Do not allow aligning line continuation characters
Rejected by https://neovim.io/develop/style-guide.xml#Horizontal_Whitespace. Note: what to do with “empty” lines is not described in the style guide, neither it is checked.
-rwxr-xr-xsrc/clint.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/clint.py b/src/clint.py
index c19ba4b7ae..1bbe3d71de 100755
--- a/src/clint.py
+++ b/src/clint.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+# vim: set fileencoding=utf-8
#
# Copyright (c) 2009 Google Inc. All rights reserved.
#
@@ -217,6 +218,7 @@ _ERROR_CATEGORIES = [
'whitespace/semicolon',
'whitespace/tab',
'whitespace/todo',
+ 'whitespace/line_continuation',
]
# The default state of the category filter. This is overrided by the --filter=
@@ -2499,6 +2501,13 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
error(filename, linenum, 'whitespace/braces', 5,
'Missing space before }')
+ if Search(r'\S {2,}\\$', line):
+ error(filename, linenum, 'whitespace/line_continuation', 5,
+ 'Too many spaces before \\, line continuation character must be '
+ 'preceded by exactly one space. For “blank lines” '
+ 'it is preferred to use the same amount of spaces as preceding '
+ 'indent')
+
def GetPreviousNonBlankLine(clean_lines, linenum):
"""Return the most recent non-blank line and its line number.