Home
Unused procedure and function parameters should be removed
Description
This rule states that any procedure or function parameters that are not used within the code should be removed. This helps to reduce unnecessary clutter and complexity in the code, while also making it easier to read and understand. Additionally, it can help to ensure that the code is performing optimally by eliminating any unused parameters that may be slowing down the execution time. Removing unused parameters can also help to reduce the risk of potential security vulnerabilities, as any potential attackers would have fewer parameters to exploit.
Key Benefits
- Reduced complexity: Removing unused parameters reduces the complexity of the procedure or function, making it easier to understand and maintain.
- Increased performance: Unused parameters can cause unnecessary overhead, so removing them can improve performance.
- Cleaner code: Removing unused parameters makes the code cleaner and more readable.
Non-compliant Code Example
CREATE FUNCTION [DATA].CheckCustomer
(@customer_Id int) --Non compliant code (Unused parameter)
RETURNS bit
AS
BEGIN
DECLARE @isChecked bit
SET @isChecked = 1
-- Check the employee
RETURN @isChecked
END