From 4a8b0bd9efff17580554df4d46371c62c96a3ed3 Mon Sep 17 00:00:00 2001 From: Sumeru Chatterjee Date: Fri, 24 Jun 2011 00:59:58 -0700 Subject: [PATCH 1/2] Added a check to see if there are any "Copy Headers" phase files --- src/scripts/lint | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) mode change 100755 => 100644 src/scripts/lint diff --git a/src/scripts/lint b/src/scripts/lint old mode 100755 new mode 100644 index 108cade3ff..7719f214cb --- a/src/scripts/lint +++ b/src/scripts/lint @@ -138,8 +138,9 @@ def lint_project(project_path, options): # The "Compile sources" phase files filenames = project.get_built_sources() - # The "Copy headers" phase files - filenames = filenames + project.get_built_headers() + # The "Copy headers" phase files if they exist + if project.get_built_headers(): + filenames = filenames + project.get_built_headers() # Iterate through and lint each of the files that have been modified since we last ran # the linter, unless we're forcelinting, in which case we lint everything. From e122e6a2fb6e70be00596c2b748ef2c1bea776b2 Mon Sep 17 00:00:00 2001 From: Sumeru Chatterjee Date: Fri, 24 Jun 2011 05:31:03 -0400 Subject: [PATCH 2/2] Added an option called maxline to the options parser to sepcify the maximum length of line that would be allowed. --- src/scripts/lint | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/scripts/lint b/src/scripts/lint index 7719f214cb..345cbdbf19 100644 --- a/src/scripts/lint +++ b/src/scripts/lint @@ -44,6 +44,7 @@ from Pbxproj import relpath gcopyrightyears = '2009-2011' gdivider = '///////////////////////////////////////////////////////////////////////////////////////////////////' +maxlinelength = 100 # Program entry. The meat of this script happens in the lint() method below. def main(): @@ -56,9 +57,16 @@ Verify Three20 style guidelines for source code.''' parser.add_option("-d", "--delint", dest="delint", help="Delint the source", action="store_true") + parser.add_option("-l", "--maxline", dest="maxlinelength", + help="Maximum permissible length of a line",type="int", + action="store") (options, args) = parser.parse_args() + global maxlinelength + if options.maxlinelength: + maxlinelength = options.maxlinelength + if len(args) == 0: parser.print_help() @@ -205,6 +213,7 @@ def lint(filename, options): # If isdelinting is True, this method will try to fix as many lint issues as it can and then # write the results out to disk. def lint_basics(filedata, filename, linenofilter, isdelinting = False): + logger = logging.getLogger() lines = string.split(filedata, "\n") @@ -221,7 +230,7 @@ def lint_basics(filedata, filename, linenofilter, isdelinting = False): for line in lines: # Check line lengths. - if len(line) > 100: + if len(line) > maxlinelength: did_lint_cleanly = False nwarnings = nwarnings + 1 @@ -229,7 +238,7 @@ def lint_basics(filedata, filename, linenofilter, isdelinting = False): if isdelinting: logger.error('I don\'t know how to split this line up.') else: - logger.error('Line length > 100') + logger.error('Line length > %d'% maxlinelength) # Check method dividers. if not re.search(r'.h$', filename) and re.search(r'^[-+][ ]*\([\w\s*]+\)', line):