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
ychulovskyy
d347f55756
Issue #26 SuppressionCommentFilter does not suppress StrictDuplicateCode Warnings
2015-03-18 22:30:23 -07:00
Michal Kordas
303d7cc618
Replace FastStack with ArrayDeque where possible, issue #86
2015-03-18 21:54:06 -07:00
Michal Kordas
0a70130d57
Replace FastStack with ArrayDeque and avoid nulls, issue #86
...
`FastStack` allows `null` as element while `ArrayDeque` doesn't. To aviod `NullPointerException` null objects were introduced as initial context.
2015-03-18 21:54:06 -07:00
Michal Kordas
f9b7912c97
Replace FastStack with ArrayDeque in PackageNamesLoader, issue #86
...
`FastStack` has opposite iteration order compared to the standard stack, so iteration on the `Deque` needs to be performed using `descendingIterator()`.
2015-03-18 21:54:06 -07:00
Michal Kordas
408dd9d71d
Deprecate FastStack in favor of ArrayDeque, issue #86
2015-03-18 21:54:06 -07:00
Roman Ivanov
35fad5543d
additional fix for #711
2015-03-18 13:57:02 -07:00
Damian Szczepanik
a8a721f278
Updated all links to sun.com reference to oracle site
...
Issue #711
2015-03-18 12:07:18 -07:00
Roman Ivanov
e36ae750f6
Revert "Added support of logging severity for all audit events, issue #67"
...
This reverts commit ca3ffb73ab .
2015-03-17 22:15:57 -07:00
alexkravin
d44cb066cb
Annotation Use Style Check, issue #28
2015-03-17 14:29:23 -07:00
alexkravin
bcb4096366
Removed AvailableChecks page, updated corresponding UT, updated README
2015-03-17 09:29:37 -07:00
alexkravin
b9a1bec65f
Removed printStackTrace(...) from whole code, issue #660
2015-03-16 22:46:04 -07:00
alexkravin
5bd22fd613
Import Order Check, added option allows alphabetical grouping order in static group, issue #12
2015-03-16 22:44:30 -07:00
alexkravin
da77508165
Added anchors to sections, issue #586
2015-03-17 00:15:35 +04:00
alexkravin
5512e6fdba
Final Local Variable Name Check, fixed bug with lambda's params, issue #747
2015-03-15 20:45:01 -07:00
Roman Ivanov
48eeab9932
Standard Checks page was renamed to Checks
2015-03-15 15:46:52 -07:00
alexkravin
42c035aadd
Moved content from available_checks.html to checks.html, issue #691
2015-03-15 15:20:40 -07:00
Michal Kordas
ca1c33e311
Clean up open streams, issue #778
...
All violations of Fildbugs rule [OBL: Method may fail to clean up stream or resource](http://findbugs.sourceforge.net/bugDescriptions.html#OBL_UNSATISFIED_OBLIGATION ) are fixed.
2015-03-15 15:17:43 -07:00
Michal Kordas
a135b0952a
Fix non-compiling input for CustomImportOrder check
...
There are no classes directly under `com.google.common` package - such import was illegal.
2015-03-15 15:11:38 -07:00
Michal Kordas
a281cc95c4
Capitalize names of pages in Extending Checkstyle section on website
2015-03-15 15:10:06 -07:00
Michal Kordas
08ede2c529
Fix letter casing of IntelliJ on website
2015-03-15 15:10:06 -07:00