Home

Comments should not be located at the end of lines of code

Description

    The Pl/SQL code rule "Comments should not be located at the end of lines of code" means that comments should not be placed at the end of a line of code, as this can lead to confusion and errors. Comments should be placed on their own line, or at the beginning of a line of code, so that they are clearly visible and not mistaken for part of the code. This helps to ensure that the code is well-documented and easy to understand.

Key Benefits

  • Improves readability: By placing comments at the beginning of lines of code, it is easier to read the code and understand its purpose.
  • Reduces errors: By providing a more detailed explanation of the code, it is easier to identify potential errors.
  • Makes code easier to maintain: By providing a more detailed explanation of the code, it is easier to make changes and maintain the code.

 

Non-compliant Code Example

SELECT --Select all the columns in the customer table  --Non compliant code (Comment is mentioned at the end of the line)
    *       
FROM
    CUSTOMERS

Compliant Code Example

SELECT 
--Select all the columns in the customer table    --Compliant code (Comment is mentioned in the new line)
    *       
FROM
    CUSTOMERS
Visual Expert 2024
 VEPLSQLRULE185