Merge branch 'enable-pmd-java-basic' into 'master'
Enable PMD java-basic This is the fixes necessary to enable PMD's `java-basic` ruleset. I think there will be a few rules in there that will largely be annoying, so we'll need to ultimately decide whether to use `// NOPMD` or just specify the rules we want from `java-basic`. See merge request !280
This commit is contained in:
commit
9680ba1694
@ -89,7 +89,8 @@ public class AndroidXMLDecompress {
|
|||||||
}
|
}
|
||||||
int offset = xmlTagOffset;
|
int offset = xmlTagOffset;
|
||||||
|
|
||||||
while (offset < binaryXml.length) {
|
// we only need the first <manifest> start tag
|
||||||
|
if (offset < binaryXml.length) {
|
||||||
int tag0 = littleEndianWord(binaryXml, offset);
|
int tag0 = littleEndianWord(binaryXml, offset);
|
||||||
|
|
||||||
if (tag0 == START_TAG) {
|
if (tag0 == START_TAG) {
|
||||||
@ -114,8 +115,6 @@ public class AndroidXMLDecompress {
|
|||||||
}
|
}
|
||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
// we only need the first <manifest> start tag
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return new HashMap<>(0);
|
return new HashMap<>(0);
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,11 @@ public class BluetoothPeer implements Peer {
|
|||||||
return peer != null && peer instanceof BluetoothPeer && ((BluetoothPeer) peer).device.getAddress().equals(device.getAddress());
|
return peer != null && peer instanceof BluetoothPeer && ((BluetoothPeer) peer).device.getAddress().equals(device.getAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return device.getAddress().hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRepoAddress() {
|
public String getRepoAddress() {
|
||||||
return "bluetooth://" + device.getAddress().replace(':', '-') + "/fdroid/repo";
|
return "bluetooth://" + device.getAddress().replace(':', '-') + "/fdroid/repo";
|
||||||
|
@ -36,6 +36,11 @@ public class BonjourPeer extends WifiPeer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return getFingerprint().hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRepoAddress() {
|
public String getRepoAddress() {
|
||||||
return serviceInfo.getRepoAddress();
|
return serviceInfo.getRepoAddress();
|
||||||
|
@ -265,7 +265,10 @@ public class LocalHTTPD extends NanoHTTPD {
|
|||||||
return (int) dataLen;
|
return (int) dataLen;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fis.skip(startFrom);
|
long skipped = fis.skip(startFrom);
|
||||||
|
if (skipped != startFrom) {
|
||||||
|
throw new IOException("unable to skip the required " + startFrom + " bytes.");
|
||||||
|
}
|
||||||
|
|
||||||
res = createResponse(Response.Status.PARTIAL_CONTENT, mime, fis);
|
res = createResponse(Response.Status.PARTIAL_CONTENT, mime, fis);
|
||||||
res.addHeader("Content-Length", String.valueOf(dataLen));
|
res.addHeader("Content-Length", String.valueOf(dataLen));
|
||||||
|
@ -303,7 +303,10 @@ public class BluetoothServer extends Thread {
|
|||||||
return (int) dataLen;
|
return (int) dataLen;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fis.skip(startFrom);
|
long skipped = fis.skip(startFrom);
|
||||||
|
if (skipped != startFrom) {
|
||||||
|
throw new IOException("unable to skip the required " + startFrom + " bytes.");
|
||||||
|
}
|
||||||
|
|
||||||
res = createResponse(NanoHTTPD.Response.Status.PARTIAL_CONTENT, mime, fis);
|
res = createResponse(NanoHTTPD.Response.Status.PARTIAL_CONTENT, mime, fis);
|
||||||
res.addHeader("Content-Length", String.valueOf(dataLen));
|
res.addHeader("Content-Length", String.valueOf(dataLen));
|
||||||
|
@ -740,7 +740,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public void logStatus() {
|
public void logStatus() {
|
||||||
|
|
||||||
if (true) return;
|
if (true) return; // NOPMD
|
||||||
|
|
||||||
String message = "";
|
String message = "";
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||||
|
|
||||||
<!--<rule ref="rulesets/java/basic.xml"/>-->
|
<rule ref="rulesets/java/basic.xml">
|
||||||
|
<exclude name="CollapsibleIfStatements"/> <!--sometimes forces hard to read code-->
|
||||||
|
</rule>
|
||||||
<rule ref="rulesets/java/unusedcode.xml"/>
|
<rule ref="rulesets/java/unusedcode.xml"/>
|
||||||
<rule ref="rulesets/java/android.xml"/>
|
<rule ref="rulesets/java/android.xml"/>
|
||||||
<rule ref="rulesets/java/clone.xml"/>
|
<rule ref="rulesets/java/clone.xml"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user