Commit Graph

4509 Commits

Author SHA1 Message Date
Michal Kordas 681e17be40 Remove unnecessarily fully qualified names in test code. #1555
Fixes `UnnecessaryFullyQualifiedName` inspection violations in test code.

Description:
>Reports on fully qualified class names which can be shortened. The quick fix for this inspection will shorten the fully qualified names, adding import statements as necessary.
2015-08-20 06:37:24 +03:00
Michal Kordas 0b52fefcc8 Remove usage of prohibited exceptions in test code. #1555
Fixes `BadExceptionThrown` inspection violations in test code.

Description:
>Reports throw statements which throw inappropriate exceptions. One use of this inspection would be to warn of throw statements which throw overly generic exceptions (e.g. java.lang.Exception or java.io.IOException).
2015-08-20 06:33:45 +03:00
Michal Kordas 083c9eb1dc Remove calls to simple setters within classes. #1555
Fixes `CallToSimpleSetterInClass` inspection violations in test code.

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-20 06:29:47 +03:00
Michal Kordas 77979aa80e Remove test for default implementation of toString(). #1555
Fixes `ObjectToString` inspection violations in test code.

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-20 06:28:59 +03:00
Michal Kordas 3ac5d486ec Remove string concatenation done inside string builders. #1555
Fixes `StringConcatenationInsideStringBufferAppend` inspection violations in test code.

Description:
>Reports String concatenation used as the argument to StringBuffer.append(), StringBuilder.append() or Appendable.append(). Such calls may profitably be turned into chained append calls on the existing StringBuffer/Builder/Appendable, saving the cost of an extra StringBuffer/Builder allocation.
This inspection ignores compile time evaluated String concatenations, which when converted to chained append calls would only worsen performance.
2015-08-20 06:25:20 +03:00
Michal Kordas 4f6d7e415d Use character literals in String.indexOf(). #1555
Fixes `LengthOneStringInIndexOf` inspection violations in test code.

Description:
>Reports String literals of length one being used as a parameter in String.indexOf() or String.lastIndexOf() calls. These String literals may be replaced by equivalent character literals, gaining some performance enhancement.
2015-08-20 06:24:22 +03:00
Baratali Izmailov efa16e17bf Issue #1566: First sentence in a comment should start with a capital letter (Multiline comments) 2015-08-20 06:21:51 +03:00
Michal Kordas 2af817968f Remove unused array declarations. #1555
Fixes `MismatchedArrayReadWrite` inspection violations in test code.

Description:
>Reports any array fields or variables whose contents are read but not written, or written but not read. Such mismatched reads and writes are pointless, and probably indicate dead, incomplete or erroneous code.
2015-08-20 06:20:38 +03:00
Michal Kordas 227135b3ac Remove unused assignments. #1555
Fixes `UnusedAssignment` inspection violations in test code.

Description:
>This inspection points out the cases where a variable value is never used after its assignment, i.e.:  
- the variable never gets read after assignment OR  
- the value is always overwritten with another assignment before the next variable read OR  
- the variable initializer is redundant (for one of the above two reasons) OR  
- the variable is never used.
2015-08-20 06:19:44 +03:00
Michal Kordas 3e6b2028e4 Remove unnecessary cast expression. #1555
Fixes `RedundantCast` inspection violations in test code.

Description:
>This inspection reports unnecessary cast expressions.
2015-08-20 06:17:43 +03:00
Michal Kordas 4643c76051 Remove explicit array creation. #1555
Fixes `RedundantArrayCreation` inspection violations in test code introduced after recent commits.

Description:
>This inspection reports unnecessary creation of array expression to be passed as an argument to varargs parameter.
2015-08-20 06:16:18 +03:00
Michal Kordas 5d6ae80b84 Rename variable in anonymous class hiding other variable. #1555
Fixes `AnonymousClassVariableHidesContainingMethodVariable` inspection violations in test code introduced after recent commits.

Description:
>Reports anonymous class variables being named identically to variables of a containing method or lambda expression. Such a variable name may be confusing.
2015-08-20 06:14:55 +03:00
Ruslan Diachenko ea963bb721 Issue #1566: 'missing javadoc comment' violations partial fix 2015-08-19 21:14:55 +01:00
Ilja Dubinin 6c19362738 Sections of code should not be "commented out". Issue #46 2015-08-19 06:47:27 +03:00
Ilja Dubinin bf3e77cc87 Local variables should not shadow class fields. Issue #46 2015-08-19 06:45:56 +03:00
Andrei Selkin f2efe4d020 Updated comments for excludes of linkcheck, issue #751 2015-08-19 06:44:43 +03:00
Michal Kordas f6b33ebf17 Mark methods as static. #1555
Fixes `MethodMayBeStatic` inspection violations in test code introduced after recent commits.

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-19 06:43:05 +03:00
Michal Kordas 9fbba0b380 Add missing @Override annotations in test code. #1555
Fixes `MissingOverrideAnnotation` inspection violations in test code.

Description:
>Reports any methods which override methods in a superclass but do not have the @java.lang.Override annotation.
This inspection only reports if the project or module is configured to use a language level of 5.0 or higher.
2015-08-19 06:41:58 +03:00
Michal Kordas 71b78a97aa Fix incorrect message format parameter. #1555
Fixes ` UnusedMessageFormatParameter` inspection violation introduced in #1648.

Description:
>This inspection reports properties values which looks like java.text.MessageFormat format strings but do not use some of the parameters of {xx} kind.
For example:
```
# parameter {0} is not used
error.message=Something happened in line {1}
```
2015-08-19 06:39:00 +03:00
Michal Kordas bbe93aec4f Replace Arrays.asList() with Collections.emptyList(). #1555
Fixes `ArraysAsListWithZeroOrOneArgument` inspection violations in test code.

Description:
>Reports any calls to Arrays.asList() with zero arguments or only one argument. Such calls could be replaced with either a call to Collections.singletonList() or Collections.emptyList() which will save some memory.
2015-08-19 06:37:53 +03:00
Michal Kordas c5c3b7eed3 Decrease visibility of inner classes. #1555
Possibility to instantiate private checks was added.

Fixes `PublicInnerClass` inspection violation.

Description:
>Reports public inner classes.
2015-08-19 06:35:44 +03:00
Michal Kordas fbc44f14b8 Fix suspicious getters and setters in IndentationCheck. #1555
Fixes `SuspiciousGetterSetter` inspection violations in IndentationCheck.

Description:
>Reports suspicious getter or setter methods. A getter or setter is suspicious if it accesses a different field than would be expected by its name.
2015-08-19 06:32:41 +03:00
Michal Kordas bc0bf95dae Fix non-static non-final all upper-case names in test code. #1555
Fixes `UpperCaseFieldNameNotConstant` inspection violations in test code.

Description:
>Reports non-static non-final fields whose names are all upper-case. Such fields may cause confusion by breaking a common naming convention, and are often the result of developer error.
2015-08-19 06:31:31 +03:00
Michal Kordas 0678968078 Fix questionable names in test code. #1555
Fixes `QuestionableName` inspection violations in test code.

Description:
>Reports on any variables, methods, or classes with questionable names. This inspection is best used to report common metasyntactic variables which may be used as names by lazy or confused developers.
2015-08-19 06:30:04 +03:00
Michal Kordas 88edaa84fd Remove unnecessary explicit numeric cast. #1555
Fixes `UnnecessaryExplicitNumericCast` inspection violations in test code.

Description:
>Reports any primitive numeric casts which would otherwise be inserted implicitly by the compiler.
2015-08-19 06:29:14 +03:00
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