From 3101fd0969216b4b17754c9cd42b3037b8cf3b11 Mon Sep 17 00:00:00 2001 From: Micke Prag Date: Tue, 19 Jun 2012 12:30:31 +0200 Subject: [PATCH] Add test for checking that tab is used for indentation --- telldus-core/tests/cpplint.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/telldus-core/tests/cpplint.py b/telldus-core/tests/cpplint.py index 19a37be5..5c88df49 100755 --- a/telldus-core/tests/cpplint.py +++ b/telldus-core/tests/cpplint.py @@ -204,14 +204,18 @@ _ERROR_CATEGORIES = [ 'whitespace/parens', 'whitespace/semicolon', 'whitespace/tab', - 'whitespace/todo' + 'whitespace/todo', + 'whitespace/use_tab_for_indentation' ] # The default state of the category filter. This is overrided by the --filter= # flag. By default all errors are on, so only add here categories that should be # off by default (i.e., categories that must be enabled by the --filter= flags). # All entries here should start with a '-' or '+', as in the --filter= flag. -_DEFAULT_FILTERS = ['-build/include_alpha'] +_DEFAULT_FILTERS = [ + '-build/include_alpha', + '-whitespace/use_tab_for_indentation' +] # We used to check for high-bit characters, but after much discussion we # decided those were OK, as long as they were in UTF-8 and didn't represent @@ -2177,6 +2181,10 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, class_state, error(filename, linenum, 'whitespace/tab', 1, 'Tab found; better to use spaces') + if line and line[0] == ' ': + error(filename, linenum, 'whitespace/use_tab_for_indentation', 1, + 'Space found; use tabs for indentation') + # One or three blank spaces at the beginning of the line is weird; it's # hard to reconcile that with 2-space indents. # NOTE: here are the conditions rob pike used for his tests. Mine aren't