Home
Lines should not be too long
Description
The rule "Lines should not be too long" states that PowerBuilder code should be written in a way that limits each line to a certain number of characters. This is to help improve readability of the code, as long lines can be difficult to read and understand. It also helps to keep the code organized and structured, as it can be easier to find errors or make changes when the code is written in a consistent manner. Additionally, long lines can cause performance issues, as the code may have to be parsed multiple times in order to be executed.
Key Benefits
- Improved readability: By limiting the length of lines, it becomes easier to read and understand the text.
- Better formatting: Long lines can cause formatting issues, making the text difficult to read.
- Easier to maintain: Limiting line length makes it easier to maintain and update the text.
Non-compliant Code Example
global type t_ole32_externalfunctions from function_object
end type
forward prototypes
SUBROUTINE CoInitializeSecurityAlias(string uExitCode) LIBRARY "ole32.dll" ALIAS FOR "CoInitializeSecurity"
SUBROUTINE CoInitializeSecurity(string uExitCode) LIBRARY "ole32.dll"
SUBROUTINE CoSetProxyBlanket(string uExitCode) LIBRARY "ole32.dll"
function string setPermission(string as_string)
end prototypes
function string setPermission(string as_string)
// alias function
CoInitializeSecurityAlias(as_string)
// Test case for longest string rule. It is a longest line with in function. It initialize security based on string passed to the method. //Non compliant code (Line length should be less than 100)
CoInitializeSecurity(as_string)
CoSetProxyBlanket(as_string)
Return as_string
end function