Commit Graph

3523 Commits

Author SHA1 Message Date
Ruslan Diachenko 044889b26a Issue #1566: partial fix of ReturnCount violations 2015-08-27 05:30:05 -07:00
Ruslan Diachenko 98a3157200 Issue #1566: partial fix of ReturnCount violations 2015-08-27 05:28:29 -07:00
Ruslan Diachenko f981e58454 Issue #1566: partial fix of ReturnCount violations 2015-08-27 05:26:22 -07:00
Ruslan Diachenko fb0f73fc9c Issue #1566: partial fix of ReturnCount violations 2015-08-27 05:25:56 -07:00
Ruslan Diachenko 69a3d541b4 Issue #1566: partial fix of ReturnCount violations 2015-08-27 05:21:36 -07:00
Ilja Dubinin cdf3e56bac Utils class has been splitted to CommonUtils and TokenUtils. Issue #1898 2015-08-27 05:17:01 -07:00
Ilja Dubinin ed595de84f Utils classes have been moved to utils package. Issue #1898 2015-08-27 05:17:01 -07:00
Michal Kordas f6113bb56d Remove empty methods. #1555
Fixes `EmptyMethod` inspection violations in test code.

Description:
>This inspection reports methods where:
- method is empty OR
- all implementations of interface method are empty OR
- method is empty itself and is overridden only by empty methods
Note that a method containing only the super() call and passing its own parameter is also considered empty.  This inspection is automatically suppressed for methods annotated with special annotations, for example, EJB annotations javax.ejb.Init and javax.ejb.Remove.
2015-08-26 18:08:22 -07:00
Baratali Izmailov 561df9fc0c Issue #1566: Refactoring of AbstractJavadocCheck to reduce method length 2015-08-26 12:50:51 -07:00
Baratali Izmailov d6bdd7ee79 Issue #1566: Reduce FileText's constructor length 2015-08-26 12:50:51 -07:00
Michal Kordas 3fca3c9250 Use compiled pattern instead of dynamic regexp in checks. #1555
Fixes some `SpellDynamicRegexReplaceableByCompiledPattern` inspection violations.

Description:
>Reports calls to the regular expression methods of java.lang.String using constants arguments. Such calls may be profitably replaced with a private static final Pattern field so that the regular expression does not have to be compiled each time it is used.
2015-08-26 09:28:36 -07:00
Michal Kordas e23b8a2ffa Remove calls to simple getters within classes. #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-26 09:27:54 -07:00
Michal Kordas b3f8328217 Remove redundant tests for equals methods. #1555
These cases are covered by EqualsVerifier anyway.
2015-08-26 04:34:53 -07:00
Michal Kordas 9f4730e7e5 Remove invocations of equals method with null. #1555
These cases are covered by EqualsVerifier anyway.

Fixes `ObjectEqualsNull` inspection violations.

Description:
>Reports on calls to .equals() which have null as an argument. The semantics of such calls are almost certainly not what was intended.
2015-08-26 04:34:53 -07:00
Michal Kordas 0c29723033 Fix problem found by EqualsVerifier in IntMatchFilter. #1088
Details:
```
java.lang.AssertionError: Subclass: equals is not final.
Supply an instance of a redefined subclass using withRedefinedSubclass if equals cannot be final.
```
2015-08-26 04:34:52 -07:00
Michal Kordas 82ca98909b Use EqualsVerifier to test equals and hashCode in IntMatchFilter. #1088 2015-08-26 04:34:52 -07:00
Ilja Dubinin e42acc940f JavadocTagInfo has been moved to javadoc package. It reduces number of cycle dependencies between packages. Part of issue #46 2015-08-25 16:40:41 -07:00
Ruslan Diachenko 085ce12db0 Issue #1566: MultipleStringLiterals violations fixed 2015-08-26 00:00:09 +01:00
Michal Kordas 8aec5bba7e Review visibility and usages of protected fields. #1555
Fixes `ProtectedField` inspection violations in test code.

Description:
>Reports protected instance variables. Constants (i.e. variables marked static and final) are not reported.
2015-08-25 06:41:51 -07:00
Roman Ivanov eec72ee84c Revert "Made getRequiredTokens and getAcceptableTokens as abstract, issue #655" as we will do that in 7.0 version
This reverts commit efac6bf023.
2015-08-25 05:30:17 -07:00
Andrei Selkin 34c2bf22b7 Provided UT for all checks to test with default configuration, issue #655 2015-08-25 05:29:56 -07:00
Andrei Selkin afd9a5c3e5 Ensured that check's required tokens are subset of default tokens, issue #655 2015-08-25 05:29:56 -07:00
Andrei Selkin efac6bf023 Made getRequiredTokens and getAcceptableTokens as abstract, issue #655 2015-08-25 05:29:56 -07:00
Ruslan Diachenko 26513d5233 Issue #1566: MultipleStringLiterals violations partial fix 2015-08-25 05:20:28 -07:00
Ruslan Diachenko 8c3e4a5074 Issue #1566: MultipleStringLiterals violations partial fix 2015-08-25 05:12:53 -07:00
Michal Kordas 655a496c88 Use unchecked exception. #1555
Fixes `CheckedExceptionClass` inspection violations in test code.

Description:
>Reports checked exception classes (i.e. subclasses of Exception which are not also subclasses of RuntimeException). Certain coding standards require that all user-defined exception classes be unchecked.
2015-08-25 05:07:32 -07:00
Michal Kordas beae0df0a4 Use camel case in property names. #1555
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals, and fix them in one click.
2015-08-25 04:55:12 -07:00
Michal Kordas adb3483738 Fix typos in xdocs. #1555
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals, and fix them in one click.
2015-08-25 04:53:48 -07:00
Michal Kordas e249a8cdcf Use compiled pattern instead of dynamic regexp in CheckUtils. #1555
Fixes some `SpellDynamicRegexReplaceableByCompiledPattern` inspection violations.

Description:
>Reports calls to the regular expression methods of java.lang.String using constants arguments. Such calls may be profitably replaced with a private static final Pattern field so that the regular expression does not have to be compiled each time it is used.
2015-08-25 04:51:18 -07:00
Michal Kordas e615817b5b Fix various typos. #1555
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals, and fix them in one click.
2015-08-25 04:43:15 -07:00
Michal Kordas c2ce485b48 Fix typos in Indentation check code. #1555
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals, and fix them in one click.
2015-08-25 04:41:22 -07:00
Michal Kordas c4a7d06206 Rename non-boolean method starting with question word. #1555
Fixes `NonBooleanMethodNameMayNotStartWithQuestion` inspection violations.

Description:
>Reports non-boolean methods whose names start with a question word. Non-boolean methods that override library methods are ignored by this inspection.
2015-08-25 04:40:19 -07:00
Michal Kordas d345f3beb2 Fix typos in code and Javadoc. #1555
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals, and fix them in one click.
2015-08-25 04:39:30 -07:00
Michal Kordas 7b14802231 Use compiled pattern instead of dynamic regexp. #1555
Fixes some `SpellDynamicRegexReplaceableByCompiledPattern` inspection violations.

Description:
>Reports calls to the regular expression methods of java.lang.String using constants arguments. Such calls may be profitably replaced with a private static final Pattern field so that the regular expression does not have to be compiled each time it is used.
2015-08-25 04:31:58 -07:00
Michal Kordas 7d0b3edff8 Remove redundant no-arg constructor. #1555
Fixes `UnnecessaryConstructor` inspection violations.

Description:
>Reports unnecessary constructors. A constructor is unnecessary if it is the only constructor of a class, has no parameters, has the same access modifiers as its containing class, and does not perform any initialization except explicitly or implicitly calling the super class constructor without arguments. Such a constructor can be safely removed as it will be generated by the compiler even if not specified.
2015-08-25 14:00:50 +03:00
Michal Kordas bee8aab67c Encapsulate package-visible fields. #1555
Fixes `PackageVisibleField` inspection violations.

Description:
>Reports package-visible instance variables. Constants (i.e. variables marked static and final) are not reported.
2015-08-25 13:51:50 +03:00
Michal Kordas 2071f9b542 Add arguments to created exceptions. #1555
Fixes `NewExceptionWithoutArguments` inspection violations.

Description:
>Reports exception instance creation without any arguments specified. When an exception is constructed without arguments it contains no information about the fault that happened, which makes debugging needlessly hard.
2015-08-25 13:49:22 +03:00
Michal Kordas b43c32ad0a Use same parameter names in overridden methods. #1555
Fixes some `ParameterNameDiffersFromOverriddenParameter` inspection violations.

Description:
>Reports parameters that have different names from the corresponding parameters in the methods they override. While legal in Java, such inconsistent names may be confusing, and lessen the documentation benefits of good naming practices.
2015-08-25 13:48:40 +03:00
Ruslan Diachenko 95604498da Issue #1566: JavadocStyle violations fixed 2015-08-25 13:39:25 +03:00
Michal Kordas 0aec69c702 Fix suspicious getters and setters. #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-25 13:34:08 +03:00
Michal Kordas 80ab48f859 Remove declared error that should not occur. #1555
Fixes `ErrorRethrown` inspection violations.

Description:
>Reports try statements which catch java.lang.Error or any subclass and which do not rethrow the error. Statements which catch java.lang.ThreadDeath are not reported by this inspection.
2015-08-25 13:32:41 +03:00
Michal Kordas 13c022282b Remove unused import from test code. #1555
Fixes `UnusedImport` inspection violations.

Description:
>Reports any import statements that are unused.
2015-08-25 13:29:49 +03:00
Michal Kordas a992ca414f Specify charset used in test code. #1555
Fixes `ImplicitDefaultCharsetUsage` inspection violations.

Description:
>Reports method and constructor calls which implicitly use the platform's default charset. These can produce different results on (e.g. foreign language) systems that use a different default charset, resulting in unexpected behaviour.
2015-08-25 13:28:32 +03:00
Michal Kordas 4088948e24 Mark field as final. #1555
Fixes `CanBeFinal` inspection violations.

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-25 13:26:36 +03:00
Baratali Izmailov ee797434bc Issue #1566: Fixed TrailingComment violations in UTs 2015-08-25 13:25:46 +03:00
Michal Kordas 80f66e1c88 Use only one exception on throws list for tests. #1555
Fixes `MultipleExceptionsDeclaredOnTestMethod` inspection violation

Description:
>Reports JUnit test methods with more than one exception declared in the throws clause. Such a throws clause can be more concisely declared as `throws Exception`.
2015-08-25 13:24:26 +03:00
Michal Kordas 07ffe4625f Use constants for arrays initialized with zero length. #1555
Fixes `ZeroLengthArrayInitialization` inspection violation

Description:
>Reports on allocations of arrays with known lengths of zero. Since array lengths in Java are non-modifiable, it is almost always possible to share zero-length arrays, rather than repeatedly allocating new zero-length arrays. Such sharing may provide useful optimizations in program runtime or footprint. Note that this inspection does not report zero-length arrays allocated as static final fields, as it is assumed that those arrays are being used to implement array sharing.
2015-08-25 13:23:42 +03:00
Michal Kordas e8c6134660 Fix local variable name in test code. #1555
Fixes `LocalVariableNamingConvention` inspection violations in test code.

Description:
>Reports local variables whose names are either too short, too long, or do not follow the specified regular expression pattern.
2015-08-25 13:22:57 +03:00
Michal Kordas 859c809b05 Use relative alignment constants. #1555
Fixes `AbsoluteAlignmentInUserInterface` inspection violations.

Description:
>Reports usages of absolute alignment constants from AWT and Swing. Internationalized applications should make use of relative alignment, because it respects locale component orientation settings.
2015-08-25 13:21:31 +03:00
Michal Kordas dc0a1a2fcc Mark fields as private static final in test code. #1555
Fixes `FieldMayBeStatic` inspection violations in test code.

Description:
>Reports any instance variables which may safely be made static. A field may be static if it is declared final, and is initialized with a constant
2015-08-25 13:20:01 +03:00