Bug
Code Rules in Bug category
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. |
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. |
Bug | Critical | Functions should end with RETURN statements |
The PowerBuilder code rule that states "Functions should end with RETURN statements" means that all functions should include a RETURN statement as the last line of code. This statement is used to indicate the end of the function and to return a value to the calling program. By using RETURN statements, code can be written in a more organized and efficient manner, as well as making it easier for other developers to understand and debug 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. |
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. |
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. |
Bug | Critical | Syntax Errors |
The PowerBuilder code rule "Syntax Errors" checks the syntax of PowerBuilder code for errors. This includes checking for missing semicolons, invalid keywords, and other syntax-related problems. The rule will report any syntax errors it finds, along with a description of the error and its location in the code. This helps developers quickly identify and fix any syntax-related issues in their PowerBuilder code. |
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. |