Skip to content

Instantly share code, notes, and snippets.

@pansila
Last active August 28, 2018 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pansila/6b2a725917e421cf4b33e0111bcfec27 to your computer and use it in GitHub Desktop.
Save pansila/6b2a725917e421cf4b33e0111bcfec27 to your computer and use it in GitHub Desktop.
Patch of cpplint to detect mixture uses of tabs and spaces for indent
diff --git a/cpplint.py b/cpplint.py
index 95c0c32..b8cabad 100755
--- a/cpplint.py
+++ b/cpplint.py
@@ -4466,6 +4466,9 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
if line.find('\t') != -1:
error(filename, linenum, 'whitespace/tab', 1,
'Tab found; better to use spaces')
+ if Match('^\s* \t', line) or Match('^\s*\t ', line):
+ error(filename, linenum, 'whitespace/indent', 1,
+ 'Indent with mixture of tabs and spaces is not allowed')
# One or three blank spaces at the beginning of the line is weird; it's
# hard to reconcile that with 2-space indents.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment