Home
Files should not have too many lines of code
Rule description
- Files should not have too many lines of code
Non-compliant Code Example
Create PROCEDURE [DATA].INIT --Non compliant code (File is having more than default limit of 100 line of code)
@orderId int,
@productId int,
@emp_Id int,
@cust_id int
AS
BEGIN
EXEC [DATA].GetAllOrders;
EXEC [DATA].LogCleaner;
EXEC [DATA].sp_customer_List;
EXEC [DATA].sp_retrieve_employees;
EXEC [DATA].GetAllProducts;
EXEC [DATA].GetOrderById @orderId;
EXEC [DATA].GetAllItems @orderId;
EXEC [DATA].GetProductById @productId;
EXEC [DATA].LogCleaner;
EXEC [DATA].GetManagerOfEmployeeById @emp_Id;
EXEC [DATA].DeleteCustomerById @cust_id;
EXEC [DATA].DeleteOrderById @orderId;
EXEC [DATA].DeleteOrderItemById @orderId;
EXEC [DATA].DeleteProductById @productId;
Declare @fname nvarchar(50);
Declare @lname nvarchar(50);
BEGIN
SET @fname = "Mark";
SET @lname = "Pencile";
EXEC [DATA].sp_GetFullname @fname,@lname;
EXEC [DATA].InsertCustomer @fname,@lname;
END
BEGIN
SET @fname = "James";
SET @lname = "Smith";
EXEC [DATA].InsertEmployee @fname,@lname;
END
BEGIN
SET @fname = "Maria";
SET @lname = "Garcia";
EXEC [DATA].UpdateCustomerName @cust_id,@fname,@lname;
END
BEGIN
SET @fname = "Maria";
SET @lname = "Hernandez";
EXEC [DATA].UpdateEmployeeName @emp_Id,@fname,@lname;
END
BEGIN
Declare @price int;
SET @price = 200;
EXEC [DATA].UpdateProductPrice @productId,@price;
END
BEGIN
-- Query the Product and Customer table by using the synonym.
Select * from [DATA].CloneProduct;
Select * from [DATA].CloneCustomer;
INSERT INTO [DATA].CloneCustomer (fname, lname) VALUES (@fname, @lname);
SET @fname = "Maria";
SET @lname = "Hernandez";
UPDATE [DATA].CloneCustomer
SET FNAME=@fname, LNAME=@lname
WHERE Id = @cust_id;
DELETE [DATA].CloneCustomer where ID = @cust_id;
END
BEGIN
-- Query the Product table by using the sequences.
SELECT NEXT VALUE FOR [DATA].ProductSeq;
END
END
GO