diff options
Diffstat (limited to 'WebKitTools/Scripts/webkitpy/style')
-rw-r--r-- | WebKitTools/Scripts/webkitpy/style/checker.py | 8 | ||||
-rw-r--r-- | WebKitTools/Scripts/webkitpy/style/optparser.py | 15 | ||||
-rw-r--r-- | WebKitTools/Scripts/webkitpy/style/optparser_unittest.py | 8 |
3 files changed, 21 insertions, 10 deletions
diff --git a/WebKitTools/Scripts/webkitpy/style/checker.py b/WebKitTools/Scripts/webkitpy/style/checker.py index 11e3e33..fb93eb9 100644 --- a/WebKitTools/Scripts/webkitpy/style/checker.py +++ b/WebKitTools/Scripts/webkitpy/style/checker.py @@ -115,7 +115,13 @@ _PATH_RULES_SPECIFIER = [ # Files in these directories are consumers of the WebKit # API and therefore do not follow the same header including # discipline as WebCore. - (["WebKitTools/WebKitAPITest/", + + ([# TestNetscapePlugIn has no config.h and uses funny names like + # NPP_SetWindow. + "WebKitTools/DumpRenderTree/TestNetscapePlugIn/", + # The API test harnesses have no config.h and use funny macros like + # TEST_CLASS_NAME. + "WebKitTools/WebKitAPITest/", "WebKitTools/TestWebKitAPI/"], ["-build/include", "-readability/naming"]), diff --git a/WebKitTools/Scripts/webkitpy/style/optparser.py b/WebKitTools/Scripts/webkitpy/style/optparser.py index 3ba0fae..f4e9923 100644 --- a/WebKitTools/Scripts/webkitpy/style/optparser.py +++ b/WebKitTools/Scripts/webkitpy/style/optparser.py @@ -145,6 +145,7 @@ class CommandOptionValues(object): def __init__(self, filter_rules=None, git_commit=None, + diff_files=None, is_verbose=False, min_confidence=1, output_format="emacs"): @@ -163,6 +164,7 @@ class CommandOptionValues(object): self.filter_rules = filter_rules self.git_commit = git_commit + self.diff_files = diff_files self.is_verbose = is_verbose self.min_confidence = min_confidence self.output_format = output_format @@ -174,6 +176,8 @@ class CommandOptionValues(object): return False if self.git_commit != other.git_commit: return False + if self.diff_files != other.diff_files: + return False if self.is_verbose != other.is_verbose: return False if self.min_confidence != other.min_confidence: @@ -214,6 +218,8 @@ class ArgumentPrinter(object): flags['filter'] = ",".join(filter_rules) if options.git_commit: flags['git-commit'] = options.git_commit + if options.diff_files: + flags['diff_files'] = options.diff_files flag_string = '' # Alphabetizing lets us unit test this method. @@ -308,6 +314,9 @@ class ArgumentParser(object): parser.add_option("-g", "--git-diff", "--git-commit", metavar="COMMIT", dest="git_commit", help=git_commit_help,) + diff_files_help = "diff the files passed on the command line rather than checking the style of every line" + parser.add_option("--diff-files", action="store_true", dest="diff_files", default=False, help=diff_files_help) + min_confidence_help = ("set the minimum confidence of style errors " "to report. Can be an integer 1-5, with 1 " "displaying all errors. Defaults to %default.") @@ -409,6 +418,7 @@ class ArgumentParser(object): filter_value = options.filter_value git_commit = options.git_commit + diff_files = options.diff_files is_verbose = options.is_verbose min_confidence = options.min_confidence output_format = options.output_format @@ -420,10 +430,6 @@ class ArgumentParser(object): # Validate user-provided values. - if paths and git_commit: - self._parse_error('You cannot provide both paths and a git ' - 'commit at the same time.') - min_confidence = int(min_confidence) if (min_confidence < 1) or (min_confidence > 5): self._parse_error('option --min-confidence: invalid integer: ' @@ -442,6 +448,7 @@ class ArgumentParser(object): options = CommandOptionValues(filter_rules=filter_rules, git_commit=git_commit, + diff_files=diff_files, is_verbose=is_verbose, min_confidence=min_confidence, output_format=output_format) diff --git a/WebKitTools/Scripts/webkitpy/style/optparser_unittest.py b/WebKitTools/Scripts/webkitpy/style/optparser_unittest.py index b7e3eda..a6b64da 100644 --- a/WebKitTools/Scripts/webkitpy/style/optparser_unittest.py +++ b/WebKitTools/Scripts/webkitpy/style/optparser_unittest.py @@ -136,11 +136,6 @@ class ArgumentParserTest(LoggingTestCase): self.assertLog(['ERROR: Invalid filter rule "build": ' 'every rule must start with + or -.\n']) parse(['--filter=+build']) # works - # Pass files and git-commit at the same time. - self.assertRaises(SystemExit, parse, ['--git-commit=committish', - 'file.txt']) - self.assertLog(['ERROR: You cannot provide both paths and ' - 'a git commit at the same time.\n']) def test_parse_default_arguments(self): parse = self._parse @@ -151,6 +146,7 @@ class ArgumentParserTest(LoggingTestCase): self.assertEquals(options.filter_rules, []) self.assertEquals(options.git_commit, None) + self.assertEquals(options.diff_files, False) self.assertEquals(options.is_verbose, False) self.assertEquals(options.min_confidence, 3) self.assertEquals(options.output_format, 'vs7') @@ -171,6 +167,8 @@ class ArgumentParserTest(LoggingTestCase): self.assertEquals(options.git_commit, 'commit') (files, options) = parse(['--verbose']) self.assertEquals(options.is_verbose, True) + (files, options) = parse(['--diff-files', 'file.txt']) + self.assertEquals(options.diff_files, True) # Pass user_rules. (files, options) = parse(['--filter=+build,-whitespace']) |