Commit Graph

4074 Commits

Author SHA1 Message Date
Vladislav Lisetskiy 2aeea04137 Issue #2074: Correct JavadocTagContinuationIndentation IT 2015-09-15 17:11:43 -07:00
Vladislav Lisetskiy f344001be1 Issue #2074: Correct AtclauseOrder IT 2015-09-15 16:47:09 -07:00
Vladislav Lisetskiy 319b04ff74 Issue #2112: Fix IllegalStateException in JavadocTypeCheck 2015-09-15 09:14:47 -07:00
Vladislav Lisetskiy 38bba612c0 Issue #2108: Split all modules to be separate at config_naming.html 2015-09-15 07:06:14 -07:00
rnveach 59483db973 Issue #157: fix java grammar for unicode escape 2015-09-14 12:58:18 -04:00
Roman Ivanov e5dd96d8dc Issue #2089: fix for checkstyle violations 2015-09-14 06:40:08 -07:00
Roman Ivanov a42475db9e Issue #2089: Allow COMMA again in NoWhiteSpaceBefore 2015-09-14 06:39:08 -07:00
Roman Ivanov 0bff657f61 Issue #2129: logging as WARN for misconfigurated Check is changed to Exception, we should fail fast. 2015-09-13 18:19:24 -07:00
Michal Kordas 0fc8b62a35 Issue #2080: Fix typos in code 2015-09-11 16:32:42 -07:00
Michal Kordas daae0431d1 Issue #2161: Unify naming files with test inputs 2015-09-11 22:48:59 +02:00
Andrei Selkin dba6c944cd Issue #382: Fix HiddenField false positive violations for anonymous classes 2015-09-11 13:14:33 -04:00
Andrei Selkin bd9efb5e66 Issue #759: Create wide message for CheckstyleException in PackageObjectFactory 2015-09-11 18:04:45 +03:00
Roman Ivanov d58e2892c3 doc: improvement of formatting 2015-09-11 07:17:26 -07:00
Ilja Dubinin 526c9d0cba Issue #46: blocks of code should not be duplicated 2015-09-10 17:25:58 -07:00
Michal Kordas c1ce291701 Issue #2130: Fix "deprecation" compiler warnings in input files 2015-09-10 17:12:35 -07:00
Michal Kordas 9e5803a8ec Issue #2130: Fix "rawtypes" compiler warnings in input files 2015-09-10 21:11:44 +02:00
Andrei Selkin a29f01a95b Issue #67: Added support of logging severity for all audit events 2015-09-10 12:57:54 +03:00
Michal Kordas 4687b0b801 Issue #2130: Fix unchecked compiler warnings in input files 2015-09-09 15:58:56 -07:00
Andrei Selkin af9ed7386d Issue #606: Reorganized sections in eclipse.xml 2015-09-09 11:29:20 -07:00
Andrei Selkin e52892ba62 Issue #606: Extended Eclipse user guide for newbies of Checkstyle 2015-09-09 11:29:20 -07:00
Ilja Dubinin b9cad4d385 doc: examles order for DescedantTokenCheck has been changed. 2015-09-09 01:56:54 +01:00
Michal Kordas c0d3652d1b Issue #2135: Fix exception at NeedBraces check in enhanced for loops 2015-09-08 22:23:23 +02:00
Phillip Webb f7698ed23b Issue #2141: Allow @return tags from annotation types 2015-09-07 22:37:23 -07:00
Roman Ivanov 66b07f10af Issue #46: suppression was added to false-positive that IntelijIdea found in previous commit 2015-09-07 18:35:06 -07:00
Ilja Dubinin 33ab409c4e Issue #46: loops should not have more then one break or continue statement 2015-09-08 01:02:50 +01:00
Michal Kordas 4ae3c95822 Issue #2137: Make test for FileTabCharacter locale and OS independent 2015-09-07 22:57:18 +02:00
Roman Ivanov 78103da033 Issue #2080: name violations are fixed, checkstyle suppressions were updated to validate names in tests too 2015-09-06 17:23:55 -07:00
Roman Ivanov dc90dd2845 inspection suppression was moved to javadoc 2015-09-06 15:54:01 -07:00
Roman Ivanov 9ef8a38684 Revert "Issue #2065: additional attempt to resolve violation on TeamCity, DeclareCollectionAsInterface is disabled"
This reverts commit 18d5fd7eeb.
2015-09-06 15:37:09 -07:00
Roman Ivanov a36ac91b27 Revert "Issue #2065: additional attempt to resolve violation on TeamCity"
This reverts commit 652848ae06.
2015-09-06 15:36:39 -07:00
Michal Kordas 20b73ed383 Issue #2131: Add inspection scope profile for IDEA analysis 2015-09-06 22:55:23 +02:00
Michal Kordas ccf2d8315c Issue #1555: Remove usage of obsolete junit.framework.Assert class 2015-09-06 20:15:51 +02:00
Roman Ivanov 18d5fd7eeb Issue #2065: additional attempt to resolve violation on TeamCity, DeclareCollectionAsInterface is disabled 2015-09-06 06:34:07 -07:00
Roman Ivanov 652848ae06 Issue #2065: additional attempt to resolve violation on TeamCity 2015-09-06 06:11:24 -07:00
liscju cd10c41ca5 Issue #937: added tests for validating commit message. 2015-09-06 05:32:26 -07:00
Michal Kordas 4d8d047f46 Issue #2080: Fix typos in code
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-09-06 14:17:36 +02:00
Roman Ivanov 5dffb5a301 Revert "minor: Intelij violation(Redundant suppression) is resolved"
This reverts commit 7e6084f236.
2015-09-05 17:26:51 -07:00
Roman Ivanov 7e6084f236 minor: Intelij violation(Redundant suppression) is resolved 2015-09-05 16:33:55 -07:00
Vladislav Lisetskiy 6f1406f980 Issue #2094: fix StringIndexOutOfBoundsException 2015-09-05 15:24:14 -07:00
Michal Kordas be7f7ed37b Issue #2065: Remove additional context from IDEA suppression
While suppression works fine, it causes false positive in `RedundantSuppression` inspection reported as [IDEA-144818](https://youtrack.jetbrains.com/issue/IDEA-144818).

Tag `@noinspection` is self-descriptive enough on its own.
2015-09-05 15:18:01 -07:00
Michal Kordas d105a27046 Issue #1555: Tune down inspection for overridden parameter names
ParameterNameDiffersFromOverriddenParameter does not require parameters to match names anymore if method is from external library and parameter may be wrongly named there.
2015-09-05 23:07:11 +02:00
Andrei Selkin 0e8002b728 Issue #2092: Corrected xdoc for TranslationCheck. 2015-09-05 20:57:04 +03:00
Andrei Selkin 984fd1cb8f Issue #2092: Activated TranslationCheck in checkstyle_checks.xml. 2015-09-05 16:01:48 +03:00
Michal Kordas d220d7c3cc Issue #2080: Fix typos in code
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-09-04 20:28:43 -04:00
Michal Kordas 31f6765fdc Issue #2080: Fix typos in code
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-09-04 14:48:17 -07:00
Michal Kordas 6839ac4fd8 Issue #2080: Add missing assertions to utils tests
Fixes some `TestMethodWithoutAssertion` inspection violations.

Description:
>Reports test methods of JUnit test case classes that do not contain any assertions. Such methods indicate either incomplete or weak test cases.
2015-09-04 14:47:31 -07:00
Vladislav Lisetskiy 45e3ec229d Issue #1214: Update all Checks html docs with link to hosted
configurations
2015-09-04 05:38:52 -07:00
Andrei Selkin 9acda0b233 Issue #1833: Fixed redundant modifier false positive for abstract classes in interfaces. 2015-09-04 05:32:51 -07:00
Ilja Dubinin 0b4ae9160b Issue #46: loops should not contain more then one break. 2015-09-03 21:24:05 -04:00
Michal Kordas f7e41edb94 Issue #2080: Replace ternary condition operator with if
Fixes `ConditionalExpression` inspection violations.

Description:
>Reports the ternary condition operator. Some coding standards prohibit the use of the condition operator, in favor of if-else statements.
2015-09-03 18:07:24 -07:00
Michal Kordas 2b4a02d2c8 Issue #2080: Fix typos in code
Fixes `SpellCheckingInspection` inspection violations introduced in recent commits.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-09-03 18:06:15 -07:00
Michal Kordas b115e9afe5 Issue #2080: Replace tabs with spaces
Fixes `ProblematicWhitespace` inspection violations introduced in recent commits.

Description:
>Reports tabs used for indentation when the code style is configured to use only spaces.
2015-09-03 18:04:08 -07:00
Michal Kordas 92182aea44 Issue #1555: Rename local variables according to convention
Fixes `LocalVariableNamingConvention` inspection violations introduced in recent commits.

Description:
>Reports local variables whose names are either too short, too long, or do not follow the specified regular expression pattern.
2015-09-03 18:02:23 -07:00
Michal Kordas 1e0de782f6 Issue #1555: Use constants for empty arrays
Fixes `ZeroLengthArrayInitialization` inspection violations introduced in recent commits.

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-09-03 18:02:23 -07:00
Michal Kordas 8cf5116925 Issue #1555: Simplify JUnit assertions
Fixes `SimplifiableJUnitAssertion` inspection violations introduced in recent commits.

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-09-03 18:02:23 -07:00
Michal Kordas ea891b1fd0 Issue #1555: Use proper order in assertEquals assertions
Fixes `MisorderedAssertEqualsParameters` inspection violations introduced in recent commits.

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-09-03 18:02:23 -07:00
Michal Kordas ee7d6e9df3 Issue #1555: Add locale to lower case conversion
Fixes `StringToUpperWithoutLocale` inspection violations introduced in recent commits.

Description:
>Reports any call of toUpperCase() or toLowerCase() on String objects which do not specify a java.util.Locale. Such calls are usually incorrect in an internationalized environment.
2015-09-03 18:02:23 -07:00
Michal Kordas 9ce956473b Issue #1555: Add argument to exception constructor call
Fixes `NewExceptionWithoutArguments` inspection violations introduced in recent commits.

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-09-03 18:02:23 -07:00
Michal Kordas dd7935491a Issue #1555: Narrow scope of variable
Fixes `TooBroadScope` inspection violations introduced in recent commits.

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-09-03 18:02:23 -07:00
Michal Kordas 2085758156 Issue #1555: Replace qualifier with an import
Fixes `UnnecessaryFullyQualifiedName` inspection violations introduced in recent commits.

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-09-03 18:02:23 -07:00
Michal Kordas a3daead123 Issue #2065: Add suppression for IntelliJ IDEA inspection as comment 2015-09-03 21:47:35 +02:00
Vladislav Lisetskiy 6389959930 Issue #2064: ignore classes nested in interaces or annotations in Final
Class Check
2015-09-03 11:11:56 -07:00
Vladislav Lisetskiy c569113723 Issue #2063: Create separate web page for old release notes 2015-09-03 13:52:12 -04:00
Vladislav Lisetskiy f66dcdbd94 Issue #1530: Detect nested enums marked as static in RedundantModifier
check
2015-09-03 06:45:44 -07:00
Andrei Selkin 860e442d53 Issue #1900: Extended javadoc/xdoc for RightCurlyCheck. 2015-09-03 06:34:06 -07:00
Andrei Selkin 8f5c67b836 Issue #1900: Extended violation message for right curly brace policy 'same'. 2015-09-03 06:34:06 -07:00
Andrei Selkin 0689f76ab3 Issue #1903: Fixed NPE in MutableExceptionCheck.isExtendedClassNamedAsException . 2015-09-03 06:17:12 -07:00
Andrei Selkin 0b23dba45a Issue #945: Added UT which validates that all checks which exist in classpath are referenced in checkstyle_checks.xml. 2015-09-03 06:11:18 -07:00
Andrei Selkin ab4bce61c5 Issue #945: Added 'IllegalCatch' into checkstyle_checks.xml. 2015-09-03 06:11:18 -07:00
Vladislav Lisetskiy 1455655c75 Issue #2074: Correct SummuryJavadoc IT 2015-09-03 06:05:15 -07:00
Vladislav Lisetskiy 54c907e6ae Issue #2062: Change message in SummaryJavadocCheck 2015-09-03 06:04:13 -07:00
Michal Kordas 137caa82cb Issue #2065: Add suppression for IntelliJ IDEA inspection
Inspection in this case is right. Parameter `Properties` can be replaced with `Map<Object, Object>`. It works fine with Checkstyle, but it breaks binary compatiblity with Maven Checkstyle Plugin, which is not acceptable.
2015-09-03 05:55:42 -07:00
Andrei Selkin 0b6d22e69b Issue #2029: New option 'switchBlockAsSingleDecisionPoint' for CyclomaticComplexityCheck. 2015-09-03 05:51:41 -07:00
Ilja Dubinin 4ea84c811b Issue #1290: Coverage has been increased to 100% in AbstractTypeAwareCheck and nested classes 2015-09-03 05:39:43 -07:00
Ilja Dubinin c6c9ad9d33 Issue #1290: coverage has been increased to 100% in TranslationCheck 2015-09-03 05:34:28 -07:00
Ilja Dubinin 2c6e941a26 Issue #1290: Coverage has been increased to 100% in NewLineAtTheEndOfFileCheck 2015-09-03 01:00:31 +01:00
Michal Kordas 14db0ec7e9 Tidy up in release notes 2015-09-02 09:38:01 +02:00
Andrei Selkin ed280ebd0b Minor: refactoring of TreeWalker to increase readability 2015-09-01 21:51:26 -07:00
Andrei Selkin 6f7dfc3c69 Corrected javadoc/xdoc for IllegalTypeCheck 2015-09-01 21:50:33 -07:00
Ilja Dubinin 8607274a92 Issue #46: Loops should not contain more than a single 'break' or 'continue' statement 2015-09-01 21:47:52 -07:00
Ilja Dubinin 6e775898e7 Issue #46: Statements shouldn't be nested too deep. 2015-09-01 20:01:26 +01:00
Roman Ivanov ac4b253d1d release notes 6.10.1 2015-09-01 08:52:16 -07:00
Roman Ivanov af95472a09 Issue #2065: broken compatibility with maven-checkstyle-plugin:2.15 at checkstyle:6.10 2015-09-01 07:24:43 -07:00
Roman Ivanov c1e40c92a0 release notes 6.10 2015-08-31 23:12:04 -07:00
Roman Ivanov 092dd6864f minor: fix for incorrect link 2015-08-31 23:11:25 -07:00
Roman Ivanov 5a52ced14e doc: fix for issue commit message format 2015-08-31 22:16:10 -07:00
Roman Ivanov 3cef81032c Issue #1678: Enable Checkstyle checks for 'gui' package 2015-08-31 21:37:06 -07:00
Michal Kordas b9bdf9f8e1 Issue #1555: Instructions to enable IntelliJ IDEA Inspections 2015-08-31 21:13:47 -07:00
Michal Kordas 2d8f5576bb Issue #1555: Refer to collections by interface
Fixes `DeclareCollectionAsInterface` inspection violations.

Description:
>Reports on declarations of Collection variables made by using the collection class as the type, rather than an appropriate interface.
2015-08-31 21:13:04 -07:00
Michal Kordas 5c5eafaa7e Issue #1555: Replace constructor with setUp() in JUnit test case
Fixes `TestCaseWithConstructor` inspection violations.

Description:
>Reports on JUnit test cases with initialization logic in their constructors. Initialization of JUnit test cases should be done in setUp() methods instead.
2015-08-31 21:11:14 -07:00
Michal Kordas 5a46bdbeea Issue #1555: Remove unnecessary unboxing
Fixes `UnnecessaryUnboxing` inspection violations.

Description:
>Reports "unboxing", e.g. explicit unwrapping of wrapped primitive values. Unboxing 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-31 21:11:14 -07:00
Michal Kordas eb31210db6 Issue #1555: Remove unnecessary boxing
Fixes `UnnecessaryBoxing` inspection violations.

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-31 21:11:14 -07:00
Baratali Izmailov 5ca472faa6 Issue #1243: Eclipse warnings about unused fields have been fixed. 2015-08-31 21:10:32 -07:00
Michal Kordas 8373465620 Issue #2054: Simplify overqualified CSS element
Fixes `Element (a.dl-link) is overqualified, just use .dl-link without element name.`

Description:
>Using selector like the one bellow is almost every time unnecessary, unless the element name causes the class to behave differently you can omit it. With this you will shrink the file size and speedup your page load time.
2015-08-31 21:10:01 -07:00
Michal Kordas d8418e5ab0 Issue #2054: Remove empty CSS rule
Fixes `Rule is empty` inspection violations.

Description:
>An empty rule is one that doesn't contain any properties, such as:
 ```
  .foo {
  }
```
A lot of times, empty rules appear as a result of refactoring without further cleanup. Eliminating empty rules results in smaller file sizes and less style information for the browser to deal with.
2015-08-31 21:10:01 -07:00
Michal Kordas 4587090b83 Issue #1555: Extract classes to the upper level
Fixes `PackageVisibleInnerClass` inspection violations.

Description:
>Reports package-local inner classes.
2015-08-31 21:08:09 -07:00
Michal Kordas de2c3f153e Issue #1555: Remove redundant initializer
Fixes `UnusedAssignment` inspection violation.

Description:
>This inspection points out the cases where a variable value
2015-08-31 21:06:39 -07:00
Baratali Izmailov 49a0ee8171 Issue #1566: Fixed SummaryJavadocCheck violations. 2015-08-31 15:58:35 -04:00
Ilja Dubinin faa8a0b7a4 Issue #46. Statements shouldn't be nested too deep 2015-08-31 12:49:02 -07:00
Michal Kordas 1a205d4b43 Issue #1555: Rename parameters to match names in overridden methods
Fixes `ParameterNameDiffersFromOverriddenParameter` inspection violation.

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-31 12:28:57 -07:00
Ruslan Diachenko bca6d627ac Issue #1566: WriteTag violations fixed 2015-08-31 20:14:01 +01:00
Ruslan Diachenko c899af31c1 Issue #1566: JavadocParagraph violations fixed 2015-08-31 19:51:27 +01:00
Baratali Izmailov 2b861bd6e1 Issue #1566: Fix for SummaryJavadocCheck's violations (partial) 2015-08-31 14:24:26 -04:00
Ruslan Diachenko a1128cd742 Issue #1566: JavadocTagContinuationIndentation violations fixed 2015-08-31 18:43:28 +01:00
Baratali Izmailov 5ca9667952 Issue #1566: Fix for SummaryJavadocCheck's violations (partial) 2015-08-31 13:02:55 -04:00
Baratali Izmailov cf85a72f3d Issue #1566: Fix for SingleLineJavadoc's violations 2015-08-31 11:49:51 -04:00
Ruslan Diachenko 54ff2757df Issue #1566: OverloadMethodsDeclarationOrder violations fixed 2015-08-31 06:58:02 -07:00
Ruslan Diachenko 39f752cd88 Issue #1566: VariableDeclarationUsageDistance violations fixed 2015-08-31 14:17:55 +01:00
Michal Kordas 879864502b Issue #1555: Rename parameters to match names
Fixes `ParameterNameDiffersFromOverriddenParameter` inspection violation.

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-30 22:13:06 -07:00
Michal Kordas 4b95f33697 Issue #1555: Collapse if statement
Fixes `IfStatementWithIdenticalBranches` inspection violation.

Description:
>Reports if statements with identical "then" and else branches. Such statements are almost certainly programmer error.
2015-08-30 22:12:38 -07:00
Michal Kordas 74566f21a2 Issue #1555: Replace if with switch
Fixes `IfStatementWithTooManyBranches` inspection violation.

Description:
>Reports if statements with too many branches. Such statements may be confusing, and are often the sign of inadequate levels of design abstraction.
2015-08-30 22:12:38 -07:00
Michal Kordas a4e3e3c1af Issue #1555: Narrow scope of variables
Fixes `TooBroadScope` inspection violation.

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-30 22:12:38 -07:00
Ruslan Diachenko 5922d5a673 Issue #1566: IllegalCatch violations fixed for TreeWalker 2015-08-30 22:06:24 -07:00
Ruslan Diachenko 3ef918920c Issue #1566: IllegalCatch violations fixed for CheckstyleAntTask 2015-08-30 22:04:08 -07:00
Ruslan Diachenko d740f2e1cd Issue #1566: IllegalCatch violations fixed for Checker 2015-08-30 22:02:37 -07:00
Baratali Izmailov d693562ab7 Issue #1243: Coverage of DeclarationOrderCheck has been improved 2015-08-30 09:34:48 -07:00
Baratali Izmailov aa581847fe Issue #2031: 'ignoreMethods' option has been removed from DeclarationOrderCheck 2015-08-30 09:34:48 -07:00
Baratali Izmailov b576ccf879 Issue #1566: Fixed CyclomaticComplexity violations in RightCurlyCheck 2015-08-30 06:54:15 -07:00
Baratali Izmailov 11eb99681a Issue #1566: Fixed CyclomaticComplexity violations in IndentationCheckTest 2015-08-30 06:54:15 -07:00
Baratali Izmailov 9c21acf16a Issue #1566: Fixed CyclomaticComplexity violations in RegexpHeaderCheck 2015-08-30 06:54:15 -07:00
Michal Kordas e89837b42e Issue #1555: Mark methods as static
Fixes `MethodMayBeStatic` inspection violation.

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-30 06:53:28 -07:00
Michal Kordas e1a2e66b26 Issue #1555: Replace while with foreach
Fixes `WhileCanBeForeach` inspection violation.

Description:
>Reports while loops which iterate over collections, and can be replaced with the foreach iteration syntax, which is 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-30 06:53:28 -07:00
Michal Kordas 190ce3850f Issue #1555: Make return collection 'unmodifiable'
Fixes `ReturnOfCollectionField` inspection violation.

Description:
>Reports any attempt to return an array or Collection field from a method. Since the array or Collection may have its contents modified by the calling method, this construct may result in an object having its state modified unexpectedly. While occasionally useful for performance reasons, this construct is inherently bug-prone.
2015-08-30 06:53:28 -07:00
Michal Kordas bf4a253173 Issue #1555: Avoid reuse of local variables
Fixes `ReuseOfLocalVariable` inspection violation.

Description:
>Reports local variables that are "reused", overwriting their values with new values unrelated to their original use. Such local variable reuse may be confusing, as the intended semantics of the local variable may vary with each use. It may also be prone to bugs, if code changes result in values that were thought to be overwritten actually being live. It is good practices to keep variable lifetimes as short as possible, and not reuse local variables for the sake of brevity.
2015-08-30 06:53:28 -07:00
Michal Kordas b69c169934 Issue #1555: Remove unused assignment
Fixes `UnusedAssignment` inspection violations.

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-30 06:53:28 -07:00
Michal Kordas f5e4d9b42a Issue #1555: Use try-with-resources to close streams in test code
The issue was stream not being closed at all or closed, but not in finally block.

Fixes some `IOResource` inspection violations.

Description:
>Reports any I/O resource which is not safely closed in a finally block. Such resources may be inadvertently leaked if an exception is thrown before the resource is closed. I/O resources checked by this inspection include java.io.InputStream, java.io.OutputStream, java.io.Reader, java.io.Writer and java.io.RandomAccessFile. I/O resources which are wrapped by other I/O resources are not reported, as the wrapped resource will be closed by the wrapping resource.
2015-08-30 10:21:15 +02:00
Ilja Dubinin 7e1062dea1 Issue #46. statements shouldn't be nested too deep 2015-08-29 22:52:31 -07:00
Ilja Dubinin 603c5bb53e Issue #46: Statements shouldn't be nested too deep 2015-08-29 22:46:58 -07:00
Michal Kordas 7b8a3aa5bb Issue #1555: Fix various typos
Fixes `SpellCheckingInspection` inspection violation.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals
2015-08-29 22:38:45 -07:00
Michal Kordas b372cfa0a8 Issue #1555: Collapse and refactor if statement with identical branches
Fixes `IfStatementWithIdenticalBranches` inspection violation.

Description:
>Reports if statements with identical "then" and else branches.
2015-08-29 22:36:29 -07:00
Michal Kordas f293a21076 Issue #1555: Flip negated if-else
Fixes `NegatedIfElse` inspection violation.

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-29 22:35:08 -07:00
Michal Kordas e81ca8290b Issue #1555: Avoid reuse of local variables
Fixes `ReuseOfLocalVariable` inspection violation.

Description:
>Reports local variables that are "reused", overwriting their values with new values unrelated to their original use. Such local variable reuse may be confusing, as the intended semantics of the local variable may vary with each use. It may also be prone to bugs, if code changes result in values that were thought to be overwritten actually being live. It is good practices to keep variable lifetimes as short as possible, and not reuse local variables for the sake of brevity.
2015-08-29 22:34:14 -07:00
Michal Kordas 2ed00e0af3 Issue #1555: Delete unnecessary imports
Fixes `UnusedImport` inspection violations.

Description:
>Reports any import statements that are unused. Since IDEA can automatically detect and fix such statements with its "Optimize Imports" command, this inspection is mostly useful for off-line reporting on code bases that you don't intend to change.
2015-08-29 22:33:18 -07:00
Michal Kordas 1dcb4b201f Issue #1555: Convert method with array parameter to vararg
Fixes `MethodCanBeVariableArityMethod` inspection violations.

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-29 22:32:25 -07:00
Michal Kordas 0beb5abf9a Issue #1555: Fix malformed JUnit Rule
Fixes `JUnitRule` inspection violations.

Description:
>Reports malformed @Rule/@ClassRule usages:
* Checks for any member that is annotated with @Rule but is not public.
* Checks for any member that is annotated with @ClassRule but is not public or not static.
2015-08-29 22:31:45 -07:00
Michal Kordas 8f16a480da Issue #1555: Remove usage of obsolete junit.framework.Assert
Fixes `UseOfObsoleteAssert` inspection violations.

Description:
>Reports any calls to methods from the junit.framework.Assert class. This class is obsolete and the calls can be replaced by calls to methods from the org.junit.Assert class.
2015-08-29 22:30:30 -07:00
Michal Kordas f418179fce Issue #1555: Rename method returning boolean to use question word
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-29 22:29:43 -07:00
Michal Kordas 1f54d3d689 Issue #1555: Mark methods as static
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-29 22:28:58 -07:00
Michal Kordas f1cd01472d Issue #1555: Remove unused assignments
Fixes `UnusedAssignment` inspection violations.

Description:
>This inspection points out the cases where a variable value is never used after its assignment
2015-08-29 22:28:16 -07:00
Michal Kordas 2ec015a814 Issue #1555: Remove unsafe calls to Class.newInstance()
Fixes `ClassNewInstance` inspection violations.

Description:
>Reports any calls to java.lang.Class.newInstance(). The newInstance method propagates any exception thrown by the no-arg constructor, including checked exceptions. Use of this method effectively bypasses the compile-time exception checking that would otherwise be performed by the compiler. Replacing such a method call with a call to the java.lang.reflect.Constructor.newInstance() method avoids this problem by wrapping any exception thrown by the constructor in a java.lang.reflect.InvocationTargetException.
2015-08-29 22:27:18 -07:00
Michal Kordas f96930d1a7 Issue #1555: Use function after definition
Fixes some `JSLint` inspection violations.

Description:
>JSLint: 'main' was used before it was defined.
2015-08-29 22:26:30 -07:00
Michal Kordas a1dba1d4a1 Issue #1555: Use previously unused parameter
Fixes `UnusedParameters` inspection violations.

Description:
>This inspection reports parameters that are not used by their methods and all method implementations/overriders.
2015-08-29 17:51:45 -07:00
Michal Kordas c74d7b7549 Issue #1555: Use try-with-resources in test code
The issue was stream not being closed at all or closed, but not in finally block.

Fixes some `IOResource` inspection violations.

Description:
>Reports any I/O resource which is not safely closed in a finally block. Such resources may be inadvertently leaked if an exception is thrown before the resource is closed. I/O resources checked by this inspection include java.io.InputStream, java.io.OutputStream, java.io.Reader, java.io.Writer and java.io.RandomAccessFile. I/O resources which are wrapped by other I/O resources are not reported, as the wrapped resource will be closed by the wrapping resource.
2015-08-29 17:49:43 -07:00
Michal Kordas 7b0388ee96 Issue #1555: Replace for loop that misses component with while loop
Fixes `ForLoopWithMissingComponent` inspection violation.

Description:
>Reports for loops that lack initialization, condition, or update clauses. Some coding styles prohibit such loops.
2015-08-29 15:43:48 -07:00
Michal Kordas 1ad7c80579 Issue #1555: Replace complex boolean expression with set of tokens
Fixes `OverlyComplexBooleanExpression` inspection violation.

Description:
>Reports boolean expressions with too many terms. Such expressions may be confusing and bug-prone.
2015-08-29 15:42:25 -07:00
Ruslan Diachenko 936501d034 Issue #1566: 'missing javadoc comment' violations fixed in Main, AbstractTreeTableModel 2015-08-29 15:39:56 -07:00
Ruslan Diachenko c70cf22d39 Issue #1566: 'missing javadoc comment' violations fixed in ParseTreeModel, TreeTableModelAdapter 2015-08-29 15:39:06 -07:00
Ruslan Diachenko 60b7d4a59d Issue #1566: 'missing javadoc comment' violations fixed in ParseTreeInfoPanel 2015-08-29 15:38:35 -07:00
Ruslan Diachenko 6731df9da7 Issue #1566: 'missing javadoc comment' violations fixed in JTreeTable 2015-08-29 15:37:52 -07:00
Ruslan Diachenko 6a39af3d61 Issue #1566: 'missing javadoc comment' violations fixed in FileDrop 2015-08-29 15:37:24 -07:00
Ruslan Diachenko f0e57dd3c5 Issue #1566: 'missing javadoc comment' violations fixed in CodeSelector 2015-08-29 15:36:58 -07:00
Ruslan Diachenko 1198054650 Issue #1566: 'missing javadoc comment' violations fixed in AbstractJavadocCheck 2015-08-29 15:30:45 -07:00
Ruslan Diachenko 22af64a28c Issue #1566: 'missing javadoc comment' violations fixed for Check, JavadocNodeImpl 2015-08-29 20:39:01 +01:00
Ruslan Diachenko c6e035bb66 Issue #1566: 'missing javadoc comment' violations fixed for JavadocTokenTypes 2015-08-29 20:13:50 +01:00
Baratali Izmailov f32bcd07ee Issue #1566: Fixed CyclomaticCompexityCheck violation in RightCurlyCheck 2015-08-29 14:47:22 -04:00
Baratali Izmailov 9ae0be5921 Issue #1566: Fixed CyclomaticComplexityCheck violation (partial) 2015-08-29 09:41:11 -04:00
Michal Kordas 3d9f726c2d Issue #1555: Decrease visibility of public constructor in non-public class
Fixes `PublicConstructorInNonPublicClass` inspection violations.

Description:
>Reports all constructors in non-public classes that are declared public.
2015-08-29 06:13:47 -07:00
Michal Kordas 9cd3660fd5 Issue #1555: Remove usage of obsolete collection
Fixes `ObsoleteCollection` inspection violations.

Description:
>Reports any uses of java.util.Vector or java.util.Hashtable. While still supported, these classes were made obsolete by the JDK1.2 collection classes, and should probably not be used in new development.
2015-08-29 06:12:45 -07:00
Michal Kordas e2f265251a Issue #1555: Avoid reusing variables
Fixes `ReuseOfLocalVariable` inspection violation.

Description:
>Reports local variables that are "reused", overwriting their values with new values unrelated to their original use. Such local variable reuse may be confusing, as the intended semantics of the local variable may vary with each use. It may also be prone to bugs, if code changes result in values that were thought to be overwritten actually being live. It is good practices to keep variable lifetimes as short as possible, and not reuse local variables for the sake of brevity.
2015-08-29 06:12:16 -07:00
Michal Kordas 531327f8c7 Issue #1555: Remove catch of unexpected exceptions in tests
Test will fail anyway, and failure message along with stacktrace will not be lost.
2015-08-29 06:11:42 -07:00
Michal Kordas f3ab307142 Issue #1555: Rename variables with unused exceptions
Fixes `UnusedCatchParameter` inspection violations.

Description:
>Reports any catch parameters that are unused in their corresponding blocks. This inspection will not report any catch parameters named "ignore" or "ignored". Conversely this inspection will warn on any catch parameters named "ignore" or "ignored" that are actually used.
2015-08-29 06:11:42 -07:00
Aleksandr Ivanov 4913b287c0 fixed problem with lexical order in CustomImportOrder #1469 2015-08-28 23:32:56 -07:00
Ruslan Diachenko ef1e65fb51 Issue #1566: ReturnCount violation fixed for CheckUtils 2015-08-28 23:06:51 -07:00
Ruslan Diachenko a09875b9f9 Issue #1566: ReturnCount violation fixed for ParseTreeModel 2015-08-28 23:05:38 -07:00
Ruslan Diachenko e66c64585f Issue #1566: ReturnCount violation fixed for SuppressionCommentFilter 2015-08-28 23:00:10 -07:00
Ruslan Diachenko c3c1b9ae06 Issue #1566: ReturnCount violation fixed for SuppressWithNearbyCommentFilter 2015-08-28 22:59:41 -07:00
Michal Kordas c3674faad8 Issue #1555: Fix some typos in checks package
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-08-28 22:59:11 -07:00
Michal Kordas 07b24dd81c Issue #1555: Fix various typos
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-08-28 22:53:43 -07:00
Michal Kordas 46a52f84c0 Issue #1555: Rename methods returning boolean to use question word
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-28 22:50:51 -07:00
Ruslan Diachenko 904de34fcd Issue #1566: ReturnCount violation fixed for WhitespaceAroundCheck 2015-08-28 22:49:55 -07:00
Michal Kordas e9ec5bfbd5 Issue #1555: Avoid reusing variables
Fixes some `ReuseOfLocalVariable` inspection violations.

Description:
>Reports local variables that are "reused", overwriting their values with new values unrelated to their original use. Such local variable reuse may be confusing, as the intended semantics of the local variable may vary with each use. It may also be prone to bugs, if code changes result in values that were thought to be overwritten actually being live. It is good practices to keep variable lifetimes as short as possible, and not reuse local variables for the sake of brevity.
2015-08-28 22:49:12 -07:00
Michal Kordas 9cc86b38df Issue #1555: Specify encoding explicitly
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-28 22:48:12 -07:00
Ruslan Diachenko a827b7cbbf Issue #1566: ReturnCount violation fixed for ModifierOrderCheck 2015-08-28 22:47:37 -07:00
Ruslan Diachenko c3af7d4b0e Issue #1566: ReturnCount violation fixed for JavadocStyleCheck 2015-08-28 22:46:44 -07:00
Ruslan Diachenko 8da3b6dea4 Issue #1566: ReturnCount violation fixed for AbstractJavadocCheck 2015-08-28 22:45:58 -07:00
Ruslan Diachenko 7b26e83b92 Issue #1566: ReturnCount violation fixed for AbstractExpressionHandler 2015-08-28 22:45:17 -07:00
Ruslan Diachenko f02d45fd6d Issue #1566: ReturnCount violation fixed for DesignForExtensionCheck 2015-08-28 22:44:41 -07:00
Michal Kordas f58f92adf6 Issue #1555: Fix false-positive in mismatched array read write rule
False-positive reported to JetBrains as [IDEA-144521](https://youtrack.jetbrains.com/issue/IDEA-144521).

Fixes `MismatchedArrayReadWrite` inspection violations.

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-28 22:43:58 -07:00
Michal Kordas 8985e645a8 Issue #1555: Rename boolean methods to start with question word
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-28 22:43:04 -07:00
Michal Kordas 1e541f0b98 Issue #1555: Delete unnecessary imports
Fixes `UnusedImport` inspection violations.

Description:
>Reports any import statements that are unused. Since IDEA can automatically detect and fix such statements with its "Optimize Imports" command, this inspection is mostly useful for off-line reporting on code bases that you don't intend to change.
2015-08-28 22:42:18 -07:00
Michal Kordas 83396526ac Issue #1555: Use constant for empty array of zero length
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-28 22:41:09 -07:00
Michal Kordas 4d0c118595 Issue #1555: Remove unnecessary boxing
Fixes `CachedNumberConstructorCall` inspection violations.

Description:
>Reports any attempt to instantiate a new Long, Integer, Short or Byte object from a primitive long, integer, short or byte argument. It may be more efficient to use the static method valueOf() here (introduced in Java 5), which will cache objects for values between -128 and 127 inclusive.
This inspection only reports if the project or module is configured to use a language level of 5.0 or higher.
2015-08-28 22:40:36 -07:00
Ruslan Diachenko 3e0159aeb5 Issue #1566: ReturnCount violation fixed for UnnecessaryParenthesesCheck 2015-08-28 22:39:52 -07:00
Baratali Izmailov 9cf023696c Issue #1566: ClassDataAbstractionCoupling's xdocs updated 2015-08-28 22:39:03 -07:00
Ruslan Diachenko 83f2b92b18 Issue #1566: ReturnCount violation fixed for SimplifyBooleanReturnCheck 2015-08-28 22:38:31 -07:00
Michal Kordas 94f9754acb Issue #1555: Decrease visibility of fields and methods in test code
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-28 22:37:17 -07:00
Michal Kordas ef834b210c Issue #1555: Narrow scope of variable
Fixes `TooBroadScope` inspection violations introduced in recent commit.

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-28 22:36:30 -07:00
Michal Kordas 7c9772cee7 Issue #1555: Flip negated if-else
Fixes `NegatedIfElse` inspection violations introduced in recent commit.

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-28 22:35:09 -07:00
Michal Kordas 10b36a4ad5 Issue #1555: Remove unnecessary this keyword
Fixes `UnnecessaryThis` inspection violations introduced in recent commit.

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-28 22:34:23 -07:00
Michal Kordas b76b91e67a Issue #1555: Remove unused parameters
Fixes some `UnusedParameters` inspection violations.

Description:
>This inspection reports parameters that are not used by their methods and all method implementations/overriders.
2015-08-28 22:29:30 -07:00
Andrei Selkin 502404055f Provided UTs to check token sets for all checkstyle checks, issue #655 2015-08-28 22:48:21 +03:00
Andrei Selkin e64159f63b Corrected default, required and acceptable tokens for SimplifyBooleanExpressionCheck, issue #655 2015-08-28 22:48:20 +03:00
Andrei Selkin ae3861225a Corrected default, required and acceptable tokens for RequireThisCheck, issue #655 2015-08-28 22:48:20 +03:00
Andrei Selkin 37389ac4c4 Corrected default and acceptable tokens for JavadocMethodCheck, issue #655 2015-08-28 22:48:20 +03:00
Andrei Selkin 69e5f9319c Corrected acceptable tokens for IllegalInstantiationCheck, issue #655 2015-08-28 22:48:20 +03:00
Andrei Selkin 0cc53f9aec Corrected acceptable tokens for HiddenFieldCheck, issue #655 2015-08-28 22:48:20 +03:00
Roman Ivanov 1e7ae5866d Fix build problem caused by previous commit 2015-08-28 12:09:05 -07:00
liscju da6ebe6de4 Detect public constructors in non-public classes in RedundantModifier,
fixes issue #1537
2015-08-28 10:52:21 -07:00
liscju e088721166 Fixes logic bug in gui ParseTreeInfoPanel making linesToPositions assign
lines to inappropriate positions
2015-08-28 10:49:06 -07:00
Andrei Selkin b79466ba09 Restricted suppression for IllegalTypeCheck, issue #1805 2015-08-28 10:47:02 -07:00
Andrei Selkin 7518054428 Added 'validateAbstractClassNames' option for IllegalTypeCheck, issue #1805 2015-08-28 10:47:02 -07:00
Baratali Izmailov ee84bccfe1 Issue #1566: Fixed JavaNSCC violations 2015-08-28 10:45:59 -07:00
Vladislav Lisetskiy 0024de5711 reimplement EqualsAvoidNullCheck, #1377 2015-08-28 13:41:53 +03:00
Ilja Dubinin 6f937bff1d Coverage has been increased to 100% in UniquePropertiesCheck. Issue #1290 2015-08-27 23:20:40 -07:00
Ruslan Diachenko 4ee4d60e07 Issue #1566: ReturnCount violation fixed for FallThroughCheck 2015-08-27 23:09:25 -07:00
Ruslan Diachenko 9241c0a692 Issue #1566: ReturnCount violation fixed for ExplicitInitializationCheck 2015-08-27 22:58:59 -07:00
Ruslan Diachenko 99ce97725c Issue #1566: ReturnCount violation fixed for RequireThisCheck 2015-08-27 22:56:57 -07:00
Ruslan Diachenko 5a3f05ec80 Issue #1566: ReturnCount violation fixed for AbstractSuperCheck 2015-08-27 22:55:20 -07:00
Ruslan Diachenko 7410a9f8bf Issue #1566: ReturnCount violation fixed for MagicNumberCheck 2015-08-27 22:53:36 -07:00
Ruslan Diachenko 9ddad74e48 Issue #1566: ReturnCount violation fixed for LeftCurlyCheck 2015-08-27 22:51:40 -07:00
Ruslan Diachenko 46378dadb5 Issue #1566: ReturnCount violation fixed for IllegalInstantiationCheck 2015-08-27 22:37:45 -07:00
Ruslan Diachenko 12bd833406 Issue #1566: ReturnCount violation fixed for UncommentedMainCheck 2015-08-27 22:34:44 -07:00
Ruslan Diachenko c9346746dc Issue #1566: ReturnCount violation fixed for FileContents 2015-08-27 22:33:56 -07:00
Ruslan Diachenko e4282ad407 Issue #1566: ReturnCount violation fixed for DetailAST 2015-08-27 22:33:18 -07:00
Michal Kordas d972822d63 Remove unused assignment. #1555
Fixes `UnusedAssignment` inspection violations.

Description:
>This inspection points out the cases where a variable value is never used after its assignment.
2015-08-27 22:32:14 -07:00
Michal Kordas a384794ade 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 22:31:35 -07:00
Michal Kordas 95f8b08af8 Decrease visibility of fields and methods in main and utils packages. #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 22:30:55 -07:00
Michal Kordas 4f5a400f12 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 22:29:46 -07:00
Michal Kordas cc7aeaec90 Fix some typos in coding package. #1555
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-08-27 22:29:12 -07:00
Michal Kordas b14f255427 Fix typos in properties. #1555
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-08-27 22:28:39 -07:00
Michal Kordas cb5a59fc6b Fix typos in blocks, headers and filters packages. #1555
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-08-27 22:27:48 -07:00
Michal Kordas c57ee4b58a Fix typos in import and java8 packages. #1555
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-08-27 22:26:58 -07:00
Michal Kordas 7eb80732e9 Fix typos in utlis package. #1555
Fixes some `SpellCheckingInspection` inspection violations.

Description:
>Spellchecker inspection helps locate typos and misspelling in your code, comments and literals.
2015-08-27 22:26:27 -07:00
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 a21164df1f Issue #1566: Fixed NPathComplexity violation in JavadocMethodCheck 2015-08-27 09:54:28 -07: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
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
Michal Kordas a244f05705 Remove calls to simple getters withing 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-25 13:05:51 +03:00
Michal Kordas c75c9f00ac Use serializable type of field in serializable class. #1555
Fixes `NonSerializableFieldInSerializableClass` 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-25 13:04:44 +03:00
Michal Kordas 230cd73883 Rename field to not interfere with local variable name. #1555
Fixes `LocalVariableHidingMemberVariable` inspection violation in test code.

Description:
>Reports local variables named identically to visible fields of their class or surrounding classes if it is a local variable inside of an inner or anonymous class. Such a variable name may be confusing.
2015-08-25 13:03:50 +03:00
Michal Kordas abfc952fd0 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-22 14:43:09 +03:00
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 dad4fa599a Fix variables with standard names. #1555
Fixes `StandardVariableNames` inspection violations in test code.

Description:
>Reports on any variables with 'standard' names which are of unexpected types. Such names may be confusing. Standard names and types are as follows:
- i, j, k, m, n - int
- f - float
- d - double
- b - byte
- c, ch - char
- l - long
- s, str - String
2015-08-22 14:40:19 +03:00
Michal Kordas a13ebd482c Use constant for arrays with zero length. #1555
Fixes `ZeroLengthArrayInitialization` inspection violations in test code.

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-22 14:38:41 +03:00
Michal Kordas 04182c6064 Remove unused import from test code. #1555
Fixes `UnusedImport` inspection violations.

Description:
>Reports any import statements that are unused.
2015-08-22 14:37:48 +03:00
Michal Kordas 3d7dcc51c4 Remove duplicates in throws lists. #1555
Fixes `DuplicateThrows` inspection violations.

Description:
>This inspection reports duplicate exceptions in a method throws list.
2015-08-22 14:37:15 +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 19d1fb3602 Use ignored results of calling methods in test code. #1555
Fixes `IgnoreResultOfCall` inspection violations in test code.

Description:
>Reports any calls to specific methods where the result of that call is ignored. Both methods specified in the inspection's settings and methods annotated with org.jetbrains.annotations.Contract(pure=true) are checked. For many methods, ignoring the result is perfectly legitimate, but for some methods it is almost certainly an error. Examples of methods where ignoring the result of a call is likely to be an error include java.io.inputStream.read(), which returns the number of bytes actually read, any method on java.lang.String or java.math.BigInteger, as all of those methods are side-effect free and thus pointless if ignored.
2015-08-22 14:31:32 +03:00
Michal Kordas a846ef9d33 Remove usage of null as argument to varagrs in test code. #1555
Fixes `NullArgumentToVariableArgMethod` inspection violations in test code.

Description:
>Reports any calls to a variable-argument method which has a null in the variable-argument position (e.g System.out.printf("%s", null) ). Such a null argument may be confusing, as it is not wrapped as a single-element array, as may be expected.
2015-08-22 14:30:28 +03:00
Michal Kordas 555478f967 Create new instance using constructor in test code. #1555
Fixes `ClassNewInstance` inspection violations in test code.

Description:
>Reports any calls to java.lang.Class.newInstance(). The newInstance method propagates any exception thrown by the no-arg constructor, including checked exceptions. Use of this method effectively bypasses the compile-time exception checking that would otherwise be performed by the compiler. Replacing such a method call with a call to the java.lang.reflect.Constructor.newInstance() method avoids this problem by wrapping any exception thrown by the constructor in a java.lang.reflect.InvocationTargetException.
2015-08-22 14:29:30 +03:00
Michal Kordas 70ac1c44d9 Do not use Properties as Hashtable. #1555
Fixes `UseOfPropertiesAsHashtable` inspection violations in test code.

Description:
>Reports any calls to the java.util.Hashtable methods put(), putAll() or get() on a java.util.Properties object. For reasons lost to history, Properties inherits from Hashtable, but use of those methods is discouraged to prevent corruption of properties values with non-String data.
2015-08-22 14:28:37 +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 984409e0cd Add missing space in JavaScript code. #1555
Fixes some `JSLint` inspection violations.

Description:
>JSLint: Missing space between 'for' and '('. (at line 9)
2015-08-21 16:17:03 +03:00
Michal Kordas 7e6f2135a9 Remove unnecessary toString() call in test code. #1555
Fixes `UnnecessaryToStringCall` inspection violations in test code.

Description:
>Reports on any calls to toString() used in string concatenations and as arguments to the print() and println() methods of java.io.PrintWriter and java.io.PrintStream, the append() method of java.lang.StringBuilder and java.lang.StringBuffer or the trace(), debug(), info(), warn() and error() methods of org.slf4j.Logger. In these cases the conversion to string will be handled by the underlying library methods and an explicit call to toString() is no needed.
Note that without the toString() call the expression will have slightly different semantics (the string null will be used instead of throwing a NullPointerException).
2015-08-21 16:16:01 +03:00
Michal Kordas 4cdea36a1e 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-21 16:14:25 +03:00
Michal Kordas aa950f0697 Remove unnecessarily qualified statically imported elements. #1555
Fixes `UnnecessarilyQualifiedStaticallyImportedElement` inspection violations in test code.

Description:
>Reports any references to static members which are statically imported and also qualified with their containing class name. Because the elements are already statically imported such qualification is unnecessary and can be removed.
2015-08-21 16:13:37 +03:00
Michal Kordas 613ac4bb77 Remove unnecessary constant array creation expressions. #1555
Fixes `UnnecessaryConstantArrayCreationExpression` inspection violations in test code.

Description:
>Reports any constant new array expression which can be replaced with an array initializer. Array initializers omit the type declaration because that is already specified by the declaration of the variable the expression is assigned to.
2015-08-21 16:12:44 +03:00
Michal Kordas 074b36894e Remove unnecessary parentheses in test code. #1555
Fixes `UnnecessaryParentheses` inspection violations in test code.

Description:
>Reports on any instance of unnecessary parentheses. Parentheses are considered unnecessary if the evaluation order of an expression remains unchanged if the parentheses are removed.
2015-08-21 16:11:45 +03:00
Michal Kordas 885fca8fe9 Remove call to printStackTrace() in test code. #1555
Fixes `ThrowablePrintStackTrace` inspection violations in test code.

Description:
>Reports any calls to Throwable.printStackTrace() without arguments. Such statements are often used for temporary debugging, and should probably be either removed from production code, or replaced with a more robust logging facility.
2015-08-21 16:11:08 +03:00
Michal Kordas b543f32fd7 Use field that was unused and remove suppression. #1555
Fixes `SuppressionAnnotation` inspection violations in test code.

Description:
>Reports any inspection suppression comments or annotations.
2015-08-21 16:10:34 +03:00
Michal Kordas cea7f4acbe Remove redundant throws. #1555
Fixes `RedundantThrows` inspection violations in test code.

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-21 16:09:26 +03:00
Michal Kordas 5e1cf30d49 Add missing locale to String case conversions in test code. #1555
Fixes `StringToUpperWithoutLocale` inspection violations in test code.

Description:
>Reports any call of toUpperCase() or toLowerCase() on String objects which do not specify a java.util.Locale. Such calls are usually incorrect in an internationalized environment.
2015-08-21 16:08:19 +03:00
Michal Kordas 3db243d947 Use String instead of constant in test code. #1555
Fixes `NumericToString` inspection violations in test code.

Description:
>Reports any call of toString() on numeric objects. Such calls are usually incorrect in an internationalized environment.
2015-08-21 16:07:47 +03:00
Michal Kordas d3dcf0474a Use multi-catch in test code. #1555
Fixes `TryWithIdenticalCatches` inspection violations in test code.

Description:
>Reports identical catch sections in try blocks under JDK 7. A quickfix is available to collapse the sections into a multi-catch section.
This inspection only reports if the project or module is configured to use a language level of 7.0 or higher.
2015-08-21 16:07:15 +03:00
Michal Kordas 8d898f7ceb Simplify throws list in test code. #1555
Fixes `MultipleExceptionsDeclaredOnTestMethod` inspection violations.

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-21 16:06:47 +03:00
Michal Kordas b2384741dc Use constants for empty arrays. #1555
Fixes some `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-21 15:55:21 +03:00
Michal Kordas d4ef19e679 Fix confusing variable names. #1555
Fixes `StandardVariableNames` inspection violations in test code.

Description:
>Reports on any variables with 'standard' names which are of unexpected types. Such names may be confusing. Standard names and types are as follows:
- i, j, k, m, n - int
- f - float
- d - double
- b - byte
- c, ch - char
- l - long
- s, str - String
2015-08-21 15:53:51 +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 1dd631b5e3 Make field private static. #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-21 15:52:00 +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
Michal Kordas 6d2f3ce5fa Remove redundant overriding methods. #1555
Fixes `RedundantMethodOverride` inspection violations in test code.

Description:
>Reports any method that has a body and signature that are identical to its super method. Such a method is redundant and probably a coding error.
2015-08-21 15:14:34 +03:00
Baratali Izmailov 23a1b6253f Issue #1566: Fix for 'Don't use trailing comments' (partial) 2015-08-21 15:05:41 +03:00
Michal Kordas fa5a88bc1e Fix name for constants in test code. #1555
Fixes `ConstantNamingConvention` inspection violations 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-21 14:26:47 +03:00
Michal Kordas 5f46a3b3fa Use varargs. #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-20 22:41:28 +02:00
Michal Kordas 4a56989f8e Fix too broad scope of variables. #1555
Additionally, obsolete assertions were removed.

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-20 08:10:15 +03:00
Ruslan Diachenko 0da1e4d980 Issue #1566: ReturnCount violations (partial fix) 2015-08-20 08:06:05 +03:00
Michal Kordas 03f4181580 Rename static methods not following convention in test code. #1555
Fixes `StaticMethodNamingConvention` inspection violations in test code.

Description:
>Reports static methods whose names are either too short, too long, or do not follow the specified regular expression pattern.
2015-08-20 08:03:54 +03:00