]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Pytool: SpellCheck: Fix incorrect file mask across package matrices
authorSean Brogan <spbrogan@live.com>
Thu, 10 Jun 2021 01:47:33 +0000 (09:47 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 15 Jun 2021 07:12:13 +0000 (07:12 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3443

Existing implementation could modify class global data that causes
potential incorrect file mask to be used for execution of plugin.

This change switches class variable to be tuple so that it cannot be
accidently modified. Local usage of STANDARD_PLUGIN_DEFINED_PATHS is also
changed to copy to new list before modification.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
.pytool/Plugin/SpellCheck/SpellCheck.py

index 43365441b91ce02c39f8dd6e8ad879df97b5ea0d..9ad57632a6e8b534e81a8d561a63f33fed7b1583 100644 (file)
@@ -37,12 +37,12 @@ class SpellCheck(ICiBuildPlugin):
     #\r
     # A package can remove any of these using IgnoreStandardPaths\r
     #\r
-    STANDARD_PLUGIN_DEFINED_PATHS = ["*.c", "*.h",\r
+    STANDARD_PLUGIN_DEFINED_PATHS = ("*.c", "*.h",\r
                                      "*.nasm", "*.asm", "*.masm", "*.s",\r
                                      "*.asl",\r
                                      "*.dsc", "*.dec", "*.fdf", "*.inf",\r
                                      "*.md", "*.txt"\r
-                                     ]\r
+                                     )\r
 \r
     def GetTestName(self, packagename: str, environment: VarDict) -> tuple:\r
         """ Provide the testcase name and classname for use in reporting\r
@@ -107,7 +107,8 @@ class SpellCheck(ICiBuildPlugin):
         version_aggregator.GetVersionAggregator().ReportVersion(\r
             "CSpell", cspell_version, version_aggregator.VersionTypes.INFO)\r
 \r
-        package_relative_paths_to_spell_check = SpellCheck.STANDARD_PLUGIN_DEFINED_PATHS\r
+        # copy the default as a list\r
+        package_relative_paths_to_spell_check = list(SpellCheck.STANDARD_PLUGIN_DEFINED_PATHS)\r
 \r
         #\r
         # Allow the ci.yaml to remove any of the above standard paths\r