Commit Graph

2658 Commits

Author SHA1 Message Date
Roman Ivanov 032faf4eb4 fix and suppressions for Findbugs violations UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR. Issue #912 2015-04-12 23:45:56 -07:00
Roman Ivanov 7dd24c8c35 fix for Findbugs violations NM_CONFUSING. Issue #912 2015-04-11 15:41:46 -07:00
Roman Ivanov e1d0e7f636 fix for findbugs RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE. Issue #912 2015-04-10 16:20:20 -07:00
Michal Kordas d9415ac10c Fix PMD violation from 'migrating' ruleset, issue #869 2015-04-10 10:21:23 -07:00
Michal Kordas fc0d10e8f4 Fix PMD violations from 'braces' ruleset, issue #876 2015-04-09 16:10:31 -07:00
Roman Ivanov 2493166c3d minor changes for link to SuppressWarningsHolder 2015-04-09 15:14:13 -07:00
Roman Ivanov 702a1a9576 fix for Findbugs violation DM_DEFAULT_ENCODING. Issue #778 2015-04-08 22:37:46 -07:00
Roman Ivanov fb68212a18 fix for Findbugs violation DM_DEFAULT_ENCODING. Issue #778 2015-04-08 13:17:25 -07:00
Michal Kordas 95fc97c6d8 Fix PMD violations from 'typeresolution' ruleset, issue #875 2015-04-08 21:11:54 +02:00
Roman Ivanov 362abdf0ca fix for EI_EXPOSE_REP. Issue #778 2015-04-08 09:26:09 -07:00
Roman Ivanov a8f5fa3225 fix for EI_EXPOSE_REP. Issue #778 2015-04-08 08:33:04 -07:00
Roman Ivanov 01b9628d34 fix for RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE. Issue #778 2015-04-07 16:36:05 -07:00
Roman Ivanov 547fb51b1d fix for NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH. Issue #778 2015-04-07 16:15:15 -07:00
Roman Ivanov cce20fc3c7 fix for SF_SWITCH_FALLTHROUGH. Issue #778 2015-04-06 23:16:29 -07:00
Roman Ivanov 9619cf2728 fix for SF_SWITCH_FALLTHROUGH. Issue #778 2015-04-06 23:12:13 -07:00
Roman Ivanov 914bf53cd0 resolving PMD issues with braces, removing dead code conditions that are impossible to test, coverage become 100% 2015-04-03 00:25:32 -07:00
Roman Ivanov d58f720c81 MagicNumberCheck: javadoc and xdoc was updated to describe all options, examples were added. Issue #148 2015-04-03 00:25:18 -07:00
ychulovskyy 7a1b0b12a6 Issue #148 magic number detection: option to ignore magic numbers in field declarations 2015-04-03 00:25:05 -07:00
liscju 5026b7228d Added option in ModifiedControlVariable Check to ignore validation of variables defined in for which are not change in for iterator part, fix issue #286 2015-04-01 14:44:18 -07:00
Michal Kordas 3a20dbe8ed Use use Java 7 instead of custom logic for relative paths, issue #857 2015-03-31 11:25:03 -07:00
Michal Kordas cf1d22f39f Use entrySet iterator to fix FindBugs violations, issue #778
These methods accessed the value of a `Map` entry, using a key that was retrieved from a `keySet` iterator. It is more efficient to use an iterator on the `entrySet` of the map, to avoid the `Map.get(key)` lookup.

All violations of FindBugs rule [WMI: Inefficient use of keySet iterator instead of entrySet iterator](http://findbugs.sourceforge.net/bugDescriptions.html#WMI_WRONG_MAP_ITERATOR) are fixed.
2015-03-30 14:01:57 -07:00
Michal Kordas 9923fd6778 Resolve some problems in Javadoc reported by Java 8, issue #291
It is not possible to nest block-level elements, such as `<pre>`, inside `<p>`.
2015-03-30 13:33:22 -07:00
Roman Ivanov 827651af91 release notes 6.5, after content update from Michal Kordas 2015-03-28 08:47:14 -07:00
Roman Ivanov c09360f8e8 release notes 6.5 2015-03-28 08:11:34 -07:00
Damian Szczepanik 97f0829897 Added test method for Utils.isPatternValid method
Pull #861
2015-03-27 15:34:34 -07:00
Damian Szczepanik ebd4afdebe Deleted cache from Utils class + unified setters with patterns
Issue #845
2015-03-27 22:39:02 +01:00
Danil Lopatin c2c34c8408 Token WILDCARD_TYPE was added to WhitespaceAroundCheck, issue #853 2015-03-27 17:39:31 +03:00
Michal Kordas b771841de7 Remove deprecated getLines() methods from Utils, issue #854 2015-03-26 22:15:10 +01:00
Michal Kordas 8a24026433 Add unit tests for class base name util to improve coverage 2015-03-26 20:36:15 +01:00
Michal Kordas 6e6d912013 Add logging to empty catch blocks to fix PMD violations, issue #744
All violations of PMD rule [EmptyCatchBlock](http://pmd.sourceforge.net/pmd-5.2.3/pmd-java/rules/java/empty.html#EmptyCatchBlock) are fixed by logging exceptions.
2015-03-26 20:35:25 +01:00
Michal Kordas 06865630aa Use Guava Closeables to manage closing exceptions
>While it's not safe in the general case to ignore exceptions that are thrown when closing an I/O resource, it should generally be safe in the case of a resource that's being used only for reading, such as a Reader. Unlike with writable resources, there's no chance that a failure that occurs when closing the reader indicates a meaningful problem such as a failure to flush all bytes to the underlying resource.

`Reader` and `InputStream` instances are closed using `Closeables.closeQuietly()`, while `RandomAccessFile` is closed with `Closeables.close()` that throws `IOException` and needs to be handled.

From Javadoc:
>```java
public static void close(@Nullable
         Closeable closeable,
         boolean swallowIOException)
                  throws IOException
```
>Closes a Closeable, with control over whether an IOException may be thrown. This is primarily useful in a finally block, where a thrown exception needs to be logged but not propagated (otherwise the original exception will be lost).
If swallowIOException is true then we never throw IOException but merely log it.

>Example:
```java
   public void useStreamNicely() throws IOException {
     SomeStream stream = new SomeStream("foo");
     boolean threw = true;
     try {
       // ... code which does something with the stream ...
       threw = false;
     } finally {
       // If an exception occurs, rethrow it only if threw==false:
       Closeables.close(stream, threw);
     }
   }
```

Moreover, `Closeables.close()` and  `Flushables.flush()` are used to flush and close `OutputStream`.
2015-03-26 20:35:17 +01:00
Michal Kordas cbfe72383b CustomImportOrder checks import sorting according to ASCII order, fixes #847
Previously used 'ignoreCase' order is different than required ASCII order.
2015-03-25 21:00:55 -07:00
Damian Szczepanik 1dacd5303b Merged catch blocks into one where possible
Pull #825
2015-03-24 14:48:26 -07:00
Michal Kordas 290ae38a14 Remove useless parentheses to fix PMD violations, issue #744
Additional fix for [UselessParentheses](http://pmd.sourceforge.net/pmd-5.2.3/pmd-java/rules/java/unnecessary.html#UselessParentheses) rule.
2015-03-24 12:58:35 -07:00
Michal Kordas b59542ba03 Rename method haastrailComment to hasTrailComment 2015-03-24 12:58:35 -07:00
Michal Kordas b69e47845e Combine nested if statements, issue #744
Additional fixes for PMD rule [CollapsibleIfStatements](http://pmd.sourceforge.net/pmd-5.2.3/pmd-java/rules/java/basic.html#CollapsibleIfStatements).
2015-03-24 12:58:35 -07:00
Michal Kordas 5b4a81a4e1 Invoke private constructors to increase coverage, issue #840 2015-03-24 06:25:58 -07:00
Michal Kordas 7138d731ce Remove null checks on previously dereferenced values, issue #778
Violations of Findbugs rule [RCN: Nullcheck of value previously dereferenced](http://findbugs.sourceforge.net/bugDescriptions.html#RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE) in class `BlockParentHandler` are fixed.
2015-03-23 17:56:11 -07:00
Roman Ivanov 6cd514c9ac note about 100% coverage was added to contributing page 2015-03-23 16:40:29 -07:00
Michal Kordas 14e0b0ea52 Remove unwritten field, issue #778
All violations of Findbugs rule [UwF: Unwritten field](http://findbugs.sourceforge.net/bugDescriptions.html#UWF_UNWRITTEN_FIELD) are fixed.
2015-03-23 16:00:09 -07:00
Michal Kordas fa102b60fa Use value of putIfAbsent to fix Findbugs violation, issue #778
Previously there was slight risk that returned value is not the one that is associated with the key in the map. This could happen if another thread inserted value to map between calls to `get` and `putIfAbsent`.

All violations of Findbugs rule [RV: Return value of putIfAbsent ignored, value passed to putIfAbsent reused](http://findbugs.sourceforge.net/bugDescriptions.html#RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED) are fixed.
2015-03-23 14:03:38 -07:00
Michele Mauro d613c3fe74 removed duplicate section 'UniqueProperties' 2015-03-23 14:08:00 +01:00
Michal Kordas 89b6af6a05 Remove unused constructor parameter to fix PMD violation, issue #744
Fix for [UnusedFormalParameter](http://pmd.sourceforge.net/pmd-5.2.3/pmd-java/rules/java/unusedcode.html#UnusedFormalParameter) rule.
2015-03-21 21:46:08 -07:00
Michal Kordas 04ceb4b91f Remove empty if statements to fix PMD violations, issue #744
Violations of PMD rule [EmptyIfStmt](http://pmd.sourceforge.net/pmd-5.2.3/pmd-java/rules/java/empty.html#EmptyIfStmt) are fixed. All transformations were done by IDE automatically.
2015-03-21 21:45:08 -07:00
Damian Szczepanik 1c8180d74f Added Utils.isPatternValid method to hide try-catch blocks when parsing is used only for validation
Pull #835
2015-03-21 15:38:13 -07:00
Damian Szczepanik 91d979ef8e Reduce complexity in indentation/HandlerFactory class by grouping catch blocks
Pull #833
2015-03-21 15:35:38 -07:00
Michal Kordas 48eee721d9 Remove final from try-with-resources, fixes #805
This is temporary fix. Proper solution is to update cobertura-maven-plugin to 2.7.
2015-03-21 08:17:25 -07:00
Michal Kordas 734c516bd9 Resolve some of Javadoc problems, issue #291 2015-03-20 23:40:25 +01:00
Roman Ivanov 8efe1af92b additional fix for #823 2015-03-20 13:58:09 -07:00
Damian Szczepanik 9f2bf96b20 Delete ///CLOVER comments
Issue #823
2015-03-20 20:57:07 +01:00