Commit Graph

4661 Commits

Author SHA1 Message Date
Michal Kordas 5de9cd8c77 Use constants for empty arrays of zero length. #1555
Fixes `ZeroLengthArrayInitialization` inspection violations.

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-27 13:20:42 -07:00
Michal Kordas bf6966b145 Remove redundant throws declarations. #1555
Fixes `RedundantThrowsDeclaration` inspection violations.

Description:
>This inspection reports exceptions that are declared in a method's signature but never thrown by the method itself.
2015-08-27 13:19:51 -07:00
Michal Kordas 9713d08ccc Remove unnecessary this keyword. #1555
Fixes `UnnecessaryThis` inspection violations.

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-27 13:18:14 -07:00
Michal Kordas 086ebb8300 Decrease visibility of public inner classes. #1555
Fixes `PublicInnerClass` inspection violations.

Description:
>Reports public inner classes.
2015-08-27 12:55:48 -07:00
Michal Kordas 1b765f3c22 Rename 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-27 12:54:35 -07:00
Michal Kordas 4d2e6647f9 Rename boolean methods to start with question word. #1555
Fixes `BooleanMethodNameMustStartWithQuestion` inspection violations.

Description:
>Reports boolean methods whose names do not start with a question word. Boolean methods that override library methods are ignored by this inspection.
2015-08-27 12:53:59 -07:00
Michal Kordas 8142c804e9 Decrease visibility of fields and methods where applicable. #1555
Fixes some `WeakerAccess` inspection violations.

Description:
>This inspection reports all fields, methods or classes, found in the specified inspection scope, that may have their access modifier narrowed down.
2015-08-27 12:52:54 -07:00
Baratali Izmailov 33b12f5f3d Issue #1566: Added NPathComplexityCheck to checkstyle_checks 2015-08-27 13:23:44 -04:00
Baratali Izmailov a21164df1f Issue #1566: Fixed NPathComplexity violation in JavadocMethodCheck 2015-08-27 09:54:28 -07:00
Baratali Izmailov a8ad56697b Issue #1566: Added ExecutableStatementCountCheck to checkstyle_checks 2015-08-27 10:59:14 -04:00
Baratali Izmailov 41740f2d68 Issue #1566: Reducing JavadocUtils method length 2015-08-27 06:30:30 -07:00
Baratali Izmailov 5b01236f52 Issue #1566: Refactoring of JavadocMethodCheck to reduce its method length. 2015-08-27 06:30:30 -07:00
Baratali Izmailov f0e75896a4 Issue #1566: Reducing CheckstyleAntTask's method length 2015-08-27 06:30:30 -07:00
Baratali Izmailov 6f1840f011 Issue #1566: Refactoring of JavadocMethodCheck to reduce method's length 2015-08-27 06:30:29 -07:00
Michal Kordas 8e168c23bd Add argument to exception constructor invocation. #1555
Fixes `NewExceptionWithoutArguments` inspection violation.

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-27 05:51:28 -07:00
Michal Kordas 55c92042eb Fix various typos in Java 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-27 05:50:48 -07:00
Michal Kordas 896af516b0 Remove unnecessary this keyword. #1555
Fixes `UnnecessaryThis` inspection violations.

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-27 05:49:35 -07:00
Michal Kordas 15d0f87f15 Remove redundant throws declarations. #1555
Fixes `RedundantThrows` inspection violations.

Description:
>This inspection reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations/derivatives.
2015-08-27 05:47:04 -07:00
Michal Kordas 8b70948104 Use explicit charset in test code. #1555
Fixes some `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-27 05:46:11 -07:00
Michal Kordas db19563633 Use constant for empty array initialization. #1555
Fixes `ZeroLengthArrayInitialization` inspection violations.

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-27 05:45:32 -07:00
Michal Kordas 24d7448294 Rename boolean methods to start with question word. #1555
Fixes some `BooleanMethodNameMustStartWithQuestion` inspection violations.

Description:
>Reports boolean methods whose names do not start with a question word. Boolean methods that override library methods are ignored by this inspection
2015-08-27 05:44:55 -07:00
Michal Kordas 13a49cc45b Mark method as static. #1555
Fixes `MethodMayBeStatic` inspection violation introduced in recent commit.

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-27 05:43:52 -07:00
Michal Kordas 95bfc1ce4b Remove unused field. #1555
Fixes `FieldMayBeStatic` inspection violations.

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-27 05:43:07 -07:00
Michal Kordas 738c7f184d Use compiled pattern instead of dynamic regexp. #1555
Fixes `DynamicRegexReplaceableByCompiledPattern` 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-27 05:42:30 -07:00
Michal Kordas 60ae95a621 Remove call to default toString() implementation. #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-27 05:41:39 -07:00
Ruslan Diachenko aa4e40e550 Issue #1566: partial fix of ReturnCount violations 2015-08-27 05:40:07 -07:00
Ruslan Diachenko 2af34e2adc Issue #1566: partial fix of ReturnCount violations 2015-08-27 05:39:34 -07:00
Ruslan Diachenko 5478613082 Issue #1566: partial fix of ReturnCount violations 2015-08-27 05:34:15 -07:00
Ruslan Diachenko c6a70d4cca Issue #1566: partial fix of ReturnCount violations 2015-08-27 05:31:50 -07:00
Ruslan Diachenko adebc9da6f Issue #1566: partial fix of ReturnCount violations 2015-08-27 05:30:54 -07:00
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
Ilja Dubinin f6e48c40b9 Indentation fix for pom.xml. Issue #46 2015-08-26 22:37:54 +01:00
Ilja Dubinin e85813fa81 Elemnt should be on a new line sonar check fixed for pom.xml. Ixxue #46 2015-08-26 22:02:24 +01: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