Commit Graph

681 Commits

Author SHA1 Message Date
Michal Kordas 8a3f5bf6d5 Remove unused assignments. #1555
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-08 07:12:41 +03:00
Michal Kordas 7d513f08c2 Copy collections and arrays before assigning to fields. #1555
Fixes AssignmentToCollectionFieldFromParameter violations.

 Description:
>Reports any attempt to assign an array or Collection field from a method parameter. 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-08 07:11:07 +03:00
Ruslan Diachenko 68959eeeff Issue #1566: AvoidNestedBlocks, FinalLocalVariable, RegexpSingleline (THIS as a lock) violations fixed 2015-08-08 07:08:28 +03:00
Andrei Selkin 782da01103 Fixed overly strong type cast, issue #1555. 2015-08-08 06:59:27 +03:00
Michal Kordas b0d1f7fd52 Remove redundant characters from regular expressions. #1555
Fixes:
* Obsolete single repetition
* Redundant character escapes
2015-08-06 06:32:36 +03:00
Baratali Izmailov dd5562f6dc Issue #1293: Improved coverage for ReturnCountCheck 2015-08-06 06:29:22 +03:00
Roman Ivanov ead1a5e5dc 100% UTs coverage for Checker (no way to reproduce/mock IOException). #1294 2015-08-05 17:06:17 +03:00
Roman Ivanov a2da840df3 100% UTs coverage for TreeWalker. #1294 2015-08-05 15:39:51 +03:00
Andrei Selkin d282d5b8db Refactoring of RightCurlyCheck, issue #1511. 2015-08-03 12:03:09 +03:00
Michal Kordas 2880edd655 Decrease scope of variables. #1538 2015-08-02 18:48:58 -07:00
Michal Kordas d49eaaf2e4 Extract increment operations to separate expressions. #1538
While increment or decrement expressions nested inside other expressions are admirably terse, such expressions may be confusing, and violate the general design principle that a given construct should do precisely one thing.
2015-08-02 18:48:58 -07:00
Michal Kordas 85ba2a3dce Replace assignment with operator assignment. #1538 2015-08-02 18:48:58 -07:00
Michal Kordas 4b26a472cc Replace manual array unboxing with ArrayUtils.toPrimitive(). #1538 2015-08-02 18:48:58 -07:00
Michal Kordas 0a6026c9ab Remove unnecessary unboxing. #1538 2015-08-02 18:48:58 -07:00
Michal Kordas 111bd4b1df Collapse 'catch' blocks. #1538 2015-08-02 18:48:58 -07:00
Michal Kordas e6538f822f Replace 'for' loop with 'foreach'. #1538 2015-08-02 18:48:58 -07:00
Michal Kordas 0dc308ff69 Remove unnecessary 'return' statement. #1538 2015-08-02 18:48:58 -07:00
Michal Kordas bf64651a0d Remove redundant if statement. #1538 2015-08-02 18:48:58 -07:00
Michal Kordas 49404dbd70 Replace for loop with simpler while statement. #1538 2015-08-02 18:48:58 -07:00
Michal Kordas 6fd60de0a4 Remove confusing else branches. #1538 2015-08-02 18:48:58 -07:00
Michal Kordas 693e8820d5 Remove fully qualified class names which can be shortened. #1538 2015-08-02 18:48:57 -07:00
Michal Kordas 940eb6509f Remove unnecessary uses of the super qualifier. #1538
A super qualifier is unnecessary when the field or method of the super class is not overridden in the calling class.
2015-08-02 18:48:57 -07:00
Michal Kordas 5c9e55ae70 Use .isEmpty() method instead of comparisons to 0. #1538 2015-08-02 18:48:57 -07:00
Michal Kordas 30438ebdf9 Mark fields final where possible. #1538 2015-08-02 18:48:57 -07:00
Michal Kordas 1ce6badd8f Replace new array expressions with an array initializer. #1538
Array initializers omit the type declaration because that is already specified by the declaration of the variable the expression is assigned to.
2015-08-02 18:48:57 -07:00
Michal Kordas fd794d428c Remove unnecessary consecutive lines in Checkstyle code. #1534 2015-08-02 18:41:32 -07:00
Ilja Dubinin 2e1ab8dd86 100% coverage in OuterType check. Issue #1290 2015-08-02 18:33:12 -07:00
Ilja Dubinin 688d428e55 Coverage has been increased to 100% in TrailingCommentCheck. Issue 1290 2015-08-02 18:32:09 -07:00
Baratali Izmailov d6a255f365 Issue #1539: Fixed NPE in MultipleVariableDeclarationsCheck 2015-08-02 18:30:15 -07:00
Baratali Izmailov b097b3f002 Issue #1293: Improved coverage for FinalLocalVariableCheck 2015-08-02 18:27:52 -07:00
Ruslan Diachenko e794bd04c7 Issue #1296: 'SuppressionsLoader' refactored, UT coverage improved 2015-08-02 16:04:50 +01:00
Michal Kordas 068702d695 Replace StringBuffer with StringBuilder. #46
Fixes squid:S1149 violations.
2015-08-01 13:26:53 -07:00
Michal Kordas 58473e4e73 Make method "static". #46
Fixes squid:S2325 violation.
2015-08-01 13:26:53 -07:00
Michal Kordas 24d8ecc0ae Return expression without assigning it to temporary variable. #46
Fixes squid:S1488 violation.
2015-08-01 13:26:53 -07:00
Michal Kordas 081c654df8 Remove superfluous runtime exception declarations. #46 2015-08-01 13:24:47 -07:00
Michal Kordas fcd823e0d5 Add missing "@Override" annotations. #46 2015-08-01 13:18:29 -07:00
Andrei Selkin 3a5a73d5c1 Added column number into violation messages for RightCurlyCheck and LeftCurlyCheck, issue #1511. 2015-08-01 13:16:25 -07:00
Baratali Izmailov af52963008 Issue #1293: Refactoring of AbstractSuperCheck. Code coverage has been improved. 2015-08-01 13:15:03 -07:00
Andrei Selkin f8ba0d7279 Fix BooleanExpressionComplexity check violations in Checkstyle code, issue #1052 2015-08-01 09:42:45 -07:00
Baratali Izmailov bd55b45981 Issue #1293: Improved coverage for SimplifyBooleanReturnCheck. 2015-08-01 09:24:38 -07:00
Baratali Izmailov d53fc277c6 Issue #1293: Improved coverage for ExplicitInitializationCheck 2015-08-01 06:58:57 -07:00
Baratali Izmailov 5fa34fa1b2 Issue #1293: Refactoring of ParameterAssignmentCheck 2015-08-01 06:58:26 -07:00
Michal Kordas 2c41aaf844 Improve test coverage in AbstractJavadocCheck. #1308 2015-08-01 14:29:18 +02:00
Roman Ivanov 6a97715527 coverage for TreeWalker (move IOException to setCacheFile method signature). #1294 2015-07-31 01:20:13 -07:00
Bhavik Patel b2a80ceca3 Solution to Magic Number is not detected properly #1266 2015-07-30 23:27:01 -07:00
Roman Ivanov 71c16c55c3 100% code coverage for ConfigurationLoader. #1294 2015-07-30 22:52:51 -07:00
Ilja Dubinin dcd7085ce2 Coverage has been increased to 100% in UncommentedMainCheck. Issue #1290 2015-07-30 16:50:12 -07:00
Ruslan Diachenko e3366844c4 Issue #1296: 'SuppressWithNearbyCommentFilter' refactored, UT coverage improved 2015-07-30 22:57:20 +01:00
Michal Kordas af095344e1 Add tests and refactor JavadocMethod check. #1308 2015-07-30 21:46:11 +02:00
Andrei Selkin f1dced161a Add new option for RightCurlyCheck, issue #1019. 2015-07-30 12:40:11 -07:00