diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1068_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1068_java.html index c41a8898274..ba7affc60f8 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1068_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1068_java.html @@ -1,5 +1,7 @@
If a private
field is declared but not used in the program, it can be considered dead code and should therefore be removed. This will
improve maintainability because developers will not wonder what the variable is used for.
Note that this rule does not take reflection into account, which means that issues will be raised on private
fields that are only
+accessed using the reflection API.
public class MyClass { @@ -30,7 +32,7 @@-Exceptions
private static final long serialVersionUID = 42L; }
Moreover, this rule doesn't raise any issue on annotated fields.
+Moreover, this rule doesn't raise any issue on annotated fields.
Generic exceptions in the signatures of overriding methods are ignored.
+Generic exceptions in the signatures of overriding methods are ignored, because overriding method has to follow signature of the throw declaration +in the superclass. The issue will be raised on superclass declaration of the method (or won't be raised at all if superclass is not part of the +analysis).
@Override public void myMethod() throws Exception {...}+
Generic exceptions are also ignored in the signatures of methods that make calls to methods that throw generic exceptions.
++public void myOtherMethod throws Exception { + doTheThing(); // this method throws Exception +} +
private
methods that are never executed are dead code: unnecessary, inoperative code that should be removed. Cleaning out dead code
decreases the size of the maintained codebase, making it easier to understand the program and preventing bugs from being introduced.
Note that this rule does not take reflection into account, which means that issues will be raised on private
methods that are only
+accessed using the reflection API.
public class Foo implements Serializable @@ -30,7 +32,7 @@Compliant Solution
}
This rule doesn't raise any issue on annotated methods.
+This rule doesn't raise any issue on annotated methods.
UnsupportedOperationException
should be thrown. @@ -27,10 +25,10 @@Compliant Solution
}
An abstract class may have empty methods, in order to provide default implementations for child classes.
+Default (no-argument) constructors are ignored when there are other constructors in the class, as are empty methods in abstract classes.
public abstract class Animal { - void speak() { + void speak() { // default implementation ignored } }diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1226_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1226_java.html index a2cf028c38a..70f9308d243 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1226_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1226_java.html @@ -1,10 +1,7 @@ -
While it is technically correct to assign to parameters from within method bodies, it is typically done in error, with the intent to assign a
-parameter value to a field of the same name, (and this
was forgotten).
If it is done on purpose, a better course would be to use temporary variables to store intermediate results. Allowing parameters to be assigned to
-also reduces code readability because developers won't be able to tell whether the original parameter or some temporary variable is being accessed
-without going through the whole method. Moreover, some developers might also expect assignments of method parameters to be visible to callers, which
-is not the case, and this lack of visibility could confuse them. Instead, all parameters, caught exceptions, and foreach parameters should be treated
-as final
.
While it is technically correct to assign to parameters from within method bodies, it reduces code readability because developers won't be able to
+tell whether the original parameter or some temporary variable is being accessed without going through the whole method. Moreover, some developers
+might also expect assignments of method parameters to be visible to callers, which is not the case, and this lack of visibility could confuse them.
+Instead, all parameters, caught exceptions, and foreach parameters should be treated as final
.
class MyClass { diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1226_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1226_java.json index e542ad03e5b..5915b7b7591 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1226_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1226_java.json @@ -1,13 +1,12 @@ { "title": "Method parameters, caught exceptions and foreach variables should not be reassigned", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "bug", "misra", "pitfall" ], diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1264_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1264_java.html index 366b415a596..5417c90ff82 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1264_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1264_java.html @@ -1,5 +1,5 @@ -When only the condition expression is defined in a
+for
loop, but the init and increment expressions are missing, awhile
-loop should be used instead to increase readability.When only the condition expression is defined in a
for
loop, and the initialization and increment expressions are missing, a +while
loop should be used instead to increase readability.Noncompliant Code Example
for (;condition;) { /*...*/ } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S135_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S135_java.json index 0826aba0d9b..f8f12af6eba 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S135_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S135_java.json @@ -10,5 +10,5 @@ "tags": [ "brain-overload" ], - "defaultSeverity": "Major" + "defaultSeverity": "Minor" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1541_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1541_java.html index df16c3f04a0..acab16da505 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1541_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1541_java.html @@ -1,3 +1,6 @@The cyclomatic complexity of methods should not exceed a defined threshold.
Complex code can perform poorly and will in any case be difficult to understand and therefore to maintain.
+Exceptions
+While having a large number of fields in a class may indicate that it should be split, this rule nonetheless ignores high complexity in +
diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1640_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1640_java.json index ed7b517de8b..83da825592b 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1640_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1640_java.json @@ -1,14 +1,13 @@ { "title": "Maps with keys that are enum values should be replaced with EnumMap", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "performance", - "bug" + "performance" ], "defaultSeverity": "Minor" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1641_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1641_java.json index 98179967d8e..3bcdae706a3 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1641_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1641_java.json @@ -1,14 +1,13 @@ { "title": "Sets with elements that are enum values should be replaced with EnumSet", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "performance", - "bug" + "performance" ], "defaultSeverity": "Minor" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1643_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1643_java.json index 99ddd147f26..a9684395b4f 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1643_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1643_java.json @@ -1,14 +1,13 @@ { "title": "Strings should not be concatenated using '+' in a loop", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "10min" }, "tags": [ - "performance", - "bug" + "performance" ], "defaultSeverity": "Minor" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1656_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1656_java.json index 3ef0b61d7ba..c1d5fd9a252 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1656_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1656_java.json @@ -7,7 +7,6 @@ "constantCost": "3min" }, "tags": [ - "bug", "cert" ], "defaultSeverity": "Major" diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1815_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1815_java.html deleted file mode 100644 index 7fff724bc32..00000000000 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S1815_java.html +++ /dev/null @@ -1,9 +0,0 @@ -equals
andhashCode
methods.Protected methods that are never used by any of the classes in the same project are suspected to be dead code. Dead code is unnecessary, -inoperative code that should be removed. Removing dead code makes maintenance easier by decreasing the size of the maintained code base, thereby -making it easier to understand the program and preventing the introduction of bugs.
-Unused protected methods are not considered dead code in the following cases:
-
PrintWriter(OutputStream out, boolean autoFlush)
PrintWriter(String fileName)
IOUtils
methods which accept an encoding argument when that argument is null, and overloads of those methods that omit the
- encoding argument IOUtils.copy(InputStream, Writer)
IOUtils.copy(Reader, OutputStream)
IOUtils.readLines(InputStream)
IOUtils.toByteArray(Reader)
IOUtils.toByteArray(String)
IOUtils.toCharArray(InputStream)
IOUtils.toInputStream(TypeCriteria.subtypeOf(CharSequence))
IOUtils.toString(byte[])
IOUtils.toString(URI)
IOUtils.toString(URL)
IOUtils.write(char[], OutputStream)
IOUtils.write(CharSequence, OutputStream)
IOUtils.writeLines(Collection, String, OutputStream)
FileUtils.readFileToString(File)
FileUtils.readLines(File)
FileUtils.write(File, CharSequence)
FileUtils.write(File, CharSequence, boolean)
FileUtils.writeStringToFile(File, String)
The MD5 algorithm and its successor, SHA-1, are no longer considered secure, because it is too easy to create hash collisions with them. That is, it takes too little computational effort to come up with a different input that produces the same MD5 or SHA-1 hash, and using the new, same-hash value gives an attacker the same access as if he had the originally-hashed value. This applies as well to the other Message-Digest algorithms: MD2, -MD4, MD6.
-This rule tracks usage of the java.security.MessageDigest
, and org.apache.commons.codec.digest.DigestUtils
classes to
-instantiate MD or SHA-1 algorithms, and of Guava's com.google.common.hash.Hashing sha1
and md5
methods.
The following APIs are tracked for use of obsolete crypto algorithms:
+ * java.security.AlgorithmParameters
(JDK)
* java.security.AlgorithmParameterGenerator
(JDK)
* java.security.MessageDigest
(JDK)
* java.security.KeyFactory
(JDK)
* java.security.KeyPairGenerator
(JDK)
* java.security.Signature
(JDK)
* javax.crypto.Mac
(JDK)
* javax.crypto.KeyGenerator
(JDK)
* org.apache.commons.codec.digest.DigestUtils
(Apache Commons Codec)
* com.google.common.hash.Hashing
(Guava)
MessageDigest md = MessageDigest.getInstance("SHA1"); // Noncompliant @@ -12,10 +21,6 @@Compliant Solution
MessageDigest md = MessageDigest.getInstance("SHA-256");-or
--Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); -See
Applications that execute SQL commands should neutralize any externally-provided values used in those commands. Failure to do so could allow an attacker to include input that changes the query so that unintended commands are executed, or sensitive data is exposed.
-This rule checks that method parameters are not used directly in non-Hibernate SQL statements, and that parameter binding, rather than -concatenation is used in Hibernate statements.
+This rule checks a variety of methods from different frameworks which are susceptible to SQL injection if not used properly. Frameworks which are +covered are Java JDBC, JPA, JDO, Hibernate and Spring. The following specific method signatures are tested.
+org.hibernate.Session.createQuery
org.hibernate.Session.createSQLQuery
java.sql.Statement.executeQuery
java.sql.Statement.execute
java.sql.Statement.executeUpdate
java.sql.Statement.executeLargeUpdate
java.sql.Statement.addBatch
java.sql.Connection.prepareStatement
java.sql.Connection.prepareCall
java.sql.Connection.nativeSQL
javax.persistence.EntityManager.createNativeQuery
javax.persistence.EntityManager.createQuery
org.springframework.jdbc.core.JdbcOperations.batchUpdate
org.springframework.jdbc.core.JdbcOperations.execute
org.springframework.jdbc.core.JdbcOperations.query
org.springframework.jdbc.core.JdbcOperations.queryForList
org.springframework.jdbc.core.JdbcOperations.queryForMap
org.springframework.jdbc.core.JdbcOperations.queryForObject
org.springframework.jdbc.core.JdbcOperations.queryForRowSet
org.springframework.jdbc.core.JdbcOperations.queryForInt
org.springframework.jdbc.core.JdbcOperations.queryForLong
org.springframework.jdbc.core.JdbcOperations.update
org.springframework.jdbc.core.PreparedStatementCreatorFactory.<init>
org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator
javax.jdo.PersistenceManager.newQuery
javax.jdo.Query.setFilter
javax.jdo.Query.setGrouping
If a method is defined in an interface, implementations are also tested. For example this is the case for
+org.springframework.jdbc.core.JdbcOperations
, which is usually used as org.springframework.jdbc.core.JdbcTemplate
).
public User getUser(Connection con, String user) throws SQLException { diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2112_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2112_java.json index 36abf8b1a38..b9758a2af0d 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2112_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2112_java.json @@ -1,14 +1,13 @@ { "title": "\"URL.hashCode\" and \"URL.equals\" should be avoided", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "20min" }, "tags": [ - "performance", - "bug" + "performance" ], "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2129_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2129_java.json index 772339f93a3..c8b581ace12 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2129_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2129_java.json @@ -1,14 +1,13 @@ { "title": "Constructors should not be used to instantiate \"String\" and primitive-wrapper classes", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "performance", - "bug" + "performance" ], - "defaultSeverity": "Minor" + "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2130_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2130_java.html index 9e3741cc054..faf4e4fcd81 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2130_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2130_java.html @@ -4,7 +4,7 @@Noncompliant Code Example
String myNum = "12.2"; -float f = new Float(myNum).floatValue(); // Noncompliant; creates & discards a Float +float f = (new Float(myNum)).floatValue(); // Noncompliant; creates & discards a FloatCompliant Solution
diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2130_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2130_java.json index 9757c1047f3..50d90a2625b 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2130_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2130_java.json @@ -1,14 +1,13 @@ { "title": "Parsing should be used to convert \"Strings\" to primitives", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "performance", - "bug" + "performance" ], "defaultSeverity": "Minor" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2131_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2131_java.html index 82cc32bab9f..8daff16cc0d 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2131_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2131_java.html @@ -5,7 +5,7 @@Noncompliant Code Example
int myInt = 4; -String myIntString = new Integer(myInt).toString(); // Noncompliant; creates & discards an Integer object +String myIntString = (new Integer(myInt)).toString(); // Noncompliant; creates & discards an Integer object myIntString = Integer.valueOf(myInt).toString(); // Noncompliant myIntString = 4 + ""; // Noncompliantdiff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2131_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2131_java.json index 87e898ab5df..669a5d3ff60 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2131_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2131_java.json @@ -1,14 +1,13 @@ { "title": "Primitives should not be boxed just for \"String\" conversion", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "performance", - "bug" + "performance" ], - "defaultSeverity": "Minor" + "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2133_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2133_java.json index da5f2f692fa..366bf8136ff 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2133_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2133_java.json @@ -1,14 +1,13 @@ { "title": "Objects should not be created only to \"getClass\"", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "performance", - "bug" + "performance" ], - "defaultSeverity": "Minor" + "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2178_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2178_java.json index 797f17a9391..c182c3b5f8d 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2178_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2178_java.json @@ -1,14 +1,13 @@ { "title": "Short-circuit logic should be used in boolean contexts", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "bug", "cert" ], - "defaultSeverity": "Major" + "defaultSeverity": "Blocker" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2184_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2184_java.json index 178fbbfa735..33a65a56582 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2184_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2184_java.json @@ -8,6 +8,7 @@ }, "tags": [ "cwe", + "overflow", "bug", "sans-top25-risky", "misra", diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2232_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2232_java.json index 95c1e169b7a..16e50f9fdf6 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2232_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2232_java.json @@ -1,6 +1,6 @@ { "title": "\"ResultSet.isLast()\" should not be used", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", @@ -8,7 +8,6 @@ }, "tags": [ "performance", - "bug", "pitfall", "sql" ], diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2276_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2276_java.html index 183ff670f66..c209fdb57ef 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2276_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2276_java.html @@ -1,4 +1,4 @@ -If
Thread.sleep(...)
is called when the current thread holds a lock, it could lead to performance, and scalability issues, or even +If
Thread.sleep(...)
is called when the current thread holds a lock, it could lead to performance and scalability issues, or even worse to deadlocks because the execution of the thread holding the lock is frozen. It's better to callwait(...)
on the monitor object to temporarily release the lock and allow other threads to run.Noncompliant Code Example
diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2278_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2278_java.html index 1d188499bc8..4a37c4d9d27 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2278_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2278_java.html @@ -4,6 +4,7 @@ provides the security that is needed to protect federal government information.Federal agencies are encouraged to use the Advanced Encryption Standard, a faster and stronger algorithm approved as FIPS 197 in 2001.
+For similar reasons, RC2 should also be avoided.
Noncompliant Code Example
Cipher c = Cipher.getInstance("DESede/ECB/PKCS5Padding"); diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2308_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2308_java.html index f1b9ee72fdc..33ed771e89c 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2308_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2308_java.html @@ -1,7 +1,7 @@Use of
File.deleteOnExit()
is not recommended for the following reasons:
diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2308_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2308_java.json index 3598b00a4a5..102009a137f 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2308_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2308_java.json @@ -1,14 +1,13 @@ { "title": "\"deleteOnExit\" should not be used", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "30min" }, "tags": [ - "performance", - "bug" + "performance" ], - "defaultSeverity": "Minor" + "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2629_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2629_java.json index b4870a2a200..cf4821aa12b 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2629_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2629_java.json @@ -1,14 +1,13 @@ { "title": "\"Preconditions\" and logging arguments should not require evaluation", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "performance", - "bug" + "performance" ], "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2694_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2694_java.json index ef892ead603..99e9a1f73af 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2694_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2694_java.json @@ -1,14 +1,13 @@ { "title": "Inner classes which do not reference their owning classes should be \"static\"", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "15min" }, "tags": [ - "performance", - "bug" + "performance" ], - "defaultSeverity": "Minor" + "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2718_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2718_java.json index 349efb41618..b8c4ee83234 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2718_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2718_java.json @@ -1,6 +1,6 @@ { "title": "\"DateUtils.truncate\" from Apache Commons Lang library should not be used", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", @@ -8,7 +8,6 @@ }, "tags": [ "performance", - "bug", "java8" ], "defaultSeverity": "Major" diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2864_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2864_java.json index 64d50211dd8..4b720f31a30 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2864_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S2864_java.json @@ -1,14 +1,13 @@ { "title": "\"entrySet()\" should be iterated when both the key and value are needed", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "performance", - "bug" + "performance" ], "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3027_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3027_java.json index 5c2e4003616..26abf0cce35 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3027_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3027_java.json @@ -1,6 +1,6 @@ { "title": "String function use should be optimized for single characters", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", @@ -8,8 +8,7 @@ }, "tags": [ "performance", - "bug", "clumsy" ], - "defaultSeverity": "Minor" + "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3047_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3047_java.json index ab38aaddcc7..b9c2aed6d89 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3047_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3047_java.json @@ -1,14 +1,13 @@ { "title": "Multiple loops over the same set should be combined", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "20min" }, "tags": [ - "performance", - "bug" + "performance" ], "defaultSeverity": "Minor" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3346_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3346_java.html index 760126e6a0d..ea9b76e3b71 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3346_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3346_java.html @@ -14,6 +14,4 @@See
This rule is deprecated, and will eventually be removed.
diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3346_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3346_java.json index c3a84dfbdb4..ef677b034ce 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3346_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3346_java.json @@ -1,13 +1,16 @@ { - "title": "\"assert\" should only be used with boolean variables", + "title": "Expressions used in \"assert\" should not produce side effects", "type": "BUG", - "status": "deprecated", + "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - + "cert" + ], + "standards": [ + "CERT" ], "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3631_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3631_java.json index 466c44e4e95..16d9ac0721b 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3631_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3631_java.json @@ -1,14 +1,13 @@ { "title": "\"Arrays.stream\" should be used for primitive arrays", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, "tags": [ - "performance", - "bug" + "performance" ], - "defaultSeverity": "Minor" + "defaultSeverity": "Major" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3725_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3725_java.json index 1e0d2bd57c4..ced9c86faaf 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3725_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3725_java.json @@ -1,6 +1,6 @@ { "title": "Java 8's \"Files.exists\" should not be used", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/Sonar_way_profile.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/Sonar_way_profile.json index 6614e4a6bc9..c8361e5c43e 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/Sonar_way_profile.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/Sonar_way_profile.json @@ -49,7 +49,6 @@ "S1141", "S1143", "S1144", - "S1147", "S1148", "S1149", "S1150", @@ -224,6 +223,7 @@ "S2445", "S2446", "S2447", + "S2583", "S2629", "S2637", "S2638", @@ -260,6 +260,7 @@ "S3066", "S3067", "S3281", + "S3346", "S3355", "S3358", "S3398",