Skip to content

Commit b79132d

Browse files
SONARJAVA-3727 Update rules metadata (#3496)
1 parent c4cd1c7 commit b79132d

31 files changed

+125
-112
lines changed

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1120_java.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"constantCost": "1min"
88
},
99
"tags": [
10-
"style"
10+
"convention"
1111
],
1212
"defaultSeverity": "Minor",
1313
"ruleSpecification": "RSPEC-1120",

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S122_java.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"constantCost": "1min"
88
},
99
"tags": [
10-
"style"
10+
"convention"
1111
],
1212
"defaultSeverity": "Major",
1313
"ruleSpecification": "RSPEC-122",

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1314_java.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
have experience with them. They may not recognize octal values as such, mistaking them instead for decimal values.</p>
33
<h2>Noncompliant Code Example</h2>
44
<pre>
5-
int myNumber = 010; // Noncompliant. myNumber will hold 8, not 10 - was this really expected?
5+
int myNumber = 010; // Noncompliant. myNumber will hold 8, not 10 - was this really expected?
66
</pre>
77
<h2>Compliant Solution</h2>
88
<pre>

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2111_java.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<p>Because of floating point imprecision, you're unlikely to get the value you expect from the <code>BigDecimal(double)</code> constructor. </p>
22
<p>From <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#BigDecimal(double)">the JavaDocs</a>:</p>
33
<blockquote>
4-
The results of this constructor can be somewhat unpredictable. One might assume that writing new BigDecimal(0.1) in Java creates a BigDecimal which
5-
is exactly equal to 0.1 (an unscaled value of 1, with a scale of 1), but it is actually equal to
4+
<p>The results of this constructor can be somewhat unpredictable. One might assume that writing new BigDecimal(0.1) in Java creates a BigDecimal
5+
which is exactly equal to 0.1 (an unscaled value of 1, with a scale of 1), but it is actually equal to
66
0.1000000000000000055511151231257827021181583404541015625. This is because 0.1 cannot be represented exactly as a double (or, for that matter, as a
77
binary fraction of any finite length). Thus, the value that is being passed in to the constructor is not exactly equal to 0.1, appearances
8-
notwithstanding.
8+
notwithstanding.</p>
99
</blockquote>
1010
<p>Instead, you should use <code>BigDecimal.valueOf</code>, which uses a string under the covers to eliminate floating point rounding errors, or the
1111
constructor that takes a <code>String</code> argument.</p>

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2165_java.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ <h2>Noncompliant Code Example</h2>
88
@Override
99
void finalize() {
1010
name = null; // Noncompliant; completely unnecessary
11+
}
12+
}
1113
</pre>
1214

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2658_java.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,10 @@
77
"constantCost": "45min"
88
},
99
"tags": [
10-
"cwe",
11-
"owasp-a1"
10+
1211
],
1312
"defaultSeverity": "Critical",
1413
"ruleSpecification": "RSPEC-2658",
1514
"sqKey": "S2658",
16-
"scope": "Main",
17-
"securityStandards": {
18-
"CWE": [
19-
470
20-
],
21-
"OWASP": [
22-
"A1"
23-
]
24-
}
15+
"scope": "Main"
2516
}

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2786_java.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<p>According to <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.9">the Java Language Specification-8.9</a>:</p>
22
<blockquote>
3-
Nested enum types are implicitly
4-
<code>static</code>.
3+
<p>Nested enum types are implicitly <code>static</code>.</p>
54
</blockquote>
65
<p>So there's no need to declare them <code>static</code> explicitly.</p>
76
<h2>Noncompliant Code Example</h2>

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2975_java.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<p>Many consider <code>clone</code> and <code>Cloneable</code> broken in Java, largely because the rules for overriding <code>clone</code> are tricky
22
and difficult to get right, according to Joshua Bloch:</p>
33
<blockquote>
4-
Object's clone method is very tricky. It's based on field copies, and it's "extra-linguistic." It creates an object without calling a constructor.
5-
There are no guarantees that it preserves the invariants established by the constructors. There have been lots of bugs over the years, both in and
6-
outside Sun, stemming from the fact that if you just call super.clone repeatedly up the chain until you have cloned an object, you have a shallow
7-
copy of the object. The clone generally shares state with the object being cloned. If that state is mutable, you don't have two independent objects.
8-
If you modify one, the other changes as well. And all of a sudden, you get random behavior.
4+
<p>Object's clone method is very tricky. It's based on field copies, and it's "extra-linguistic." It creates an object without calling a
5+
constructor. There are no guarantees that it preserves the invariants established by the constructors. There have been lots of bugs over the years,
6+
both in and outside Sun, stemming from the fact that if you just call super.clone repeatedly up the chain until you have cloned an object, you have
7+
a shallow copy of the object. The clone generally shares state with the object being cloned. If that state is mutable, you don't have two
8+
independent objects. If you modify one, the other changes as well. And all of a sudden, you get random behavior. </p>
99
</blockquote>
1010
<p>A copy constructor or copy factory should be used instead.</p>
1111
<p>This rule raises an issue when <code>clone</code> is overridden, whether or not <code>Cloneable</code> is implemented.</p>

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S3281_java.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p>Default interceptors, such as application security interceptors, must be listed in the <code>ejb-jar.xml</code> file, or they will not be treated
2-
as default. </p>
2+
as default.</p>
33
<p>This rule applies to projects that contain JEE Beans (any one of <code>javax.ejb.Singleton</code>, <code>MessageDriven</code>,
44
<code>Stateless</code> or <code>Stateful</code>).</p>
55
<h2>Noncompliant Code Example</h2>
@@ -8,7 +8,7 @@ <h2>Noncompliant Code Example</h2>
88
&lt;assembly-descriptor&gt;
99
&lt;interceptor-binding&gt; &lt;!-- should be declared in ejb-jar.xml --&gt;
1010
&lt;ejb-name&gt;*&lt;/ejb-name&gt;
11-
&lt;interceptor-class&gt;com.myco.ImportantInterceptor&lt;/interceptor-class&gt;&lt;!-- Noncompliant; will NOT be treated as default --&gt;
11+
&lt;interceptor-class&gt;com.myco.ImportantInterceptor&lt;/interceptor-class&gt; &lt;!-- Noncompliant; will NOT be treated as default --&gt;
1212
&lt;/interceptor-binding&gt;
1313
&lt;/assembly-descriptor&gt;
1414
</pre>

java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S3369_java.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ <h2>See</h2>
88
</ul>
99
<h2>Deprecated</h2>
1010
<p>This rule is deprecated, and will eventually be removed.</p>
11-
11+

0 commit comments

Comments
 (0)