Plumb style-checker filter up to command options and make land-cowboy use it.
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Oct 2011 21:12:49 +0000 (21:12 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Oct 2011 21:12:49 +0000 (21:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70119

Reviewed by Adam Barth.

* Scripts/webkitpy/style/checker.py: Added ChangeLogChecker categories to the big list.
* Scripts/webkitpy/style/checkers/changelog.py: Declared categories, used in ChangeLogChecker.
* Scripts/webkitpy/tool/commands/download.py: Made LandCowboy use filter.
* Scripts/webkitpy/tool/commands/download_unittest.py: Tweaked the test.
* Scripts/webkitpy/tool/commands/upload_unittest.py: Ditto.
* Scripts/webkitpy/tool/steps/checkstyle.py: Made check_style_filter work.
* Scripts/webkitpy/tool/steps/options.py: Added new option, check-style-filter.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@97504 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/style/checker.py
Tools/Scripts/webkitpy/style/checkers/changelog.py
Tools/Scripts/webkitpy/tool/commands/download.py
Tools/Scripts/webkitpy/tool/commands/download_unittest.py
Tools/Scripts/webkitpy/tool/commands/upload_unittest.py
Tools/Scripts/webkitpy/tool/steps/checkstyle.py
Tools/Scripts/webkitpy/tool/steps/options.py

index 5f610e9..c219fc3 100644 (file)
@@ -1,3 +1,18 @@
+2011-10-14  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Plumb style-checker filter up to command options and make land-cowboy use it.
+        https://bugs.webkit.org/show_bug.cgi?id=70119
+
+        Reviewed by Adam Barth.
+
+        * Scripts/webkitpy/style/checker.py: Added ChangeLogChecker categories to the big list.
+        * Scripts/webkitpy/style/checkers/changelog.py: Declared categories, used in ChangeLogChecker.
+        * Scripts/webkitpy/tool/commands/download.py: Made LandCowboy use filter.
+        * Scripts/webkitpy/tool/commands/download_unittest.py: Tweaked the test.
+        * Scripts/webkitpy/tool/commands/upload_unittest.py: Ditto.
+        * Scripts/webkitpy/tool/steps/checkstyle.py: Made check_style_filter work.
+        * Scripts/webkitpy/tool/steps/options.py: Added new option, check-style-filter.
+
 2011-10-14  Sam Weinig  <sam@webkit.org>
 
         Remove the Leopard slaves.
index 7b8fdd4..442c473 100644 (file)
@@ -311,6 +311,7 @@ def _all_categories():
     # Take the union across all checkers.
     categories = CommonCategories.union(CppChecker.categories)
     categories = categories.union(TestExpectationsChecker.categories)
+    categories = categories.union(ChangeLogChecker.categories)
 
     # FIXME: Consider adding all of the pep8 categories.  Since they
     #        are not too meaningful for documentation purposes, for
index acb4073..d744bc8 100644 (file)
@@ -31,9 +31,10 @@ from webkitpy.common.checkout.changelog import parse_bug_id_from_changelog
 
 
 class ChangeLogChecker(object):
-
     """Processes text lines for checking style."""
 
+    categories = set(['changelog/bugnumber', 'changelog/filechangedescriptionwhitespace'])
+
     def __init__(self, file_path, handle_style_error, should_line_be_checked):
         self.file_path = file_path
         self.handle_style_error = handle_style_error
index 5473daf..2ba4986 100644 (file)
@@ -126,6 +126,9 @@ class LandCowboy(AbstractSequencedCommand):
         steps.CloseBugForLandDiff,
     ]
 
+    def _prepare_state(self, options, args, tool):
+        options.check_style_filter = "-changelog"
+
 
 class AbstractPatchProcessingCommand(AbstractDeclarativeCommand):
     # Subclasses must implement the methods below.  We don't declare them here
index 6226208..43735e4 100644 (file)
@@ -72,6 +72,7 @@ class DownloadCommandsTest(CommandsTest):
         options.build = True
         options.build_style = True
         options.check_style = True
+        options.check_style_filter = None
         options.clean = True
         options.close_bug = True
         options.force_clean = False
index 9ea2f6d..6f1bcf3 100644 (file)
@@ -60,6 +60,7 @@ Bug 50002 has no non-obsolete patches, ignoring.
         options = MockOptions()
         options.cc = None
         options.check_style = True
+        options.check_style_filter = None
         options.comment = None
         options.description = "MOCK description"
         options.request_commit = False
@@ -108,6 +109,7 @@ extra comment
         options = MockOptions()
         options.cc = None
         options.check_style = True
+        options.check_style_filter = None
         options.comment = None
         options.description = "MOCK description"
         options.request_commit = False
index 7c8dd4e..4f6c05c 100644 (file)
@@ -39,6 +39,7 @@ class CheckStyle(AbstractStep):
         return AbstractStep.options() + [
             Options.non_interactive,
             Options.check_style,
+            Options.check_style_filter,
             Options.git_commit,
         ]
 
@@ -54,6 +55,10 @@ class CheckStyle(AbstractStep):
         args.append("--diff-files")
         args.extend(self._changed_files(state))
 
+        if self._options.check_style_filter:
+            args.append("--filter")
+            args.extend(self._options.check_style_filter)
+
         try:
             self._tool.executive.run_and_throw_if_fail(self._tool.port().check_webkit_style_command() + args, cwd=self._tool.scm().checkout_root)
         except ScriptError, e:
index 186c9d3..d4691b7 100644 (file)
@@ -35,6 +35,7 @@ class Options(object):
     cc = make_option("--cc", action="store", type="string", dest="cc", help="Comma-separated list of email addresses to carbon-copy.")
     check_builders = make_option("--ignore-builders", action="store_false", dest="check_builders", default=True, help="DEPRECATED: Will be removed any time after 11/01/11.")
     check_style = make_option("--ignore-style", action="store_false", dest="check_style", default=True, help="Don't check to see if the patch has proper style before uploading.")
+    check_style_filter = make_option("--check-style-filter", action="store", type="string", dest="check_style_filter", default=None, help="Filter style-checker rules (see check-webkit-style --help).")
     clean = make_option("--no-clean", action="store_false", dest="clean", default=True, help="Don't check if the working directory is clean before applying patches")
     close_bug = make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing.")
     comment = make_option("--comment", action="store", type="string", dest="comment", help="Comment to post to bug.")