rules repository

G-1910

🆓
Info

Avoid using the NOSONAR marker.

Reason

The NOSONAR marker is helpful to quickly exclude false positives. But when used often and increasingly this is a potential sign of hidden quality issues.

Examples

Non-Compliant Example

declare
   l_value pls_integer := null; -- NOSONAR G-2140: False positive
begin
   sys.dbms_output.put_line(l_value);
end;
/
Issues
LineColumnMessage
236NOSONAR marker.

Hides the G-2140 violation (Never initialize variables with NULL).

Compliant Solution - ★★★☆☆

declare
   l_value pls_integer := null;
begin
   sys.dbms_output.put_line(l_value);
end;
/

The NOSONAR marker is removed. The G-2140 violation is not hidden anymore.

Compliant Solution - ★★★★★

declare
   l_value pls_integer;
begin
   sys.dbms_output.put_line(l_value);
end;
/

The G-2140 violation is resolved. Code is not unnecessarily initialized with null anymore.

Parameters

Use parameters to customize the rule to your needs.

ParameterDescriptionDefault Value
AllowNosonarMarkersComma-separated list of rules for which a NOSONAR marker is allowed.Core G-1910, Core G-1920, Core G-7460

References