From: Fabrice Bellingard Date: Tue, 15 May 2012 13:43:03 +0000 (+0200) Subject: SONAR-3074 Add new Findbugs 2.0 new rules X-Git-Tag: 3.1~191 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0caeb90df921882572b8963d4851e36852358fa5;p=sonarqube.git SONAR-3074 Add new Findbugs 2.0 new rules --- diff --git a/plugins/sonar-findbugs-plugin/src/main/resources/org/sonar/plugins/findbugs/profile-sonar-way-findbugs.xml b/plugins/sonar-findbugs-plugin/src/main/resources/org/sonar/plugins/findbugs/profile-sonar-way-findbugs.xml index ffa99664c9d..1fc95f1a2ec 100644 --- a/plugins/sonar-findbugs-plugin/src/main/resources/org/sonar/plugins/findbugs/profile-sonar-way-findbugs.xml +++ b/plugins/sonar-findbugs-plugin/src/main/resources/org/sonar/plugins/findbugs/profile-sonar-way-findbugs.xml @@ -1126,4 +1126,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/sonar-findbugs-plugin/src/main/resources/org/sonar/plugins/findbugs/rules.xml b/plugins/sonar-findbugs-plugin/src/main/resources/org/sonar/plugins/findbugs/rules.xml index 4c2de7efcbd..44df2180ea9 100644 --- a/plugins/sonar-findbugs-plugin/src/main/resources/org/sonar/plugins/findbugs/rules.xml +++ b/plugins/sonar-findbugs-plugin/src/main/resources/org/sonar/plugins/findbugs/rules.xml @@ -2751,4 +2751,172 @@ + + + MAJOR + + + + + + + MAJOR + + + + + + + MAJOR + + + + + + + MAJOR + + + + + + + MINOR + + + + + + + MAJOR + + + + + + + MAJOR + + + + + + + MAJOR + + + + + + + MAJOR + + + + + + + MAJOR + + + + + + + MAJOR + + + + + + + MAJOR + + + + + + + MAJOR + + + + + + + CRITICAL + + + + + + + MAJOR + + + + + + + MAJOR + + + + + + + MINOR + + + + + + + MINOR + + + + + + + MAJOR + + + + + + + INFO + + + + + + + INFO + + + + + + + MINOR + + + + + + + MAJOR + + + + + + + CRITICAL + + + + diff --git a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/SonarWayWithFindbugsProfileTest.java b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/SonarWayWithFindbugsProfileTest.java index cec6f6d13bd..0186ca90b37 100644 --- a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/SonarWayWithFindbugsProfileTest.java +++ b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/SonarWayWithFindbugsProfileTest.java @@ -19,14 +19,13 @@ */ package org.sonar.plugins.findbugs; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.number.OrderingComparisons.greaterThan; -import static org.junit.Assert.assertThat; - import org.junit.Test; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.utils.ValidationMessages; +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; + public class SonarWayWithFindbugsProfileTest { @Test @@ -35,7 +34,7 @@ public class SonarWayWithFindbugsProfileTest { SonarWayWithFindbugsProfile sonarWayWithFindbugs = new SonarWayWithFindbugsProfile(importer); ValidationMessages validation = ValidationMessages.create(); RulesProfile profile = sonarWayWithFindbugs.createProfile(validation); - assertThat(profile.getActiveRulesByRepository(FindbugsConstants.REPOSITORY_KEY).size(), greaterThan(300)); + assertThat(profile.getActiveRulesByRepository(FindbugsConstants.REPOSITORY_KEY).size(), is(399)); assertThat(validation.hasErrors(), is(false)); } } diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs.properties index fd373090b75..78db2934d2f 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs.properties @@ -382,3 +382,27 @@ rule.findbugs.DMI_BAD_MONTH.name=Correctness - Bad constant value for month rule.findbugs.MS_MUTABLE_ARRAY.name=Malicious code vulnerability - Field is a mutable array rule.findbugs.SE_INNER_CLASS.name=Bad practice - Serializable inner class rule.findbugs.OS_OPEN_STREAM_EXCEPTION_PATH.name=Bad practice - Method may fail to close stream on exception +rule.findbugs.AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION.name=Sequence of calls to concurrent abstraction may not be atomic +rule.findbugs.BX_UNBOXING_IMMEDIATELY_REBOXED.name=Boxed value is unboxed and then immediately reboxed +rule.findbugs.CO_COMPARETO_RESULTS_MIN_VALUE.name=compareTo()/compare() returns Integer.MIN_VALUE +rule.findbugs.DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD.name=Dead store to local variable that shadows field +rule.findbugs.DMI_ARGUMENTS_WRONG_ORDER.name=Reversed method arguments +rule.findbugs.DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE.name=BigDecimal constructed from double that isn't represented precisely +rule.findbugs.DMI_DOH.name=D'oh! A nonsensical method invocation +rule.findbugs.DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS.name=Adding elements of an entry set may fail due to reuse of Entry objects +rule.findbugs.DM_DEFAULT_ENCODING.name=Reliance on default encoding +rule.findbugs.ICAST_INT_2_LONG_AS_INSTANT.name=int value converted to long and used as absolute time +rule.findbugs.INT_BAD_COMPARISON_WITH_INT_VALUE.name=Bad comparison of int value with long constant +rule.findbugs.JML_JSR166_CALLING_WAIT_RATHER_THAN_AWAIT.name=Using monitor style wait methods on util.concurrent abstraction +rule.findbugs.NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD.name=Read of unwritten public or protected field +rule.findbugs.OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE.name=Method may fail to clean up stream or resource on checked exception +rule.findbugs.PZ_DONT_REUSE_ENTRY_OBJECTS_IN_ITERATORS.name=Don't reuse entry objects in iterators +rule.findbugs.RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE.name=Code checks for specific values returned by compareTo +rule.findbugs.RV_NEGATING_RESULT_OF_COMPARETO.name=Negating the result of compareTo()/compare() +rule.findbugs.RV_RETURN_VALUE_IGNORED_INFERRED.name=Method ignores return value, is this OK? +rule.findbugs.SA_LOCAL_SELF_ASSIGNMENT_INSTEAD_OF_FIELD.name=Self assignment of local rather than assignment to field +rule.findbugs.URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD.name=Unread public/protected field +rule.findbugs.UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD.name=Unused public or protected field +rule.findbugs.UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD.name=Unwritten public or protected field +rule.findbugs.VA_FORMAT_STRING_USES_NEWLINE.name=Format string should use %n rather than \n +rule.findbugs.VO_VOLATILE_INCREMENT.name=An increment to a volatile field isn't atomic diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION.html new file mode 100644 index 00000000000..74cc5af6bdf --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION.html @@ -0,0 +1 @@ +

This code contains a sequence of calls to a concurrent abstraction (such as a concurrent hash map). These calls will not be executed atomically.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/BX_UNBOXING_IMMEDIATELY_REBOXED.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/BX_UNBOXING_IMMEDIATELY_REBOXED.html new file mode 100644 index 00000000000..89a888cafc9 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/BX_UNBOXING_IMMEDIATELY_REBOXED.html @@ -0,0 +1 @@ +

A boxed value is unboxed and then immediately reboxed.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/CO_COMPARETO_RESULTS_MIN_VALUE.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/CO_COMPARETO_RESULTS_MIN_VALUE.html new file mode 100644 index 00000000000..a36b96fa453 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/CO_COMPARETO_RESULTS_MIN_VALUE.html @@ -0,0 +1,5 @@ +

In some situation, this compareTo or compare method returns the constant Integer.MIN_VALUE, +which is an exceptionally bad practice. The only thing that matters about the return value of +compareTo is the sign of the result. But people will sometimes negate the return value of compareTo, +expecting that this will negate the sign of the result. And it will, except in the case where +the value returned is Integer.MIN_VALUE. So just return -1 rather than Integer.MIN_VALUE.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD.html new file mode 100644 index 00000000000..f1f27912d24 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD.html @@ -0,0 +1,4 @@ +

This instruction assigns a value to a local variable, but the value is not read or used in +any subsequent instruction. Often, this indicates an error, because the value computed is never +used. There is a field with the same name as the local variable. Did you mean to assign to that +variable instead?

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_ARGUMENTS_WRONG_ORDER.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_ARGUMENTS_WRONG_ORDER.html new file mode 100644 index 00000000000..ccad0255b64 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_ARGUMENTS_WRONG_ORDER.html @@ -0,0 +1,3 @@ +

The arguments to this method call seem to be in the wrong order. For example, a call +Preconditions.checkNotNull("message", message) has reserved arguments: the value +to be checked is the first argument.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE.html new file mode 100644 index 00000000000..2d8b67b28fd --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE.html @@ -0,0 +1,5 @@ +

This code creates a BigDecimal from a double value that doesn't translate well to a decimal number. For example, +one might assume that writing new BigDecimal(0.1) in Java creates a BigDecimal which is exactly equal to 0.1 +(an unscaled value of 1, with a scale of 1), but it is actually equal to 0.1000000000000000055511151231257827021181583404541015625. +You probably want to use the BigDecimal.valueOf(double d) method, which uses the String representation of the double to +create the BigDecimal (e.g., BigDecimal.valueOf(0.1) gives 0.1).

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_DOH.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_DOH.html new file mode 100644 index 00000000000..a71cb32d7ee --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_DOH.html @@ -0,0 +1 @@ +

This partical method invocation doesn't make sense, for reasons that should be apparent from inspection.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS.html new file mode 100644 index 00000000000..cc4e393d925 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS.html @@ -0,0 +1,5 @@ +

The entrySet() method is allowed to return a view of the underlying Map in which a single Entry + object is reused and returned during the iteration. As of Java 1.6, both IdentityHashMap and EnumMap + did so. When iterating through such a Map, the Entry value is only valid until you advance to the + next iteration. If, for example, you try to pass such an entrySet to an addAll method, things will + go badly wrong.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DM_DEFAULT_ENCODING.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DM_DEFAULT_ENCODING.html new file mode 100644 index 00000000000..2f5fa97d507 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/DM_DEFAULT_ENCODING.html @@ -0,0 +1,4 @@ +

Found a call to a method which will perform a byte to String (or String to byte) conversion, +and will assume that the default platform encoding is suitable. This will cause the application +behaviour to vary between platforms. Use an alternative API and specify a charset name or +Charset object explicitly.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/ICAST_INT_2_LONG_AS_INSTANT.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/ICAST_INT_2_LONG_AS_INSTANT.html new file mode 100644 index 00000000000..f525431f0ab --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/ICAST_INT_2_LONG_AS_INSTANT.html @@ -0,0 +1,20 @@ +

This code converts a 32-bit int value to a 64-bit long value, and then passes that value for a +method parameter that requires an absolute time value. An absolute time value is the number of +milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT. +For example, the following method, intended to convert seconds since the epoc into a Date, is badly broken: +

+Date getDate(int seconds) { return new Date(seconds * 1000); }
+
+

+

The multiplication is done using 32-bit arithmetic, and then converted to a 64-bit value. When a 32-bit +value is converted to 64-bits and used to express an absolute time value, only dates in December 1969 and +January 1970 can be represented.

+

Correct implementations for the above method are: +

+// Fails for dates after 2037
+Date getDate(int seconds) { return new Date(seconds * 1000L); }
+
+// better, works for all dates
+Date getDate(long seconds) { return new Date(seconds * 1000); }
+
+

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/INT_BAD_COMPARISON_WITH_INT_VALUE.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/INT_BAD_COMPARISON_WITH_INT_VALUE.html new file mode 100644 index 00000000000..fc96ac19118 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/INT_BAD_COMPARISON_WITH_INT_VALUE.html @@ -0,0 +1,2 @@ +

This code compares an int value with a long constant that is outside the range of values that can + be represented as an int value. This comparison is vacuous and possibily to be incorrect.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/JML_JSR166_CALLING_WAIT_RATHER_THAN_AWAIT.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/JML_JSR166_CALLING_WAIT_RATHER_THAN_AWAIT.html new file mode 100644 index 00000000000..f4e02a85d54 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/JML_JSR166_CALLING_WAIT_RATHER_THAN_AWAIT.html @@ -0,0 +1,4 @@ +

This method calls wait(), notify() or notifyAll() on an object that also +provides an await(), signal(), signalAll() method (such as util.concurrent +Condition objects). This probably isn't what you want, and even if you do want it, you should consider changing your +design, as other developers will find it exceptionally confusing.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD.html new file mode 100644 index 00000000000..01f258746be --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD.html @@ -0,0 +1,3 @@ +

The program is dereferencing a public or protected field that does not seem to ever have a non-null + value written to it. Unless the field is initialized via some mechanism not seen by the analysis, + dereferencing this value will generate a null pointer exception.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE.html new file mode 100644 index 00000000000..2b410336e5d --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE.html @@ -0,0 +1,6 @@ +

This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an +explicit cleanup operation.
In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure +that the stream or resource is cleaned up before the method returns.

+

This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different +(and hopefully better) static analysis technique. See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes, for a +description of the analysis technique. .

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/PZ_DONT_REUSE_ENTRY_OBJECTS_IN_ITERATORS.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/PZ_DONT_REUSE_ENTRY_OBJECTS_IN_ITERATORS.html new file mode 100644 index 00000000000..353b2d70334 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/PZ_DONT_REUSE_ENTRY_OBJECTS_IN_ITERATORS.html @@ -0,0 +1,4 @@ +

The entrySet() method is allowed to return a view of the underlying Map in which an Iterator +and Map.Entry. This clever idea was used in several Map implementations, but introduces the possibility of + nasty coding mistakes. If a map m returns such an iterator for an entrySet, then c.addAll(m.entrySet()) will + go badly wrong. All of the Map implementations in OpenJDK 1.7 have been rewritten to avoid this, you should to.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE.html new file mode 100644 index 00000000000..9b24fc51025 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE.html @@ -0,0 +1,4 @@ +

This code invoked a compareTo or compare method, and checks to see if the return value is a specific +value, such as 1 or -1. When invoking these methods, you should only check the sign of the result, not +for any specific non-zero value. While many or most compareTo and compare methods only return -1, 0 or 1, +some of them will return other values.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/RV_NEGATING_RESULT_OF_COMPARETO.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/RV_NEGATING_RESULT_OF_COMPARETO.html new file mode 100644 index 00000000000..96e92b5e4e6 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/RV_NEGATING_RESULT_OF_COMPARETO.html @@ -0,0 +1,4 @@ +

This code negatives the return value of a compareTo or compare method. This is a questionable or bad +programming practice, since if the return value is Integer.MIN_VALUE, negating the return value won't +negate the sign of the result. You can achieve the same intended result by reversing the order of the +operands rather than by negating the results.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/RV_RETURN_VALUE_IGNORED_INFERRED.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/RV_RETURN_VALUE_IGNORED_INFERRED.html new file mode 100644 index 00000000000..c50a2185d2f --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/RV_RETURN_VALUE_IGNORED_INFERRED.html @@ -0,0 +1,8 @@ +

This code calls a method and ignores the return value. The return value is the same type as the type the +method is invoked on, and from our analysis it looks like the return value might be important (e.g., like +ignoring the return value of String.toLowerCase()). +

+

We are guessing that ignoring the return value might be a bad idea just from a simple analysis of the +body of the method. You can use a @CheckReturnValue annotation to instruct FindBugs as to whether +ignoring the return value of this method is important or acceptable.

+

Please investigate this closely to decide whether it is OK to ignore the return value.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/SA_LOCAL_SELF_ASSIGNMENT_INSTEAD_OF_FIELD.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/SA_LOCAL_SELF_ASSIGNMENT_INSTEAD_OF_FIELD.html new file mode 100644 index 00000000000..0b150015a7a --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/SA_LOCAL_SELF_ASSIGNMENT_INSTEAD_OF_FIELD.html @@ -0,0 +1,9 @@ +

This method contains a self assignment of a local variable, and there is a field with an identical name. +Assignment appears to have been ; e.g. +

+  int foo;
+  public void setFoo(int foo) {
+    foo = foo;
+  }
+
+The assignment is useless. Did you mean to assign to the field instead?

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD.html new file mode 100644 index 00000000000..9626b396733 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD.html @@ -0,0 +1,2 @@ +

This field is never read. The field is public or protected, so perhaps it is intended to be +used with classes not seen as part of the analysis. If not, consider removing it from the class.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD.html new file mode 100644 index 00000000000..5132a784703 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD.html @@ -0,0 +1,2 @@ +

This field is never used. The field is public or protected, so perhaps it is intended to be used +with classes not seen as part of the analysis. If not, consider removing it from the class.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD.html new file mode 100644 index 00000000000..287196216ba --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD.html @@ -0,0 +1,2 @@ +

No writes were seen to this public/protected field. All reads of it will return the default value. +Check for errors (should it have been initialized?), or remove it if it is useless.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/VA_FORMAT_STRING_USES_NEWLINE.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/VA_FORMAT_STRING_USES_NEWLINE.html new file mode 100644 index 00000000000..eba4c7386a5 --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/VA_FORMAT_STRING_USES_NEWLINE.html @@ -0,0 +1,2 @@ +

This format string include a newline character (\n). In format strings, it is generally preferable +better to use %n, which will produce the platform-specific line separator.

\ No newline at end of file diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/VO_VOLATILE_INCREMENT.html b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/VO_VOLATILE_INCREMENT.html new file mode 100644 index 00000000000..ebf2745165b --- /dev/null +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/findbugs/rules/findbugs/VO_VOLATILE_INCREMENT.html @@ -0,0 +1,2 @@ +

This code increments a volatile field. Increments of volatile fields aren't atomic. If more +than one thread is incrementing the field at the same time, increments could be lost.

\ No newline at end of file