You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function in the codebase assume errors in places they should not. This leads to erroneous error printing which can increase if these functions are called more often in the future.
This is particularly true for "helper" functions. The function has no context of the caller's intentions. Therefore, it should not consider being called an error.
GetContainingPackage() outputs error messages if the given input path is not in package. That might not be an error. The caller might simply want to check if the path is in a package. Only the caller can determine if the presence of the given path in or out of a package is an error.
Some functions such as def GetAbsolutePathOnThisSystemFromEdk2RelativePath(self, relpath, log_errors=True) allow the caller to control error printing but this complicates the function interface for no reason. The caller can easily print an error based on the function return value; the function simply needs to return that value.
Reproduction steps
Perform source code review of functions in this repository for cases where error messages are printed based on assumptions about the caller.
Expected behavior
Error messages are only printed in the cases of true errors. If an exceptional circumstance occurs outside the defined return value of the function, exceptions should be used and documented.
Execution Environment
No response
Pip packages
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Contact Details
No response
Describe the Bug
Function in the codebase assume errors in places they should not. This leads to erroneous error printing which can increase if these functions are called more often in the future.
This is particularly true for "helper" functions. The function has no context of the caller's intentions. Therefore, it should not consider being called an error.
For example:
https://github.com/tianocore/edk2-pytool-library/blob/master/edk2toollib/uefi/edk2/path_utilities.py
GetContainingPackage()
outputs error messages if the given input path is not in package. That might not be an error. The caller might simply want to check if the path is in a package. Only the caller can determine if the presence of the given path in or out of a package is an error.Some functions such as
def GetAbsolutePathOnThisSystemFromEdk2RelativePath(self, relpath, log_errors=True)
allow the caller to control error printing but this complicates the function interface for no reason. The caller can easily print an error based on the function return value; the function simply needs to return that value.Reproduction steps
Perform source code review of functions in this repository for cases where error messages are printed based on assumptions about the caller.
Expected behavior
Error messages are only printed in the cases of true errors. If an exceptional circumstance occurs outside the defined return value of the function, exceptions should be used and documented.
Execution Environment
No response
Pip packages
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: