Title: [268752] trunk/Tools
Revision
268752
Author
aakash_j...@apple.com
Date
2020-10-20 12:13:22 -0700 (Tue, 20 Oct 2020)

Log Message

Make report-non-inclusive-language ignore autoinstalled directories and certain file types
https://bugs.webkit.org/show_bug.cgi?id=217972

Reviewed by Beth Dakin.

* Scripts/report-non-inclusive-language: startswith and endswith also takes a tuple of suffixes to
look for, reference: https://docs.python.org/3/library/stdtypes.html#str.endswith

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (268751 => 268752)


--- trunk/Tools/ChangeLog	2020-10-20 18:51:22 UTC (rev 268751)
+++ trunk/Tools/ChangeLog	2020-10-20 19:13:22 UTC (rev 268752)
@@ -1,5 +1,15 @@
 2020-10-20  Aakash Jain  <aakash_j...@apple.com>
 
+        Make report-non-inclusive-language ignore autoinstalled directories and certain file types
+        https://bugs.webkit.org/show_bug.cgi?id=217972
+
+        Reviewed by Beth Dakin.
+
+        * Scripts/report-non-inclusive-language: startswith and endswith also takes a tuple of suffixes to
+        look for, reference: https://docs.python.org/3/library/stdtypes.html#str.endswith
+
+2020-10-20  Aakash Jain  <aakash_j...@apple.com>
+
         [build.webkit.org] Use builder tags instead of category for latest buildbot
         https://bugs.webkit.org/show_bug.cgi?id=217958
 

Modified: trunk/Tools/Scripts/report-non-inclusive-language (268751 => 268752)


--- trunk/Tools/Scripts/report-non-inclusive-language	2020-10-20 18:51:22 UTC (rev 268751)
+++ trunk/Tools/Scripts/report-non-inclusive-language	2020-10-20 19:13:22 UTC (rev 268752)
@@ -33,8 +33,6 @@
 #   Clever default for use on WebKit source tree instead of current directory by default.
 #   Report third party sources separately from WebKit project files.
 #   Skip known examples on an exception list that we don't intend to fix.
-#   Replace special cases for ChangeLog, ".order", ".xcuserstate", ".git", ".svn"
-#   files with something smarter.
 
 # Hard-coded for now, could read these out of a file instead.
 # Term, then the regular _expression_ for that term.
@@ -44,6 +42,10 @@
     [ "slave", "slave" ]
 ]
 
+IGNORE_DIRECTORIES = ['.svn', '.git', 'autoinstalled']
+IGNORE_FILES_STARTING_WITH = ('ChangeLog')
+IGNORE_FILES_ENDING_WITH = ('.log', '.order', '.pyc', '.swp', '.xcuserstate')
+
 parser = argparse.ArgumentParser(description='Report counts and locations of non-inclusive terms.')
 parser.add_argument('--verbose', '-v', action='');
 args = parser.parse_args()
@@ -56,17 +58,13 @@
 root = os.getcwd()
 for subroot, directories, files in os.walk(root):
     prefix = subroot[len(root) + 1:]
-    if ".svn" in prefix:
+    if any(directory in prefix for directory in IGNORE_DIRECTORIES):
         continue
-    if ".git" in prefix:
-        continue
     for file in files:
-        if file.startswith("ChangeLog"):
+        if file.startswith(IGNORE_FILES_STARTING_WITH):
             continue
-        if file.endswith(".order"):
+        if file.endswith(IGNORE_FILES_ENDING_WITH):
             continue
-        if file.endswith(".xcuserstate"):
-            continue
         handle = open(os.path.join(subroot, file), "r")
         for line in handle.readlines():
             for term in nonInclusiveTerms:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to