Title: [219827] trunk/Tools
Revision
219827
Author
[email protected]
Date
2017-07-24 10:31:12 -0700 (Mon, 24 Jul 2017)

Log Message

Handle case where line_numbers is None instead of an array of line numbers
https://bugs.webkit.org/show_bug.cgi?id=174775

Reviewed by Aakash Jain.

Added files set line_numbers to None in process_file.

* Scripts/webkitpy/style/filereader.py:
(TextFileReader.process_file): Handle case where line_number is set to None.
* Scripts/webkitpy/style/main_unittest.py:
(ExpectationLinterInStyleCheckerTest.test_linter_added_file_with_error): Test case of an added file.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (219826 => 219827)


--- trunk/Tools/ChangeLog	2017-07-24 17:13:27 UTC (rev 219826)
+++ trunk/Tools/ChangeLog	2017-07-24 17:31:12 UTC (rev 219827)
@@ -1,3 +1,17 @@
+2017-07-24  Jonathan Bedard  <[email protected]>
+
+        Handle case where line_numbers is None instead of an array of line numbers
+        https://bugs.webkit.org/show_bug.cgi?id=174775
+
+        Reviewed by Aakash Jain.
+
+        Added files set line_numbers to None in process_file.
+
+        * Scripts/webkitpy/style/filereader.py:
+        (TextFileReader.process_file): Handle case where line_number is set to None.
+        * Scripts/webkitpy/style/main_unittest.py:
+        (ExpectationLinterInStyleCheckerTest.test_linter_added_file_with_error): Test case of an added file.
+
 2017-07-24  Zan Dobersek  <[email protected]>
 
         [WPE] Add libepoxy to the Jhbuild moduleset

Modified: trunk/Tools/Scripts/webkitpy/style/filereader.py (219826 => 219827)


--- trunk/Tools/Scripts/webkitpy/style/filereader.py	2017-07-24 17:13:27 UTC (rev 219826)
+++ trunk/Tools/Scripts/webkitpy/style/filereader.py	2017-07-24 17:31:12 UTC (rev 219827)
@@ -112,7 +112,7 @@
         abs_file_path = self.filesystem.abspath(file_path)
         if abs_file_path not in self._files:
             self._files[abs_file_path] = None
-        if 'line_numbers' in kwargs:
+        if kwargs.get('line_numbers'):
             # Deleted files will be 'None', but if a file has modified lines, this information should override the 'None'
             if self._files[abs_file_path] is None:
                 self._files[abs_file_path] = []

Modified: trunk/Tools/Scripts/webkitpy/style/main_unittest.py (219826 => 219827)


--- trunk/Tools/Scripts/webkitpy/style/main_unittest.py	2017-07-24 17:13:27 UTC (rev 219826)
+++ trunk/Tools/Scripts/webkitpy/style/main_unittest.py	2017-07-24 17:31:12 UTC (rev 219827)
@@ -162,6 +162,19 @@
             file_reader.do_association_check('/mock-checkout', host)
         self.assertEqual(scope.captured_output, ('', '', ''))
 
+    def test_linter_added_file_with_error(self):
+        files = {
+            '/mock-checkout/LayoutTests/TestExpectations':
+            '# TestExpectations\ncss1/test.html [ Failure ]\ncss1/test.html [ Failure ]\n'}
+        host = self._generate_testing_host(files)
+
+        scope = OutputCaptureScope()
+        with scope:
+            file_reader = self._generate_file_reader(host.filesystem)
+            file_reader.process_file('/mock-checkout/LayoutTests/TestExpectations', line_numbers=None)
+            file_reader.do_association_check('/mock-checkout', host)
+        self.assertEqual(scope.captured_output, ('', '', '/mock-checkout/LayoutTests/TestExpectations:3:  Duplicate or ambiguous entry lines LayoutTests/TestExpectations:2 and LayoutTests/TestExpectations:3.  [test/expectations] [5]\n'))
+
     def test_linter_deleted_file(self):
         files = {
             '/mock-checkout/LayoutTests/TestExpectations':
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to