mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
allow comment lines in inclusive_language_presubmit_exempt_dirs.txt
inclusive_language_presubmit_exempt_dirs.txt is a list of paths to exclude from the inclusive word presubmit check. https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:presubmit_canned_checks.py;l=2602;drc=0bc7c4832e4f2d453e4826c9a2e1197e11bd6ec7 This CL allows comment lines, starting with \#, in the file. (Also, fixes a bug to allow an empty line) Bug: 369701326 Change-Id: I7647459281f7921362aa4070c26671f321b7cfea Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5906016 Auto-Submit: Scott Lee <ddoman@chromium.org> Commit-Queue: Scott Lee <ddoman@chromium.org> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
@@ -298,6 +298,40 @@ class InclusiveLanguageCheckTest(unittest.TestCase):
|
||||
input_api, MockOutputApi())
|
||||
self.assertEqual([], errors)
|
||||
|
||||
def testDirExemptWithComment(self):
|
||||
input_api = MockInputApi()
|
||||
input_api.change.RepositoryRoot = lambda: ''
|
||||
input_api.presubmit_local_path = ''
|
||||
|
||||
input_api.files = [
|
||||
MockFile(
|
||||
os.path.normpath(
|
||||
'infra/inclusive_language_presubmit_exempt_dirs.txt'), [
|
||||
'# this is a comment',
|
||||
'dir1',
|
||||
'# dir2',
|
||||
]),
|
||||
|
||||
# this should be excluded
|
||||
MockFile(
|
||||
os.path.normpath('dir1/1.py'),
|
||||
[
|
||||
'TEST(SomeClassTest, SomeInteraction, blacklist) {', # nocheck
|
||||
'}'
|
||||
]),
|
||||
|
||||
# this should not be excluded
|
||||
MockFile(os.path.normpath('dir2/2.py'),
|
||||
['- (void)testSth { V(whitelist); }']), # nocheck
|
||||
]
|
||||
|
||||
errors = presubmit_canned_checks.CheckInclusiveLanguage(
|
||||
input_api, MockOutputApi())
|
||||
self.assertEqual(1, len(errors))
|
||||
self.assertTrue(os.path.normpath('dir1/1.py') not in errors[0].message)
|
||||
self.assertTrue(os.path.normpath('dir2/2.py') in errors[0].message)
|
||||
|
||||
|
||||
|
||||
class DescriptionChecksTest(unittest.TestCase):
|
||||
def testCheckDescriptionUsesColonInsteadOfEquals(self):
|
||||
|
||||
Reference in New Issue
Block a user