Enabled more checkstyle rules

This commit is contained in:
ByteHamster 2019-09-28 17:23:36 +02:00
parent 3e01d66cbd
commit 28a816b16c
3 changed files with 56 additions and 2 deletions

View File

@ -10,6 +10,7 @@
<property name="fileExtensions" value="java, xml"/> <property name="fileExtensions" value="java, xml"/>
<module name="TreeWalker"> <module name="TreeWalker">
<module name="OuterTypeFilename"/>
<module name="AvoidEscapedUnicodeCharacters"> <module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/> <property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/> <property name="allowByTailComment" value="true"/>
@ -17,12 +18,65 @@
</module> </module>
<module name="AvoidStarImport"/> <module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/> <module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="OneStatementPerLine"/> <module name="OneStatementPerLine"/>
<module name="FallThrough"/>
<module name="UpperEll"/>
<module name="ModifierOrder"/> <module name="ModifierOrder"/>
<module name="PackageName"> <module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/> <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern" <message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/> value="Package name ''{0}'' must match pattern ''{1}''."/>
</module> </module>
<module name="TypeName">
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="CatchParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="InterfaceTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationVariables"/>
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
</module> </module>
</module> </module>

View File

@ -77,7 +77,7 @@ public final class Optional<T> {
* @param <T> Type of the non-existent value * @param <T> Type of the non-existent value
* @return an empty {@code Optional} * @return an empty {@code Optional}
*/ */
public static<T> Optional<T> empty() { public static <T> Optional<T> empty() {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Optional<T> t = (Optional<T>) EMPTY; Optional<T> t = (Optional<T>) EMPTY;
return t; return t;

View File

@ -72,7 +72,7 @@ public class ChapterReader extends ID3Reader {
String decodedLink = URLDecoder.decode(link.toString(), "UTF-8"); String decodedLink = URLDecoder.decode(link.toString(), "UTF-8");
currentChapter.setLink(decodedLink); currentChapter.setLink(decodedLink);
Log.d(TAG, "Found link: " + currentChapter.getLink()); Log.d(TAG, "Found link: " + currentChapter.getLink());
} catch (IllegalArgumentException _iae) { } catch (IllegalArgumentException iae) {
Log.w(TAG, "Bad URL found in ID3 data"); Log.w(TAG, "Bad URL found in ID3 data");
} }