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
Line | Column | Message |
---|---|---|
2 | 36 |
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.
Parameter | Description | Default Value |
---|---|---|
AllowNosonarMarkers | Comma-separated list of rules for which a NOSONAR marker is allowed. | Core G-1910, Core G-1920, Core G-7460 |
References
- same as Trivadis G-0000
G-0000 is not explicitly documented as a guideline. However, it is used within the db* CODECOP product suite.
- same as plsql:NoSonarCheck