Major

Code Rules in Major Severity

Category Severity Name Description
Bug Major All branches in a conditional structure should not have exactly the same implementation

The "All branches in a conditional structure should not have exactly the same implementation" PowerBuilder code rule states that all branches in a conditional structure should have distinct implementations. This means that each branch should have its own distinct logic and code, rather than having the same code repeated across multiple branches. This helps to ensure that the code is clear and easy to read, and that the logic of the code is sound and consistent. Additionally, it helps to avoid potential errors that could arise from having multiple branches with the same implementation.

Maintainability Major CASE clauses should not have too many lines

The "CASE clauses should not have too many lines" PowerBuilder code rule states that when writing code using the CASE statement, the number of lines within each clause should be kept to a minimum. This helps to improve the readability of the code, makes it easier to debug, and reduces the chances of introducing errors. Additionally, it is recommended that the CASE statement be used only when absolutely necessary, and that alternative approaches such as IF/ELSE statements be used instead when possible. This helps to keep the code concise and easier to maintain.

Maintainability Major CASE structures should not have too many CASE clauses

The "CASE structures should not have too many CASE clauses" rule states that when using CASE structures in PowerBuilder code, the number of CASE clauses should be kept to a manageable amount. This is because too many CASE clauses can make the code difficult to read and understand, and can also lead to performance issues. It's best to use other methods to structure the code if possible, such as using IF/ELSE statements. If CASE structures must be used, it's important to keep the number of clauses to a minimum.

Maintainability Major Collapsible if statements should be merged

The "Collapsible if statements should be merged" rule states that when multiple if statements can be combined into a single if statement, they should be merged. This helps to make code more concise and easier to read, as well as reducing the overall complexity of the code. It also helps to avoid potential errors that can occur when multiple if statements are used. For example, if two if statements are used to check for a condition, but the first statement fails, the second statement will still be executed, even though the condition was already checked. By merging the two statements into one, this potential error can be avoided.

Maintainability Major Files should not have too many lines of code

This rule states that files should not contain too many lines of code. This is to ensure that the code is well-structured, easy to read and maintain, and that the code is logically organized. It is also important to ensure that the code is not overly complicated or difficult to understand. This rule is especially important for larger projects, where the code can become difficult to manage if it is too long or convoluted. It is also important to keep the code organized in a way that is easy to understand and navigate. By limiting the length of each file, developers can ensure that their code is well-structured and easy to maintain.

Maintainability Major FOR loop end conditions should not be hard - coded

This rule states that the end conditions of a FOR loop should not be hard-coded. This means that the end conditions should be determined dynamically based on the data being processed by the loop. Hard-coding end conditions can lead to errors and inefficiencies in the code. It is better to use variables or other expressions to set the end conditions so that the loop can be more flexible and adaptable to different data sets.

Maintainability Major Function and Event parameters should comply with a naming convention

This PowerBuilder code rule states that function and event parameters must follow a specific naming convention. This convention helps to ensure that the code is consistent and easier to read. The naming convention should include a prefix for each type of parameter, such as “in_” for input parameters, “out_” for output parameters, and “inout_” for parameters that are both input and output. This makes it easier to identify the purpose of each parameter when reading the code.

Maintainability Major Function OR Event name should comply with a naming convention

This rule states that all functions and events in PowerBuilder code should follow a specific naming convention. This naming convention should be consistent throughout the code and should be easy to understand. The naming convention should also make it easy to distinguish between functions and events, as well as other types of code elements. This will help to make the code more organized and easier to read and maintain.

Bug Major Function return type does not match with the actual variable returned

This rule states that a function's return type must match the type of the variable that is actually returned. For example, if a function is declared as returning an integer, then the function must return an integer value. If a function is declared as returning a string, then the function must return a string value. If the actual return value does not match the declared return type, then the code will not compile.

Maintainability Major Functions Or Events should not have too many parameters

This rule states that functions or events should not have too many parameters. Having too many parameters can make the code difficult to read and understand, and can lead to errors. It is best practice to limit the number of parameters to a manageable number, usually no more than 5-10. Any more than that should be split into multiple functions or events. This will help make the code more readable and easier to maintain.

Maintainability Major GOTO should not be used within loops

The PowerBuilder code rule stating that "GOTO should not be used within loops" is an important guideline for developers to adhere to when writing code. This rule is designed to prevent unexpected behavior and to make the code easier to read and maintain. By avoiding the use of GOTO statements within loops, developers can ensure that their code is more organized, less prone to errors, and easier to debug. Additionally, using GOTO statements within loops can lead to unexpected behavior, which can be difficult to diagnose and fix. Therefore, it is important to avoid the use of GOTO statements within loops in order to ensure code maintainability and reliability.

Maintainability Major GOTO statements should not be used

The "GOTO statements should not be used" PowerBuilder code rule states that GOTO statements should not be used in PowerBuilder code, as they can lead to code that is difficult to read and maintain. GOTO statements cause code to become "spaghetti code" - code that is difficult to follow and understand. Instead of using GOTO statements, it is better to use structured programming techniques such as looping and branching. These techniques make code easier to read and maintain, and can help to reduce errors in the code.

Bug Major IF statement conditions should not evaluate unconditionally to TRUE or to FALSE

The IF statement conditions should not evaluate unconditionally to TRUE or to FALSE rule is a guideline for PowerBuilder developers to ensure that their code is properly structured and functioning correctly. This rule states that IF statements should not contain conditions that will always evaluate to either TRUE or FALSE. Instead, the conditions should be dynamic and based on the values of variables or other conditions. This ensures that the IF statement will be executed correctly and that the desired results will be achieved. By following this rule, developers can avoid potential errors and maintain the integrity of their code.

Maintainability Major IF statements should not be nested too deeply

This rule states that IF statements should not be nested too deeply. This means that when writing code, the programmer should avoid writing nested IF statements that are too complex and difficult to read. Nested IF statements are when one IF statement is placed inside another IF statement. Too much nesting can make code hard to read and difficult to debug. To avoid this, the programmer should try to limit the amount of nesting and use other programming techniques to keep the code clear and readable.

Bug Major Jump statements should not be followed by dead code

The "Jump statements should not be followed by dead code" PowerBuilder code rule states that any jump statement (such as a "goto," "return," "exit," or "exit loop") should not be followed by code that will never be executed. This is considered bad programming practice, as it can lead to confusion and errors. It is best practice to ensure that any code following a jump statement is necessary and will be executed.

Bug Major Loops with at most one iteration should be refactored

The "Loops with at most one iteration should be refactored" rule in PowerBuilder code states that any loops which contain only one iteration of code should be refactored in order to make the code more efficient and easier to read. This means that instead of having a loop with just one iteration, the code should be rewritten to simply execute the code block without the loop. This can help to reduce the amount of code and make the code more understandable.

Maintainability Major Redundant pairs of parentheses should be removed

The PowerBuilder code rule "Redundant pairs of parentheses should be removed" means that when writing PowerBuilder code, any redundant pairs of parentheses should be removed as they are not necessary and can make the code difficult to read and understand. Redundant parentheses can be removed by replacing them with a single set of parentheses or by simply removing them altogether. This rule helps to ensure that the code is well-structured and easier to read.

Bug Major Related IF/ELSIF statements and WHEN clauses in a CASE should not have the same condition

This rule states that when using IF/ELSIF statements and WHEN clauses in a CASE statement, they should not have the same condition. This is because the conditions should be unique to each statement or clause, as having the same condition could result in an infinite loop or other unintended behavior. This rule helps ensure that the code is structured properly and that it runs as expected.

Maintainability Major Statements should be on separate lines The PowerBuilder code rule "Statements should be on separate lines" states that each statement in a PowerBuilder program should be placed on a separate line. This helps to make the code more readable and easier to debug, as it is easier to identify individual statements when they are on separate lines. Additionally, this rule helps to ensure that any changes made to a particular statement are easily identifiable, as they will be on their own line.
Maintainability Major Track uses of FIXME tags

The PowerBuilder code rule "Track uses of FIXME tags" helps to keep track of any code that requires further attention or debugging. This rule will search through the code for any comments containing FIXME tags, and then log any instances of these tags in a log file. This log can then be used to quickly identify areas of the code that may need further attention or debugging. In addition, this rule can help developers to keep track of any tasks they need to complete, as well as any areas that may need to be refactored or improved.

Maintainability Major Two branches in a conditional structure should not have exactly the same implementation

This rule states that when a conditional structure is used, the two branches should not have the same implementation. This means that the code executed in each branch should be different. This helps to ensure that the code is more organized and readable, and that the code runs as expected.

Maintainability Major Unused event parameters should be removed

This rule states that any event parameters that are not used in the PowerBuilder code should be removed. This is important because leaving unused event parameters can lead to unexpected behavior in the code, and can also lead to increased memory usage. Unused event parameters should be identified and removed to ensure the code is running optimally.

Maintainability Major Unused function parameters should be removed

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.

Maintainability Major Unused labels should be removed

This PowerBuilder code rule states that any labels which are no longer used in the code should be removed. This helps to ensure that the code is organized and easy to read, and that any unnecessary code is removed. Unused labels can be identified by searching the code for any labels which are not referenced anywhere else in the code. Once identified, these labels can be removed to help keep the code clean and organized.

Bug Major Variables should not be self-assigned

The "Variables should not be self-assigned" PowerBuilder code rule states that variables should not be set to the same value they already contain. This means that any assignment statement that assigns a variable to itself should be avoided, as it is redundant and can lead to confusion and errors. Self-assignment can also lead to unexpected results, as the value of the variable may not be what was expected. For example, if a variable is assigned to itself within an if statement, the value of the variable may be changed even if the if statement condition is not met.