Enforce method names
This commit is contained in:
parent
b2fb239853
commit
8f08bd1f6d
|
@ -4,10 +4,12 @@
|
||||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||||
<module name = "Checker">
|
<module name = "Checker">
|
||||||
<property name="charset" value="UTF-8"/>
|
<property name="charset" value="UTF-8"/>
|
||||||
|
<property name="severity" value="warning"/>
|
||||||
|
<property name="fileExtensions" value="java, properties, xml"/>
|
||||||
|
|
||||||
<property name="severity" value="error"/>
|
<module name="SuppressionFilter">
|
||||||
|
<property name="file" value="suppressions.xml" />
|
||||||
<property name="fileExtensions" value="java, xml"/>
|
</module>
|
||||||
|
|
||||||
<module name="TreeWalker">
|
<module name="TreeWalker">
|
||||||
<module name="OuterTypeFilename"/>
|
<module name="OuterTypeFilename"/>
|
||||||
|
@ -91,6 +93,11 @@
|
||||||
<property name="tokens" value="VARIABLE_DEF"/>
|
<property name="tokens" value="VARIABLE_DEF"/>
|
||||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||||
</module>
|
</module>
|
||||||
|
<module name="MethodName">
|
||||||
|
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Method name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
<module name="SingleLineJavadoc">
|
<module name="SingleLineJavadoc">
|
||||||
<property name="ignoreInlineTags" value="false"/>
|
<property name="ignoreInlineTags" value="false"/>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE suppressions PUBLIC
|
||||||
|
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||||||
|
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||||||
|
<suppressions>
|
||||||
|
<suppress checks="MethodName" files="core/src/test/java/android/util/Log.java" />
|
||||||
|
</suppressions>
|
|
@ -27,7 +27,6 @@ import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.BuildConfig;
|
|
||||||
import de.danoeh.antennapod.core.export.opml.OpmlElement;
|
import de.danoeh.antennapod.core.export.opml.OpmlElement;
|
||||||
import de.danoeh.antennapod.core.export.opml.OpmlReader;
|
import de.danoeh.antennapod.core.export.opml.OpmlReader;
|
||||||
import de.danoeh.antennapod.core.export.opml.OpmlWriter;
|
import de.danoeh.antennapod.core.export.opml.OpmlWriter;
|
||||||
|
@ -45,18 +44,6 @@ public class OpmlBackupAgent extends BackupAgentHelper {
|
||||||
addHelper(OPML_BACKUP_KEY, new OpmlBackupHelper(this));
|
addHelper(OPML_BACKUP_KEY, new OpmlBackupHelper(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LOGD(String tag, String msg) {
|
|
||||||
if (BuildConfig.DEBUG && Log.isLoggable(tag, Log.DEBUG)) {
|
|
||||||
Log.d(tag, msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void LOGD(String tag, String msg, Throwable tr) {
|
|
||||||
if (BuildConfig.DEBUG && Log.isLoggable(tag, Log.DEBUG)) {
|
|
||||||
Log.d(tag, msg, tr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for backing up and restoring the OPML file.
|
* Class for backing up and restoring the OPML file.
|
||||||
*/
|
*/
|
||||||
|
@ -98,7 +85,7 @@ public class OpmlBackupAgent extends BackupAgentHelper {
|
||||||
// Compare checksum of new and old file to see if we need to perform a backup at all
|
// Compare checksum of new and old file to see if we need to perform a backup at all
|
||||||
if (digester != null) {
|
if (digester != null) {
|
||||||
byte[] newChecksum = digester.digest();
|
byte[] newChecksum = digester.digest();
|
||||||
LOGD(TAG, "New checksum: " + new BigInteger(1, newChecksum).toString(16));
|
Log.d(TAG, "New checksum: " + new BigInteger(1, newChecksum).toString(16));
|
||||||
|
|
||||||
// Get the old checksum
|
// Get the old checksum
|
||||||
if (oldState != null) {
|
if (oldState != null) {
|
||||||
|
@ -108,10 +95,10 @@ public class OpmlBackupAgent extends BackupAgentHelper {
|
||||||
if (len != -1) {
|
if (len != -1) {
|
||||||
byte[] oldChecksum = new byte[len];
|
byte[] oldChecksum = new byte[len];
|
||||||
inState.read(oldChecksum);
|
inState.read(oldChecksum);
|
||||||
LOGD(TAG, "Old checksum: " + new BigInteger(1, oldChecksum).toString(16));
|
Log.d(TAG, "Old checksum: " + new BigInteger(1, oldChecksum).toString(16));
|
||||||
|
|
||||||
if (Arrays.equals(oldChecksum, newChecksum)) {
|
if (Arrays.equals(oldChecksum, newChecksum)) {
|
||||||
LOGD(TAG, "Checksums are the same; won't backup");
|
Log.d(TAG, "Checksums are the same; won't backup");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +107,7 @@ public class OpmlBackupAgent extends BackupAgentHelper {
|
||||||
writeNewStateDescription(newState, newChecksum);
|
writeNewStateDescription(newState, newChecksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGD(TAG, "Backing up OPML");
|
Log.d(TAG, "Backing up OPML");
|
||||||
byte[] bytes = byteStream.toByteArray();
|
byte[] bytes = byteStream.toByteArray();
|
||||||
data.writeEntityHeader(OPML_ENTITY_KEY, bytes.length);
|
data.writeEntityHeader(OPML_ENTITY_KEY, bytes.length);
|
||||||
data.writeEntityData(bytes, bytes.length);
|
data.writeEntityData(bytes, bytes.length);
|
||||||
|
@ -138,10 +125,10 @@ public class OpmlBackupAgent extends BackupAgentHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void restoreEntity(BackupDataInputStream data) {
|
public void restoreEntity(BackupDataInputStream data) {
|
||||||
LOGD(TAG, "Backup restore");
|
Log.d(TAG, "Backup restore");
|
||||||
|
|
||||||
if (!OPML_ENTITY_KEY.equals(data.getKey())) {
|
if (!OPML_ENTITY_KEY.equals(data.getKey())) {
|
||||||
LOGD(TAG, "Unknown entity key: " + data.getKey());
|
Log.d(TAG, "Unknown entity key: " + data.getKey());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +154,7 @@ public class OpmlBackupAgent extends BackupAgentHelper {
|
||||||
try {
|
try {
|
||||||
downloader.downloadFeed(mContext, feed);
|
downloader.downloadFeed(mContext, feed);
|
||||||
} catch (DownloadRequestException e) {
|
} catch (DownloadRequestException e) {
|
||||||
LOGD(TAG, "Error while restoring/downloading feed", e);
|
Log.d(TAG, "Error while restoring/downloading feed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
|
|
Loading…
Reference in New Issue