From 310681b8654c6a580575f488f47e1dd7b63d6b5b Mon Sep 17 00:00:00 2001 From: "avakulenko@google.com" Date: Fri, 22 Aug 2014 19:38:55 +0000 Subject: [PATCH] Added support for 'linelength' setting in CPPLINT.cfg It is now possible to override the line length per project by usign 'linelength' setting in CPPLINT.cfg. R=erg@google.com Review URL: https://codereview.appspot.com/132050043 --- cpplint/cpplint.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cpplint/cpplint.py b/cpplint/cpplint.py index e60e940..66b1d9b 100755 --- a/cpplint/cpplint.py +++ b/cpplint/cpplint.py @@ -141,6 +141,7 @@ Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...] set noparent filter=+filter1,-filter2,... exclude_files=regex + linelength=80 "set noparent" option prevents cpplint from traversing directory tree upwards looking for more .cfg files in parent directories. This option @@ -154,6 +155,8 @@ Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...] a file name. If the expression matches, the file is skipped and not run through liner. + "linelength" allows to specify the allowed line length for the project. + CPPLINT.cfg has an effect on files in the same directory and all sub-directories, unless overridden by a nested configuration file. @@ -5915,6 +5918,12 @@ def ProcessConfigOverrides(filename): 'pattern "%s"\n' % (filename, cfg_file, base_name, val)) return False + elif name == 'linelength': + global _line_length + try: + _line_length = int(val) + except ValueError: + sys.stderr.write('Line length must be numeric.') else: sys.stderr.write( 'Invalid configuration option (%s) in file %s\n' %