Make maxlen configurable in PanProjectChecks

Blink wants to override the maxlen which is currently configurable in CheckLongLines but not in PanProjectChecks. This exposes the parameter on PanProjectChecks.


Review URL: https://chromiumcodereview.appspot.com/13403004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@192394 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
jamesr@chromium.org 12 years ago
parent 8623da3be3
commit af27f462d4

@ -312,7 +312,7 @@ def CheckChangeHasNoStrayWhitespace(input_api, output_api,
return [] return []
def CheckLongLines(input_api, output_api, maxlen=80, source_file_filter=None): def CheckLongLines(input_api, output_api, maxlen, source_file_filter=None):
"""Checks that there aren't any lines longer than maxlen characters in any of """Checks that there aren't any lines longer than maxlen characters in any of
the text files to be submitted. the text files to be submitted.
""" """
@ -903,7 +903,7 @@ def CheckSingletonInHeaders(input_api, output_api, source_file_filter=None):
def PanProjectChecks(input_api, output_api, def PanProjectChecks(input_api, output_api,
excluded_paths=None, text_files=None, excluded_paths=None, text_files=None,
license_header=None, project_name=None, license_header=None, project_name=None,
owners_check=True): owners_check=True, maxlen=80):
"""Checks that ALL chromium orbit projects should use. """Checks that ALL chromium orbit projects should use.
These are checks to be run on all Chromium orbit project, including: These are checks to be run on all Chromium orbit project, including:
@ -975,7 +975,7 @@ def PanProjectChecks(input_api, output_api,
snapshot("checking long lines") snapshot("checking long lines")
results.extend(input_api.canned_checks.CheckLongLines( results.extend(input_api.canned_checks.CheckLongLines(
input_api, output_api, source_file_filter=sources)) input_api, output_api, maxlen, source_file_filter=sources))
snapshot( "checking tabs") snapshot( "checking tabs")
results.extend(input_api.canned_checks.CheckChangeHasNoTabs( results.extend(input_api.canned_checks.CheckChangeHasNoTabs(
input_api, output_api, source_file_filter=sources)) input_api, output_api, source_file_filter=sources))

@ -1856,18 +1856,18 @@ class CannedChecksUnittest(PresubmitTestsBase):
presubmit.OutputApi.PresubmitPromptWarning) presubmit.OutputApi.PresubmitPromptWarning)
def testCannedCheckJavaLongLines(self): def testCannedCheckJavaLongLines(self):
check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y) check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y, 80)
self.ContentTest(check, 'A ' * 50, 'foo.java', 'A ' * 50 + 'B', 'foo.java', self.ContentTest(check, 'A ' * 50, 'foo.java', 'A ' * 50 + 'B', 'foo.java',
presubmit.OutputApi.PresubmitPromptWarning) presubmit.OutputApi.PresubmitPromptWarning)
def testCannedCheckSpecialJavaLongLines(self): def testCannedCheckSpecialJavaLongLines(self):
check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y) check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y, 80)
self.ContentTest(check, 'import ' + 'A ' * 150, 'foo.java', self.ContentTest(check, 'import ' + 'A ' * 150, 'foo.java',
'importSomething ' + 'A ' * 50, 'foo.java', 'importSomething ' + 'A ' * 50, 'foo.java',
presubmit.OutputApi.PresubmitPromptWarning) presubmit.OutputApi.PresubmitPromptWarning)
def testCannedCheckMakefileLongLines(self): def testCannedCheckMakefileLongLines(self):
check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y) check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y, 80)
self.ContentTest(check, 'A ' * 100, 'foo.mk', 'A ' * 100 + 'B', 'foo.mk', self.ContentTest(check, 'A ' * 100, 'foo.mk', 'A ' * 100 + 'B', 'foo.mk',
presubmit.OutputApi.PresubmitPromptWarning) presubmit.OutputApi.PresubmitPromptWarning)

Loading…
Cancel
Save