summaryrefslogtreecommitdiff
path: root/.pytool/Plugin/EccCheck
AgeCommit message (Collapse)AuthorFilesLines
2023-02-08.pytool/Plugin/EccCheck: Add PACKAGES_PATH supportMarvin Ha?user1-1/+8
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4326 EccBuild currently assumes all packages reside in WORKSPACE. However, this is obviously not the case for many setups. Most notably, Ext4Pkg is located in edk2-platforms/Features and thus cannot be in WORKSPACE in any reasonable setup. Use Edk2Path to locate the package in WORKSPACE and PACKAGES_PATH. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Pedro Falcato <pedro.falcato@gmail.com> Signed-off-by: Marvin H?user <mhaeuser@posteo.de> Acked-by: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
2021-11-29.pytool/Plugin/EccCheck: Add performance optimizationsMichael D Kinney1-27/+94
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2986 Improve the performance of EccCheck by using a temp file instead of stdout to capture the results of the git diff commands. If a large patch set is passed into EccCheck, using stdout could be slow and also added the large diff content to the build log that is redundant information. A second performance improvement is to filter the modified directories to remove duplicate directories. Complex libraries and modules that have subdirectories with sources would be scanned twice if there were source changes in both the main directory and subdirectories. Filter out the subdirectories from the modified directory list when this case is detected. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-11-29.pytool/Plugin/EccCheck: Remove temp directory on exceptionMichael D Kinney1-31/+47
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2986 Add try/except to RunBuildPlugin() to remove temporary directory if a KeyboardInterrupt exception or an unexpected exception is detected. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-11-29.pytool/Plugin/EccCheck: Remove RevertCode()Michael D Kinney1-40/+53
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2986 The RevertCode() method uses git reset which can remove local changes. Instead of modifying the local files, a copy of the package passed into the EccCheck tool is copied to a temp directory in Build/ecctemp. This same temp directory is also used for exception.xml. The working directory used by ECC is also set to this same temp directory. The combination of these changes eliminates operations that that modified the git state. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-07-12.pytool/EccCheck: Set PACKAGES_PATH env var in EccPierre Gondois1-0/+1
When running Ecc on other repositories (e.g.: edk2-platforms with edk2 as a submodule), edk2 modules are referenced. E.g.: MdePkg/.. The PACKAGES_PATH env var can be used to reference other directories containing packages. Set it so that Ecc can find these packages. 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> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-07-12.pytool/EccCheck: Check ecc_csv existsPierre Gondois1-3/+2
'workspace_path' being an absolute path leads to 'ecc_csv' being an absolute path. Then it won't be found among 'file' as they are relative paths. 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> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-07-12.pytool/EccCheck: Rename edk2_path as workspace_pathPierre Gondois1-16/+16
The edk2 path and the workspace path are identical when running Ecc on edk2. When running Ecc on another repository (e.g.: edk2-platforms with edk2 as a submodule of edk2-platforms), these directories are different. Indeed, in the latter configuration, Ecc must run git commands on the tested repository, i.e. the workspace directory, edk2-platforms. Thus, rename edk2_path as workspace_path. 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> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-07-12.pytool/EccCheck: Locate BaseTools dir with EDK_TOOLS_PATHPierre Gondois1-8/+10
The BaseTools directory is currently being located as a sub-directory of the WORKSPACE env var. This might not be true in other environments. Cf EDKII Build Specification, s4.1.3 "Build Process Restrictions": There is no restriction on the location of the EDK_TOOLS_PATH, it may be located within a directory identified as the WORKSPACE directory, or in any other location that is accessible on the development workstation. Locate the BaseTools directory using EDK_TOOLS_PATH instead. 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> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2020-09-03Revert ".pytool/EccCheck: Disable Ecc error code 10014 for open CI"edk2-stable202008Zhang, Shenglei1-1/+0
This reverts commit d4e0b9607c9a64a8eff20724b2e35ea2cd5bd33f. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2951 Previously false positive Ecc issue whose error code is 10014 was reported under Linux OS. So we disabled it in EccCheck plugin for edk2 open CI. As the bug is fixed, we need to revert the change and re-enable it. 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: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2020-08-24.pytool/EccCheck: Disable Ecc error code 10014 for open CIShenglei Zhang1-0/+1
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2920 Ecc issues whose error code is 10014, can't be correctly handled under Linux OS, resulting from a bug in Ecc tool. So we need to disable it before ecc tool is repaired. 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 <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2020-08-17.pytool/Plugin: Add a plugin EccCheckShenglei Zhang3-0/+335
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606 EccCheck is a plugin to report Ecc issues for code in pull request , which will be run on open ci. But note not each kind of issue could be reported out. It can only handle the issues, whose line number in CSV report accurately map with their code in source code files. And Ecc issues about comments can also be handled. 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 <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>