Fix inclusive language presubmit

The current presubmit has the filter inverted so it would only attempt
to match the filtered files. The file name also has to be converted to
`LocalPath` otherwise it's attempting to compare a python object to a
string and always fails to match.

Bug: dawn:1339
Change-Id: Ie7712dee60f6b9df2cb78c9feab11769f7ea1f02
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair
2022-04-19 22:25:45 +00:00
committed by Dawn LUCI CQ
parent 6a3373e419
commit fb5a492787
88 changed files with 574 additions and 534 deletions

View File

@@ -80,7 +80,9 @@ def _CheckNonInclusiveLanguage(input_api, output_api, source_file_filter=None):
matches = []
for f in input_api.AffectedFiles(include_deletes=False,
file_filter=source_file_filter):
for line_num, line in f.ChangedContents():
line_num = 0
for line in f.NewContents():
line_num += 1
for reg in NONINCLUSIVE_REGEX_LIST:
match = reg.search(line)
if match:
@@ -99,11 +101,29 @@ def _CheckNonInclusiveLanguage(input_api, output_api, source_file_filter=None):
def _NonInclusiveFileFilter(file):
filter_list = [
"Doxyfile", # References to main pages
"PRESUBMIT.py", # Non-inclusive language check data
"PRESUBMIT.py.tint", # Non-inclusive language check data
"docs/dawn/debug_markers.md", # External URL
"docs/dawn/infra.md", # Infra settings
"docs/tint/spirv-input-output-variables.md", # External URL
"test/tint/samples/compute_boids.wgsl ", # External URL
"infra/config/global/generated/cr-buildbucket.cfg", # Infra settings
"infra/config/global/main.star", # Infra settings
"infra/kokoro/windows/build.bat", # External URL
"src/dawn/common/GPUInfo.cpp", # External URL
"src/dawn/native/metal/BackendMTL.mm", # OSX Constant
"src/dawn/native/vulkan/SamplerVk.cpp", # External URL
"src/dawn/native/vulkan/TextureVk.cpp", # External URL
"src/dawn/node/tools/src/cmd/run-cts/main.go", # Terminal type name
"src/dawn/samples/ComputeBoids.cpp", # External URL
"src/dawn/tests/end2end/DepthBiasTests.cpp", # External URL
"test/tint/samples/compute_boids.wgsl", # External URL
"third_party/khronos/KHR/khrplatform.h", # Third party file
"tools/roll-all", # Branch name
"tools/src/container/key.go", # External URL
"tools/src/go.sum", # External URL
]
return file in filter_list
return file.LocalPath() not in filter_list
def _DoCommonChecks(input_api, output_api):