Commit Graph

4484 Commits

Author SHA1 Message Date
Michal Kordas 35deee1297 Remove unused field. #1555
Fixes ` FieldCanBeLocal` inspection violation.

Description:
>This inspection searches for redundant class fields that can be replaced with local variables. If all local usages of a field are preceded by assignments to that field, the field can be removed and its usages replaced with local variables.
2015-08-19 06:28:19 +03:00
Michal Kordas f88f22e0ab Remove redundant suppressions from test code. #1555
Fixes `RedundantSuppression` inspection violations in test code.

Description:
>This inspection reports usages of
@SuppressWarning annotation, or
// noinspection line comment, or
/** noinspection */ JavaDoc comment
which can be safely removed because inspection they affect is no longer applicable in this context.
2015-08-19 06:26:49 +03:00
Michal Kordas 3440ef73c9 Replace assertEquals() with arrayAssertEquals(). #1555
Fixes `AssertEqualsCalledOnArray` inspection violations in test code.

Description:
>Reports any calls to JUnit's assertEquals() method with arguments of type array. Arrays should be checked with one of the assertArrayEquals() methods.
2015-08-19 06:25:06 +03:00
Michal Kordas 5306bb6be9 Remove unnecessary @inheritDoc. #1555
Fixes `UnnecessaryInheritDoc` inspection violations in test code.

Description:
>Reports any Javadoc comments which contain only the {@inheritDoc} tag. Since Javadoc copies the super class' comment if no comment is present, a comment containing only an {@inheritDoc} adds nothing.
2015-08-19 06:24:17 +03:00
Michal Kordas 1d7ef7f008 Replace <code> tags with {@code ...} constructs. #1555
Fixes `HtmlTagCanBeJavadocTag` inspection violations in test code.

Description:
>Reports use of <code> tags in Javadoc comments. Since JDK1.5 these constructs may be replaced with {@code ...} constructs. This allows the use of angle brackets (<, >) inside the comment, instead of HTML character entities.
2015-08-19 06:23:36 +03:00
Baratali Izmailov cf9cbc3dca Issue #1243: SuppressWarnings(deprecated) has been removed 2015-08-18 22:43:58 +03:00
Baratali Izmailov 54ccca1863 Issue #1566: First sentence in a comment should start with a capital letter 2015-08-18 04:25:29 -04:00
Andrei Selkin ae73562255 Created JaCoCo profile of pom.xml, issue #1173 2015-08-18 09:40:22 +03:00
Andrei Selkin d71032a054 Provided UTs for valueOf() and values() methods of enums, issue #1173 2015-08-18 09:40:22 +03:00
Andrei Selkin ef58cc5a0d Workaround problem of interoperability between PowerMock and JaCoCo, issue #1173 2015-08-18 09:40:22 +03:00
Michal Kordas aeb68b7da9 Remove unnecessary this in test code. #1555
Fixes `UnnecessaryThis` inspection violations in test code.

Description:
>Reports on any unnecessary uses of this in the code. Using this to disambiguate a code reference may easily become unnecessary via automatic refactorings, and is discouraged by many coding styles.
2015-08-18 08:52:03 +03:00
Michal Kordas 1634b49d11 Create constants out of fields in test code. #1555
Fixes `FieldCanBeLocal` inspection violation in test code.

Description:
>This inspection searches for redundant class fields that can be replaced with local variables. If all local usages of a field are preceded by assignments to that field, the field can be removed and its usages replaced with local variables.
2015-08-18 08:51:06 +03:00
Michal Kordas b062024229 Mark util class as final in test code. #1555
Fixes `ClassWithOnlyPrivateConstructors` inspection violation in test code.

Description:
>Reports classes with only private constructors that are not extended by any nested class. Such classes can not be extended and should be declared final.
2015-08-18 08:50:00 +03:00
Michal Kordas a3fdd52b45 Promote anonymous class to nested class. #1555
Fixes `AnonymousClassMethodCount` inspection violation in test code.

Description:
>Reports anonymous inner class with too many methods. Anonymous classes with more than a very low number of methods may be difficult to understand, and should probably be promoted to become named inner classes.
2015-08-18 08:48:59 +03:00
Michal Kordas 06863d123f Remove nested assignment. #1555
Fixes `NestedAssignment` inspection violation in test code.

Description:
>Reports assignment expressions nested inside other expressions. While admirably terse, such expressions may be confusing, and violate the general design principle that a given construct should do precisely one thing.
2015-08-18 08:47:16 +03:00
Baratali Izmailov b02dba99c5 Issue #1566: File length of JavadocMethodCheck has been reduced 2015-08-18 08:46:12 +03:00
Ilja Dubinin f17f1410a5 Floating point numbers should not be tested for equality. Issue #46 2015-08-18 07:39:59 +03:00
Michal Kordas 8a276f35fd Simplify JUnit assertions. #1555
Fixes `SimplifiableJUnitAssertion` inspection violation in test code.

Description:
>Reports any JUnit assertTrue calls which can be replaced by equivalent assertEquals calls. assertEquals calls will normally give better error messages in case of test failure than assertTrue can.
2015-08-18 07:37:59 +03:00
Michal Kordas 15c91c8ec2 Add missing toString() methods. #1555
Fixes `ObjectToString` inspection violations.

Description:
>Reports any calls to .toString() which use the default implementation from java.lang.Object. The default implementation is rarely desired, but easy to use by accident. Calls to .toString() on objects of type java.lang.Object are ignored by this inspection.
2015-08-18 07:33:59 +03:00
Roman Ivanov 9832267904 Issue #1566 . DesignForExtension was suppresed in checkstyle code validation till next major release. 2015-08-17 15:40:56 +03:00
Roman Ivanov e46f03cd72 Issue #1566 . Documentation for DesignForExtension was added. 2015-08-17 15:25:35 +03:00
liscju 1e6dc8f4ea Fix RightCurlyCheck with same option not to rise expression in single-line blocks - issue #1416 2015-08-17 07:40:16 +03:00
Baratali Izmailov 322b8da20f XDoc updated 2015-08-17 07:15:24 +03:00
Michal Kordas 20e6e9afca Decrease visibility of public constructor in non-public classes. #1555
Fixes `PublicConstructorInNonPublicClass` inspection violations.

Description:
>Reports all constructors in non-public classes that are declared public.
2015-08-17 07:13:21 +03:00
Michal Kordas 7b01fc489f Remove non-final static field. #1555
Fixes `StaticNonFinalField` inspection violations.

Description:
>Reports non-final static fields.
2015-08-17 07:12:06 +03:00
Michal Kordas acbc27ee12 Correct names for constants. #1555
Fixes `ConstantNamingConvention` inspection violation in test code.

Description:
>Reports any constants whose names are either too short, too long, or do not follow the specified regular expression pattern. Constants are fields declared static final.
2015-08-17 07:11:05 +03:00
Ilja Dubinin 828e07e15b Short-circuit logic should be used in boolean contexts. Issue #46 2015-08-17 07:06:00 +03:00
Ruslan Diachenko 23c8774d2e Issue #1566: AvoidInlineConditional violations fixed 2015-08-17 07:01:20 +03:00
Michal Kordas 9f93c2258e Add private constructor to test utility class. #1555
Fixes `UtilityClassWithoutPrivateConstructor` inspection violation.

Description:
>Reports utility classes which do not have private constructors. Utility classes have all fields and methods declared static. Giving such classes a private constructor prevents them from being inadvertently instantiated.
2015-08-17 06:54:36 +03:00
Michal Kordas 902e761e1a Use diamond operator in test code. #1555
Fixes `Convert2Diamond` inspection violations.

Description:
>This inspection reports all new expressions with type arguments which can be replaced with diamond type <>
Such <> syntax is not supported under Java 1.6 or earlier JVMs.
2015-08-17 06:53:27 +03:00
Michal Kordas f45fee0aa4 Replace for with foreach in test code. #1555
Fixes `ForCanBeForeach` inspection violations in test code.

Description:
>Reports for loops which iterate over collections or arrays, and can be replaced with the foreach iteration syntax, available in Java 5 and newer.
2015-08-17 06:52:33 +03:00
Michal Kordas 1079f0ab99 Remove unnecessary boxing in test code. #1555
Fixes `UnnecessaryBoxing` inspection violations in test code.

Description:
>Reports "boxing", e.g. wrapping of primitive values in objects. Boxing is unnecessary under Java 5 and newer, and can be safely removed.
This inspection only reports if the project or module is configured to use a language level of 5.0 or higher.
2015-08-17 06:51:40 +03:00
Michal Kordas a5df850a23 Convert parameters to varargs in test code. #1555
Fixes `MethodCanBeVariableArityMethod` inspection violations in test code.

Description:
>Reports methods with which can be converted to be a variable arity/varargs method, available in Java 5 and newer.
This inspection only reports if the project or module is configured to use a language level of 5.0 or higher.
2015-08-17 06:50:53 +03:00
Michal Kordas 0dc2233434 Replace <code> tags with {@code ...} constructs in test code. #1555
Fixes `HtmlTagCanBeJavadocTag` inspection violation in test code.

Description:
>Reports use of <code> tags in Javadoc comments. Since JDK1.5 these constructs may be replaced with {@code ...} constructs. This allows the use of angle brackets (<, >) inside the comment, instead of HTML character entities.
2015-08-17 06:49:46 +03:00
Michal Kordas 4074ab454e Use assertSame instead of assertEquals where possible. #1555
Fixes `AssertEqualsMayBeAssertSame` inspection violation in test code.

Description:
>Reports any calls to org.junit.Assert.assertEquals() or junit.framework.Assert.assertEquals() which can be replaced with an equivalent call to assertSame(). This is possible when the arguments are instances of a final class which does not override the equals() method.
2015-08-17 06:48:56 +03:00
Michal Kordas de8f91ad67 Flip misordered assertEquals parameters. #1555
Fixes `MisorderedAssertEqualsParameters` inspection violation in test code.

Description:
>Reports any calls to JUnit assertEquals() which have a non-literal as the expected result argument and a literal as the actual result argument. Such calls will behave fine for assertions which pass, but may give confusing error reports if their expected and actual arguments differ.
2015-08-17 06:47:53 +03:00
Michal Kordas e6faf188e2 Make inner class static. #1555
Fixes `InnerClassMayBeStatic` inspection violation in test code.

Description:
>Reports any inner classes which may safely be made static. An inner class may be static if it doesn't reference its enclosing instance.
 A static inner class does not keep an implicit reference to its enclosing instance. This prevents a common cause of memory leaks and uses less memory per instance of the class.
2015-08-17 06:45:04 +03:00
Michal Kordas f0c74333de Fix UnsupportedOperationException in GUI. #1718 2015-08-17 06:43:18 +03:00
Michal Kordas 7e1d5d0a2d Use float in canonical form in test code. #1555
Fixes `ConfusingFloatingPointLiteral` inspection violation in test code.

Description:
>Reports any floating point numbers which do not have a decimal point, numbers before the decimal point, and numbers after the decimal point. Such literals may be confusing, and violate several coding standards.
2015-08-17 06:41:50 +03:00
Andrei Selkin 77c3f22326 Provided UTs for getRequiredTokens and getAcceptableTokens, issue #655 2015-08-17 06:41:03 +03:00
Andrei Selkin d56a2a366c Updated all checks to have getRequiredTokens and getAcceptableTokens, issue #655 2015-08-17 06:41:03 +03:00
Michal Kordas eeb20e6c8c Correct name of exception. #1555
Fixes `ExceptionNameDoesntEndWithException` inspection violation in test code.

Description:
>Reports exception classes whose names don't end with 'Exception'.
2015-08-16 23:08:23 +02:00
Roman Ivanov 5630e4399b Issue #1243: Added serialId to test classes 2015-08-16 14:47:17 +03:00
Roman Ivanov 80e0a90fb8 Issue #1243: Eclipse warnings are fixed 2015-08-16 08:23:07 +03:00
Roman Ivanov 617b099c97 fix for Eclipse compiler error 2015-08-16 07:54:15 +03:00
Aleksandr Ivanov cd12de2a24 Extended messages for CustomImportOrder #1648 2015-08-16 07:15:10 +03:00
Michal Kordas accb0bf5bc Update Maven FindBugs Plugin to 3.0.2. #1714 2015-08-16 07:03:57 +03:00
Michal Kordas 26774cf310 Remove calls to simple setters from within classes. #1555
Fixes `CallToSimpleSetterInClass` inspection violations.

Description:
>Reports any calls to a simple property setter from within the property's class. A simple property setter is defined as one which simply assigns the value of its parameter to a field, and does no other calculation. Such simple setter calls may be safely inlined, at a small performance improvement. Some coding standards also suggest against the use of simple setters for code clarity reasons.
2015-08-16 07:03:15 +03:00
Michal Kordas 1ab08ad4ab Make methods static. #1555
Fixes `MethodMayBeStatic` inspection violations.

Description:
>Reports any methods which may safely be made static. A method may be static if it is not synchronized, it does not reference any of its class' non static methods and non static fields and is not overridden in a sub class.
2015-08-16 07:02:36 +03:00
Michal Kordas c0a69490d7 Remove string concatenation in format string argument. #1555
Fixes `StringConcatenationInFormatCall` inspection violations.

Description:
>Reports non-constant string concatenations used as a format string argument. Often this is the result of mistakenly concatenating a string format argument by typing a '+' when a ',' was meant. This inspection checks calls to appropriate methods on java.util.Formatter, java.lang.String, java.io.PrintWriter, or java.io.PrintStream.
2015-08-16 07:01:24 +03:00