Home
Unused function parameters should be removed
Description
The "Unused Function Parameters Should Be Removed" PowerBuilder code rule states that any function parameters that are not used within the body of the function should be removed. This helps to reduce the amount of code that needs to be maintained and ensures that unnecessary code is not included in the program. Additionally, it helps to improve readability by making the code easier to understand, and it can also improve performance by reducing the amount of code that needs to be processed.
Key Benefits
- Reduced Cognitive Load: Removing unused function parameters reduces the amount of information a developer needs to consider when reading and understanding a function.
- Improved Performance: Removing unused function parameters can improve the performance of the function by reducing the number of operations that need to be performed.
- Easier Maintenance: Removing unused function parameters makes it easier to maintain the code, as there is less code to keep track of.
- Cleaner Code: Removing unused function parameters helps to keep the code clean and readable, as there is less clutter.
Non-compliant Code Example
global function string callINETHyperlinkToURL (integer id) //Non compliant code (id parameter never used)
integer li_rc
SetPointer(HourGlass!)
li_rc = &
HyperlinkToURL("https://www.visual-expert.com")
Return ""
end function
Compliant Code Example
global function string callINETHyperlinkToURL () //Compliant code
integer li_rc
SetPointer(HourGlass!)
li_rc = &
HyperlinkToURL("https://www.visual-expert.com")
Return ""
end function