Modify rule S1134: Update to LaYC (#2189)

I removed abap, flex, pli and rpg dummy implementations since they're
not implemented in the corresponding analyzer and there are no tickets
open to do so.
This commit is contained in:
Cristian Ambrosini 2023-06-14 14:23:44 +02:00 committed by GitHub
parent afefc85dac
commit aaa468bf3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 199 additions and 630 deletions

View File

@ -1,3 +0,0 @@
{
}

View File

@ -1,16 +0,0 @@
include::../rule.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]

View File

@ -0,0 +1,6 @@
[source,apex]
----
Integer divide(Integer numerator, Integer denominator) {
return numerator / denominator; // FIXME denominator value might be 0
}
----

View File

@ -1,29 +1,3 @@
== Why is this an issue?
:nonCompliantExample: apex/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,apex]
----
Integer divide(Integer numerator, Integer denominator) {
return numerator / denominator; // FIXME denominator value might be 0
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,7 @@
[source,cpp]
----
int Divide(int numerator, int denominator)
{
return numerator / denominator; // FIXME denominator value might be 0
}
----

View File

@ -1,16 +1,3 @@
include::../rule.adoc[]
:nonCompliantExample: cfamily/non-compliant-example.adoc
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,4 @@
[source,cobol]
----
DIVIDE 5 BY DIVISOR GIVING QUOTIENT. *> FIXME ensure DIVISOR is not zero
----

View File

@ -1,27 +1,3 @@
== Why is this an issue?
:nonCompliantExample: cobol/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,cobol]
----
DIVIDE 5 BY DIVISOR GIVING QUOTIENT. *> FIXME ensure DIVISOR is not zero
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -1,15 +0,0 @@
=== on 23 Jul 2013, 13:08:27 Dinesh Bolkensteyn wrote:
Implemented by \http://jira.codehaus.org/browse/SONARJAVA-221
=== on 7 Jan 2014, 11:13:23 Freddy Mallet wrote:
Implemented by \http://jira.codehaus.org/browse/SONARPLUGINS-3369 for JavaScript
=== on 23 Feb 2014, 23:43:23 Freddy Mallet wrote:
Is implemented by \http://jira.codehaus.org/browse/SONARPLUGINS-3517 for PHP
=== on 26 Nov 2015, 10:41:04 Elena Vilchik wrote:
\[~ann.campbell.2] Why there is no SQALE for this rule? (and for RSPEC-1135 too)
=== on 30 Nov 2015, 16:31:09 Ann Campbell wrote:
\[~elena.vilchik] because it could only be a guess; there's no way of knowing whether what needs fixing is related to security or maintainability.

View File

@ -0,0 +1,7 @@
[source,csharp]
----
private int Divide(int numerator, int denominator)
{
return numerator / denominator; // FIXME denominator value might be 0
}
----

View File

@ -1,30 +1,3 @@
== Why is this an issue?
:nonCompliantExample: csharp/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,csharp]
----
private int Divide(int numerator, int denominator)
{
return numerator / denominator; // FIXME denominator value might be 0
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -1,5 +0,0 @@
``++FIXME++`` tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.
Sometimes the developer will not have the time or will simply forget to get back to that tag.
This rule is meant to track those tags and to ensure that they do not go unnoticed.

View File

@ -1,3 +0,0 @@
{
}

View File

@ -1,16 +0,0 @@
include::../rule.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]

View File

@ -0,0 +1,6 @@
[source,go]
----
func foo() {
// FIXME
}
----

View File

@ -1,29 +1,3 @@
== Why is this an issue?
:nonCompliantExample: go/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,go]
----
func foo() {
// FIXME
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,7 @@
[source,html]
----
<html>
<!-- FIXME support small device -->
...
</html>
----

View File

@ -1,30 +1,3 @@
== Why is this an issue?
:nonCompliantExample: html/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,html]
----
<html>
<!-- FIXME support small device -->
...
</html>
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,6 @@
[source,java]
----
int divide(int numerator, int denominator) {
return numerator / denominator; // FIXME denominator value might be 0
}
----

View File

@ -1,29 +1,3 @@
== Why is this an issue?
:nonCompliantExample: java/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,java]
----
int divide(int numerator, int denominator) {
return numerator / denominator; // FIXME denominator value might be 0
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,6 @@
[source,javascript]
----
function divide(numerator, denominator) {
return numerator / denominator; // FIXME denominator value might be 0
}
----

View File

@ -1,29 +1,3 @@
== Why is this an issue?
:nonCompliantExample: javascript/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,javascript]
----
function divide(numerator, denominator) {
return numerator / denominator; // FIXME denominator value might be 0
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,5 @@
[source,kotlin]
----
// FIXME denominator value might be 0
fun divide(numerator: Int, denominator: Int): Int = numerator / denominator
----

View File

@ -1,28 +1,3 @@
== Why is this an issue?
:nonCompliantExample: kotlin/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,kotlin]
----
// FIXME denominator value might be 0
fun divide(numerator: Int, denominator: Int): Int = numerator / denominator
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -1,4 +0,0 @@
=== Message
Take the required action to fix the issue indicated by this "FIXME" comment.

View File

@ -29,5 +29,5 @@
"defaultQualityProfiles": [
"Sonar way"
],
"quickfix": "unknown"
"quickfix": "infeasible"
}

View File

@ -0,0 +1,6 @@
[source,php]
----
function divide($numerator, $denominator) {
return $numerator / $denominator; // FIXME denominator value might be 0
}
----

View File

@ -1,29 +1,3 @@
== Why is this an issue?
:nonCompliantExample: php/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,php]
----
function divide($numerator, $denominator) {
return $numerator / $denominator; // FIXME denominator value might be 0
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -1,3 +0,0 @@
{
}

View File

@ -1,16 +0,0 @@
include::../rule.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]

View File

@ -0,0 +1,5 @@
[source,sql]
----
CREATE TABLE mytable(col1 INTEGER NOT NULL);
INSERT INTO mytable VALUES (value) -- FIXME ensure value is not null
----

View File

@ -1,28 +1,3 @@
== Why is this an issue?
:nonCompliantExample: plsql/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,sql]
----
CREATE TABLE mytable(col1 INTEGER NOT NULL);
INSERT INTO mytable VALUES (value) -- FIXME ensure value is not null
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,5 @@
[source,python]
----
def divide(numerator, denominator):
return numerator / denominator # FIXME denominator value might be 0
----

View File

@ -1,28 +1,3 @@
== Why is this an issue?
:nonCompliantExample: python/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,python]
----
def divide(numerator, denominator):
return numerator / denominator # FIXME denominator value might be 0
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,5 @@
== Resources
=== Documentation
* https://cwe.mitre.org/data/definitions/546[MITRE, CWE-546 - Suspicious Comment]

View File

@ -1,3 +0,0 @@
{
}

View File

@ -1,16 +0,0 @@
include::../rule.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]

View File

@ -0,0 +1,36 @@
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Take the required action to fix the issue indicated by this "FIXME" comment.
'''
== Comments And Links
(visible only on this page)
=== on 23 Jul 2013, 13:08:27 Dinesh Bolkensteyn wrote:
Implemented by \http://jira.codehaus.org/browse/SONARJAVA-221
=== on 7 Jan 2014, 11:13:23 Freddy Mallet wrote:
Implemented by \http://jira.codehaus.org/browse/SONARPLUGINS-3369 for JavaScript
=== on 23 Feb 2014, 23:43:23 Freddy Mallet wrote:
Is implemented by \http://jira.codehaus.org/browse/SONARPLUGINS-3517 for PHP
=== on 26 Nov 2015, 10:41:04 Elena Vilchik wrote:
\[~ann.campbell.2] Why there is no SQALE for this rule? (and for RSPEC-1135 too)
=== on 30 Nov 2015, 16:31:09 Ann Campbell wrote:
\[~elena.vilchik] because it could only be a guess; there's no way of knowing whether what needs fixing is related to security or maintainability.
=== on 30 Nov 2023, 16:31:09 Ann Campbell wrote:
\[~elena.vilchik] because it could only be a guess; there's no way of knowing whether what needs fixing is related to security or maintainability.
=== on 14 June 2023, 13:10:00 Cristian Ambrosini wrote:
During a LaYC sprint, I removed abap, flex, pli and rpg dummy implementations, since they're not implemented in the corresponding analyzer and there are no tickets open to do so.
endif::env-github,rspecator-view[]

View File

@ -0,0 +1,6 @@
[source,ruby]
----
def divide(numerator, denominator)
return numerator / denominator # FIXME denominator value might be 0
end
----

View File

@ -1,29 +1,3 @@
== Why is this an issue?
:nonCompliantExample: ruby/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,ruby]
----
def divide(numerator, denominator)
return numerator / denominator # FIXME denominator value might be 0
end
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -1,16 +1,13 @@
== Why is this an issue?
include::description.adoc[]
`FIXME` tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.
=== Noncompliant code example
Sometimes the developer will not have the time or will simply forget to get back to that tag.
[source,text]
----
int divide(int numerator, int denominator) {
return numerator / denominator; // FIXME denominator value might be 0
}
----
This rule is meant to track those tags and to ensure that they do not go unnoticed.
include::{nonCompliantExample}[]
include::see.adoc[]
include::resources.adoc[]
include::rspecator.adoc[]

View File

@ -0,0 +1,4 @@
[source,scala]
----
var result = numerator / denominator // FIXME denominator value might be 0
----

View File

@ -1,27 +1,3 @@
== Why is this an issue?
:nonCompliantExample: scala/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,scala]
----
var result = numerator / denominator // FIXME denominator value might be 0
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -1,3 +0,0 @@
== Resources
* https://cwe.mitre.org/data/definitions/546[MITRE, CWE-546] - Suspicious Comment

View File

@ -0,0 +1,6 @@
[source,swift]
----
func divide(numerator:Int, denominator:Int) -> Int {
return numerator / denominator // FIXME denominator value might be 0
}
----

View File

@ -1,29 +1,3 @@
== Why is this an issue?
:nonCompliantExample: swift/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,swift]
----
func divide(numerator:Int, denominator:Int) -> Int {
return numerator / denominator // FIXME denominator value might be 0
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,5 @@
[source,sql]
----
CREATE TABLE notnull(col1 INTEGER NOT NULL)
INSERT notnull VALUES (@value) -- FIXME ensure @value is not null
----

View File

@ -1,28 +1,3 @@
== Why is this an issue?
:nonCompliantExample: tsql/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,sql]
----
CREATE TABLE notnull(col1 INTEGER NOT NULL)
INSERT notnull VALUES (@value) -- FIXME ensure @value is not null
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,7 @@
[source,vb6]
----
Rem FIXME: Add documentation - Noncompliant
Function Divide(ByVal Numerator As Integer, ByVal Denominator As Integer) As Integer
Divide = Numerator / Denominator ' FIXME: Denominator value might be 0 - Noncompliant
End Function
----

View File

@ -1,30 +1,3 @@
== Why is this an issue?
:nonCompliantExample: vb6/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,vb6]
----
Rem FIXME: Add documentation - Noncompliant
Function Divide(ByVal Numerator As Integer, ByVal Denominator As Integer) As Integer
Divide = Numerator / Denominator ' FIXME: Denominator value might be 0 - Noncompliant
End Function
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,6 @@
[source,vbnet]
----
Function Divide(numerator As Integer, denominator As Integer) As Integer
Return numerator / denominator ' FIXME denominator value might be 0
End Function
----

View File

@ -1,29 +1,3 @@
== Why is this an issue?
:nonCompliantExample: vbnet/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,vbnet]
----
Function Divide(ByVal numerator As Integer, ByVal denominator As Integer) As Integer
Return numerator / denominator ' FIXME denominator value might be 0
End Function
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]

View File

@ -0,0 +1,9 @@
[source,xml]
----
<!-- FIXME we should update version to 3.8.1 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
</dependency>
----

View File

@ -1,32 +1,3 @@
== Why is this an issue?
:nonCompliantExample: xml/non-compliant-example.adoc
include::../description.adoc[]
=== Noncompliant code example
[source,xml]
----
<!-- FIXME we should update version to 3.8.1 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
</dependency>
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
include::../rule.adoc[]