Commit Graph

872 Commits

Author SHA1 Message Date
Michal Kordas 16512bb1e7 Decrease scope of variables. #1555
Fixes `TooBroadScope` inspection violations.

Description:
>Reports any variable declarations of which the scope can be narrowed. Especially useful for "Pascal style" declarations at the start of a method, but variables with too broad a scope are also often left over after refactorings.
2015-08-22 14:41:17 +03:00
Michal Kordas d5129db907 Remove unnecessary local variables. #1555
Fixes `UnnecessaryLocalVariable` inspection violations.

Description:
>Reports unnecessary local variables, which add nothing to the comprehensibility of a method. Variables caught include local variables which are immediately returned, local variables that are immediately assigned to another variable and then not used, and local variables which always have the same value as another local variable or parameter.
2015-08-22 14:36:33 +03:00
Michal Kordas 27375d0815 Invert negated if-else. #1555
Fixes `NegatedIfElse` inspection violations.

Description:
>Reports if statements which contain else branches and whose conditions are negated. Flipping the order of the if and else branches will usually increase the clarity of such statements.
2015-08-22 14:35:35 +03:00
Michal Kordas d1f4e8d400 Simplify and remove unnecessary code. #1555
Fixes a few violations.
2015-08-22 14:34:52 +03:00
Michal Kordas 8abfa48f2e 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-22 14:33:46 +03:00
Michal Kordas 3b452a2e88 Inline calls to simple getters. #1555
Fixes `CallToSimpleGetterInClass` inspection violations.

Description:
>Reports any calls to a simple property getter from within the property's class. A simple property getter is defined as one which simply returns the value of a field, and does no other calculation. Such simple getter calls may be safely inlined, at a small performance improvement. Some coding standards also suggest against the use of simple getters for code clarity reasons.
2015-08-22 14:32:47 +03:00
Michal Kordas 1c9034402f Do not use static field referenced by subclass. #1555
Fixes `StaticFieldReferenceOnSubclass` inspection violations.

Description:
>Reports static field accesses where the call is qualified by a subclass of the declaring class, rather than the declaring class itself. Java allows such qualification, but such accesses may be confusing, and may indicate a subtle confusion of inheritance and overriding.
2015-08-21 21:17:54 +02:00
Baratali Izmailov 82e3e077f4 Issue #1566: Class 'AbstractCellEditor' must be declared as 'abstract' 2015-08-21 16:34:33 +03:00
Ruslan Diachenko 56c745bef6 Issue #1566: JavadocStyle violation fixed 2015-08-21 16:32:56 +03:00
Ruslan Diachenko 32d84c500d Issue #1566: fixed import order 2015-08-21 16:17:49 +03:00
Michal Kordas 97956e1ae5 Inline simple setters. #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-21 15:52:54 +03:00
Michal Kordas 755eda4d68 Reduce number of parameters in method. #1555
Fixes `ParametersPerMethod` inspection violation.

Description:
>Reports methods with too many parameters. Methods with too many parameters can be a good sign that refactoring is necessary. Methods whose signatures are inherited from library classes are ignored by this inspection.
2015-08-21 15:25:51 +03:00
Michal Kordas 584f7ee123 Fix suspicious getters. #1555
Fixes `SuspiciousGetterSetter` inspection violations.

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-21 15:17:34 +03:00
Vladislav Lisetskiy 02ae6023b5 replace deprecated method in HiddenCheckField 2015-08-21 15:16:10 +03:00
Baratali Izmailov 23a1b6253f Issue #1566: Fix for 'Don't use trailing comments' (partial) 2015-08-21 15:05:41 +03:00
Ruslan Diachenko 0da1e4d980 Issue #1566: ReturnCount violations (partial fix) 2015-08-20 08:06:05 +03:00
Andrei Selkin 2057a77c3a Refactoring of CommentsIndentationCheck, issue #333 2015-08-20 08:02:37 +03:00
Ilja Dubinin 0fe31dfdf9 Source files should not have any duplicated blocks. Issue #46 2015-08-20 08:01:26 +03:00
Ilja Dubinin bcaa9d81a7 Unused method parameters should be removed. Issue #46 2015-08-20 06:57:11 +03:00
Ilja Dubinin 57b908199d String literals should not be duplicated. Issue #46 2015-08-20 06:54:16 +03:00
Michal Kordas da6a8d083c Remove unnecessary local variables. #1555
Fixes `UnnecessaryLocalVariable` inspection violation.

Description:
>Reports unnecessary local variables, which add nothing to the comprehensibility of a method. Variables caught include local variables which are immediately returned, local variables that are immediately assigned to another variable and then not used, and local variables which always have the same value as another local variable or parameter.
2015-08-20 06:42:37 +03:00
Michal Kordas 35de50c940 Rename negatively named boolean variable. #1555
Fixes `NegativelyNamedBooleanVariable` inspection violation.

Description:
>Reports negatively named variables, for example 'disabled', 'hidden', 'isNotChanged'. It is usually more clear to invert the boolean value and remove the negation from the name.
2015-08-20 06:41:22 +03:00
Michal Kordas 697895a205 Mark fields as final in test code. #1555
Fixes `CanBeFinal` inspection violations in test code.

Description:
>This inspection reports all fields, methods or classes, found in the specified inspection scope, that may have a final modifier added to their declarations.
2015-08-20 06:40:09 +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
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
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
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 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 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 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
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
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 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
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
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
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 f0c74333de Fix UnsupportedOperationException in GUI. #1718 2015-08-17 06:43:18 +03:00
Andrei Selkin d56a2a366c Updated all checks to have getRequiredTokens and getAcceptableTokens, issue #655 2015-08-17 06:41:03 +03:00
Aleksandr Ivanov cd12de2a24 Extended messages for CustomImportOrder #1648 2015-08-16 07:15:10 +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 931af7ec14 Simplify expressions that are constant. #1555
Fixes `ConstantConditions` inspection violations.

Description:
>This inspection analyzes method control and data flow to report possible conditions that are always true or false and expressions whose value is statically proven to be constant.
2015-08-16 07:00:45 +03:00
Michal Kordas e936c4c6fa Remove unnecessary synchronization. #1555
Fixes `NonSerializableFieldInSerializableClass` inspection violation.

Description:
>Reports non-synchronized methods overriding synchronized methods.

Fixes `NonSynchronizedMethodOverridesSynchronizedMethod` inspection violation.

Description:
>Reports non-Serializable fields in Serializable classes. Such fields will result in runtime exceptions if the object is serialized. Fields declared transient or static are not reported, nor are fields of classes which have defined a writeObject method. For purposes of this inspection, fields with java.util.Collection or java.util.Map types are assumed to be Serializable, unless the types they are declared to contain are non-Serializable.
2015-08-16 06:55:04 +03:00