Home
Lines should not be too long
Description
The Pl/SQL code rule "Lines should not be too long" means that code should be written in a way that each line does not exceed a certain length. This helps to make the code more readable and easier to debug. It also helps to keep the code organized and maintainable. Generally, lines should not exceed 80 characters in length, although this can vary depending on the coding style.
Key Benefits
- Easier to Read: By limiting the length of lines, it becomes easier to read and comprehend the text.
- Reduces Eye Strain: Longer lines can cause eye strain and make it difficult to focus on the text.
- Improves Layout: Limiting the length of lines can help to improve the overall layout of the page.
- Makes Text More Accessible: Shorter lines make text more accessible, especially for those with visual impairments.
Non-compliant Code Example
function GetCompleteCustomerDetails(customerId In INTEGER)
return CUSTOMER_T
Is
BEGIN
Select FIRSTNAME, LASTNAME, AREA, CITY Into CUSTOMER_T.FirstName, CUSTOMER_T.LastName, CUSTOMER_T.Area, CUSTOMER_T.City FROM CUSTOMERS Where Id = customerId; --Non compliant code (Line length is more than default defined limit of 100 characters)
RETURN CUSTOMER_T;
END GetCompleteCustomerDetails
Compliant Code Example
function GetCompleteCustomerDetails(customerId In INTEGER)
return CUSTOMER_T
Is
BEGIN
Select FIRSTNAME, --Compliant code (Line length is less than default defined limit of 100 characters )
LASTNAME,
AREA,
CITY
Into CUSTOMER_T.FirstName,
CUSTOMER_T.LastName,
CUSTOMER_T.Area,
CUSTOMER_T.City
FROM CUSTOMERS
Where Id = customerId;
RETURN CUSTOMER_T;
END GetCompleteCustomerDetails