Browse Source

Add .rs to list of presubmit source file patterns

.rs files were not part of DEFAULT_FILES_TO_CHECK which means that they
were not being checked for proper licenses, among other things.

Testing with this command reveals that six missing or bad licenses have
crept in:

    git cl presubmit --force --files "*.rs"

Output was:

Found a bad license header in these files:
  build\rust\tests\test_aliased_deps\main.rs
  build\rust\tests\test_aliased_deps\real_name.rs
  mojo\public\rust\tests\util\mojom_validation.rs
  testing\rust_gtest_interop\gtest_attribute.rs
  tools\crates\gnrt\sample_package\foo\src\lib.rs
  tools\crates\gnrt\sample_package\src\main.rs

Change-Id: Ia7788d92d428a4060f4a0b854fdcee0450b0a3f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4128762
Commit-Queue: Gavin Mak <gavinmak@google.com>
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Collin Baker <collinbaker@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Bruce Dawson 2 years ago
parent
commit
7a81ebf111
2 changed files with 2 additions and 2 deletions
  1. 1 1
      presubmit_support.py
  2. 1 1
      tests/presubmit_unittest.py

+ 1 - 1
presubmit_support.py

@@ -573,7 +573,7 @@ class InputApi(object):
       r'.+\.pm$',
       r'.+\.pm$',
       # Other
       # Other
       r'.+\.java$', r'.+\.mk$', r'.+\.am$', r'.+\.css$', r'.+\.mojom$',
       r'.+\.java$', r'.+\.mk$', r'.+\.am$', r'.+\.css$', r'.+\.mojom$',
-      r'.+\.fidl$'
+      r'.+\.fidl$', r'.+\.rs$',
   )
   )
 
 
   # Path regexp that should be excluded from being considered containing source
   # Path regexp that should be excluded from being considered containing source

+ 1 - 1
tests/presubmit_unittest.py

@@ -1399,7 +1399,7 @@ class InputApiUnittest(PresubmitTestsBase):
   def testDefaultOverrides(self):
   def testDefaultOverrides(self):
     input_api = presubmit.InputApi(
     input_api = presubmit.InputApi(
         self.fake_change, './PRESUBMIT.py', False, None, False)
         self.fake_change, './PRESUBMIT.py', False, None, False)
-    self.assertEqual(len(input_api.DEFAULT_FILES_TO_CHECK), 25)
+    self.assertEqual(len(input_api.DEFAULT_FILES_TO_CHECK), 26)
     self.assertEqual(len(input_api.DEFAULT_FILES_TO_SKIP), 12)
     self.assertEqual(len(input_api.DEFAULT_FILES_TO_SKIP), 12)
 
 
     input_api.DEFAULT_FILES_TO_CHECK = (r'.+\.c$',)
     input_api.DEFAULT_FILES_TO_CHECK = (r'.+\.c$',)