Checkstyle handling when all lines are deleted.
It is valid to have empty modified_lines list for files that only contain deletions. In such case we should skip all the errors except for forced rules. Updated the test to match the expectation. Change-Id: I6993968b882fb6fbe2ba1f63f3b6879c3308ff34
This commit is contained in:
@@ -77,7 +77,8 @@ class TestCheckstyle(unittest.TestCase):
|
||||
checkstyle.git.last_commit = mock_last_commit
|
||||
|
||||
def test_ShouldSkip(self):
|
||||
self.assertFalse(checkstyle._ShouldSkip([], 1, TEST_RULE))
|
||||
self.assertFalse(checkstyle._ShouldSkip(None, 1, TEST_RULE))
|
||||
self.assertTrue(checkstyle._ShouldSkip([], 1, TEST_RULE))
|
||||
self.assertFalse(checkstyle._ShouldSkip([1], 1, TEST_RULE))
|
||||
self.assertFalse(checkstyle._ShouldSkip([1, 2, 3], 1, TEST_RULE))
|
||||
self.assertTrue(checkstyle._ShouldSkip([1, 2, 3], 4, TEST_RULE))
|
||||
|
||||
Reference in New Issue
Block a user