Changeset 160083 in webkit
- Timestamp:
- Dec 4, 2013, 3:08:56 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 8 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkitpy/style/checker.py (modified) (10 diffs)
-
Scripts/webkitpy/style/checker_unittest.py (modified) (7 diffs)
-
Scripts/webkitpy/style/checkers/jsonchecker.py (modified) (1 diff)
-
Scripts/webkitpy/style/error_handlers_unittest.py (modified) (1 diff)
-
Scripts/webkitpy/style/optparser.py (modified) (5 diffs)
-
Scripts/webkitpy/tool/commands/upload_unittest.py (modified) (2 diffs)
-
Scripts/webkitpy/tool/steps/checkstyle.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r160075 r160083 1 2013-12-04 Tamas Gergely <gertom@inf.u-szeged.hu> 2 3 style-bot should reject Committer additions to committers.py 4 https://bugs.webkit.org/show_bug.cgi?id=107574 5 6 Reviewed by Zoltan Herczeg. 7 8 The style check when executed in non-interactive mode (probably by a 9 bot) will raise an additional error if the contributors.json file is 10 modified. Non-interactive mode information is propagated to the 11 Dispatcher, which creates a special JSON checker for the 12 contributors.json file. 13 14 * Scripts/webkitpy/style/checker.py: 15 (check_webkit_style_configuration): 16 (CheckerDispatcher._create_checker): 17 (CheckerDispatcher.dispatch): 18 (StyleProcessorConfiguration.__init__): 19 (StyleProcessor.process): 20 * Scripts/webkitpy/style/checker_unittest.py: 21 (CheckerDispatcherSkipTest._assert_should_skip_without_warning): 22 (CheckerDispatcherDispatchTest.dispatch): 23 (StyleProcessorConfigurationTest._style_checker_configuration): 24 (StyleProcessor_EndToEndTest.test_init): 25 (StyleProcessor_EndToEndTest.test_process): 26 (StyleProcessor_CodeCoverageTest.MockDispatcher.dispatch): 27 (StyleProcessor_CodeCoverageTest.setUp): 28 * Scripts/webkitpy/style/checkers/jsonchecker.py: 29 (JSONChecker.line_number_from_json_exception): 30 (JSONContributorsChecker): 31 (JSONContributorsChecker.check): 32 * Scripts/webkitpy/style/error_handlers_unittest.py: 33 (DefaultStyleErrorHandlerTest._style_checker_configuration): 34 * Scripts/webkitpy/style/optparser.py: 35 (CommandOptionValues.__init__): 36 (ArgumentParser._create_option_parser): 37 (ArgumentParser.parse): 38 * Scripts/webkitpy/tool/commands/upload_unittest.py: 39 (test_post): 40 (test_upload): 41 * Scripts/webkitpy/tool/steps/checkstyle.py: 42 (CheckStyle.run): 43 1 44 2013-12-04 Nick Diego Yamane <nick.yamane@openbossa.org> 2 45 -
trunk/Tools/Scripts/webkitpy/style/checker.py
r159977 r160083 44 44 from checkers.js import JSChecker 45 45 from checkers.jsonchecker import JSONChecker 46 from checkers.jsonchecker import JSONContributorsChecker 46 47 from checkers.png import PNGChecker 47 48 from checkers.python import PythonChecker … … 399 400 max_reports_per_category=_MAX_REPORTS_PER_CATEGORY, 400 401 min_confidence=options.min_confidence, 401 output_format=options.output_format) 402 output_format=options.output_format, 403 commit_queue=options.commit_queue) 402 404 403 405 … … 594 596 595 597 def _create_checker(self, file_type, file_path, handle_style_error, 596 min_confidence ):598 min_confidence, commit_queue): 597 599 """Instantiate and return a style checker based on file type.""" 598 600 if file_type == FileType.NONE: … … 614 616 checker = TextChecker(file_path, handle_style_error) 615 617 elif file_type == FileType.JSON: 616 checker = JSONChecker(file_path, handle_style_error) 618 basename = os.path.basename(file_path) 619 if commit_queue and basename == 'contributors.json': 620 checker = JSONContributorsChecker(file_path, handle_style_error) 621 else: 622 checker = JSONChecker(file_path, handle_style_error) 617 623 elif file_type == FileType.PYTHON: 618 624 checker = PythonChecker(file_path, handle_style_error) … … 643 649 return checker 644 650 645 def dispatch(self, file_path, handle_style_error, min_confidence ):651 def dispatch(self, file_path, handle_style_error, min_confidence, commit_queue): 646 652 """Instantiate and return a style checker based on file path.""" 647 653 file_type = self._file_type(file_path) … … 650 656 file_path, 651 657 handle_style_error, 652 min_confidence) 658 min_confidence, 659 commit_queue) 653 660 return checker 654 661 … … 671 678 max_reports_per_category, 672 679 min_confidence, 673 output_format): 680 output_format, 681 commit_queue): 674 682 """Create a StyleProcessorConfiguration instance. 675 683 … … 690 698 and "vs7" which Microsoft Visual Studio 7 can parse. 691 699 700 commit_queue: A bool indicating whether the style check is performed 701 by the commit queue or not. 702 692 703 """ 693 704 self._filter_configuration = filter_configuration … … 696 707 self.max_reports_per_category = max_reports_per_category 697 708 self.min_confidence = min_confidence 709 self.commit_queue = commit_queue 698 710 699 711 def is_reportable(self, category, confidence_in_error, file_path): … … 865 877 checker = self._dispatcher.dispatch(file_path, 866 878 style_error_handler, 867 min_confidence) 879 min_confidence, 880 self._configuration.commit_queue) 868 881 869 882 if checker is None: -
trunk/Tools/Scripts/webkitpy/style/checker_unittest.py
r159977 r160083 310 310 checker = self._dispatcher.dispatch(file_path=path, 311 311 handle_style_error=None, 312 min_confidence=3) 312 min_confidence=3, 313 commit_queue=False) 313 314 message = 'while checking: %s' % path 314 315 self.assertEqual(checker is None, is_checker_none, message) … … 368 369 checker = dispatcher.dispatch(file_path, 369 370 self.mock_handle_style_error, 370 min_confidence=3) 371 min_confidence=3, 372 commit_queue=False) 371 373 return checker 372 374 … … 610 612 max_reports_per_category={"whitespace/newline": 1}, 611 613 min_confidence=3, 612 output_format=output_format) 614 output_format=output_format, 615 commit_queue=False) 613 616 614 617 def test_init(self): … … 662 665 max_reports_per_category={}, 663 666 min_confidence=3, 664 output_format="vs7") 667 output_format="vs7", 668 commit_queue=False) 665 669 processor = StyleProcessor(configuration) 666 670 … … 672 676 max_reports_per_category={}, 673 677 min_confidence=3, 674 output_format="vs7") 678 output_format="vs7", 679 commit_queue=False) 675 680 processor = StyleProcessor(configuration) 676 681 … … 720 725 return not file_path.endswith('carriage_returns_allowed.txt') 721 726 722 def dispatch(self, file_path, style_error_handler, min_confidence ):727 def dispatch(self, file_path, style_error_handler, min_confidence, commit_queue): 723 728 if file_path.endswith('do_not_process.txt'): 724 729 return None … … 743 748 max_reports_per_category={"whitespace/newline": 1}, 744 749 min_confidence=3, 745 output_format="vs7") 750 output_format="vs7", 751 commit_queue=False) 746 752 747 753 mock_carriage_checker_class = self._create_carriage_checker_class() -
trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py
r107139 r160083 48 48 return 0 49 49 return int(match.group('line')) 50 51 52 class JSONContributorsChecker(JSONChecker): 53 """Processes contributors.json lines""" 54 55 def check(self, lines): 56 super(JSONContributorsChecker, self).check(lines) 57 self._handle_style_error(0, 'json/syntax', 5, 'contributors.json should not be modified through the commit queue') -
trunk/Tools/Scripts/webkitpy/style/error_handlers_unittest.py
r159977 r160083 58 58 max_reports_per_category={"whitespace/tab": 2}, 59 59 min_confidence=3, 60 output_format="vs7") 60 output_format="vs7", 61 commit_queue=False) 61 62 62 63 def _error_handler(self, configuration, line_numbers=None): -
trunk/Tools/Scripts/webkitpy/style/optparser.py
r134371 r160083 149 149 is_verbose=False, 150 150 min_confidence=1, 151 output_format="emacs"): 151 output_format="emacs", 152 commit_queue=False): 152 153 if filter_rules is None: 153 154 filter_rules = [] … … 169 170 self.min_confidence = min_confidence 170 171 self.output_format = output_format 172 self.commit_queue = commit_queue 171 173 172 174 # Useful for unit testing. … … 338 340 action="store_true", help=verbose_help) 339 341 342 commit_queue_help = "force commit queue to check contributors.json change" 343 parser.add_option("--commit-queue", action="store_true", dest="commit_queue", default=False, help=commit_queue_help) 344 340 345 # Override OptionParser's error() method so that option help will 341 346 # also display when an error occurs. Normally, just the usage … … 423 428 min_confidence = options.min_confidence 424 429 output_format = options.output_format 430 commit_queue = options.commit_queue 425 431 426 432 if filter_value is not None and not filter_value: … … 452 458 is_verbose=is_verbose, 453 459 min_confidence=min_confidence, 454 output_format=output_format) 460 output_format=output_format, 461 commit_queue=commit_queue) 455 462 456 463 return (paths, options) -
trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py
r135912 r160083 64 64 options.comment = None 65 65 options.description = "MOCK description" 66 options.non_interactive = False 66 67 options.request_commit = False 67 68 options.review = True … … 115 116 options.comment = None 116 117 options.description = "MOCK description" 118 options.non_interactive = False 117 119 options.request_commit = False 118 120 options.review = True -
trunk/Tools/Scripts/webkitpy/tool/steps/checkstyle.py
r157682 r160083 57 57 args.append(self._options.check_style_filter) 58 58 59 if self._options.non_interactive: 60 # We assume that only bots run this script in non interactive mode 61 # in which case we perform additional style check 62 args.append("--commit-queue") 63 59 64 try: 60 65 self._tool.executive.run_and_throw_if_fail(self._tool.deprecated_port().check_webkit_style_command() + args, cwd=self._tool.scm().checkout_root)
Note:
See TracChangeset
for help on using the changeset viewer.