提交 e09e8e58 编写于 作者: S Skylot

chore: resolve some issues reported by sonar and lgtm

上级 92773417
......@@ -28,6 +28,11 @@ script: ./gradlew clean build
jobs:
include:
- stage: checks
jdk: openjdk11
if: branch = master AND repo = env(MAIN_REPO) AND type = push
script: bash scripts/travis-checks.sh
- stage: deploy-unstable
jdk: openjdk8
if: branch = master AND repo = env(MAIN_REPO) AND type = push
......
......@@ -34,7 +34,7 @@ public class ConvertToClsSet {
usage();
System.exit(1);
}
List<Path> inputPaths = Stream.of(args).map(s -> Paths.get(s)).collect(Collectors.toList());
List<Path> inputPaths = Stream.of(args).map(Paths::get).collect(Collectors.toList());
Path output = inputPaths.remove(0);
JadxPluginManager pluginManager = new JadxPluginManager();
......
......@@ -128,9 +128,7 @@ public final class ResourcesLoader {
return;
}
if (FileUtils.isZipFile(file)) {
ZipSecurity.visitZipEntries(file, (zipFile, entry) -> {
addEntry(list, file, entry);
});
ZipSecurity.visitZipEntries(file, (zipFile, entry) -> addEntry(list, file, entry));
} else {
addResourceFile(list, file);
}
......@@ -158,7 +156,6 @@ public final class ResourcesLoader {
}
}
@SuppressWarnings("CharsetObjectCanBeUsed")
public static ICodeInfo loadToCodeWriter(InputStream is) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(READ_BUFFER_SIZE);
copyStream(is, baos);
......
......@@ -25,7 +25,7 @@ public class HeapUsageBar extends JProgressBar {
private static final Logger LOG = LoggerFactory.getLogger(HeapUsageBar.class);
private static final double GB = 1024 * 1024 * 1024;
private static final double GB = 1024 * 1024 * 1024d;
private static final Color GREEN = new Color(0, 180, 0);
private static final Color RED = new Color(200, 0, 0);
......
......@@ -87,8 +87,9 @@ class JPackagePopupMenu extends JPopupMenu {
}
private String getRawPackage(JPackage pkg) {
for (JClass cls : pkg.getClasses()) {
return cls.getRootClass().getCls().getClassNode().getClassInfo().getPackage();
List<JClass> classes = pkg.getClasses();
if (!classes.isEmpty()) {
return classes.get(0).getRootClass().getCls().getClassNode().getClassInfo().getPackage();
}
for (JPackage innerPkg : pkg.getInnerPackages()) {
String rawPackage = getRawPackage(innerPkg);
......
......@@ -159,13 +159,13 @@ public class RenameDialog extends JDialog {
int i = 0;
while (i < deobfMap.size()) {
if (deobfMap.get(i).startsWith(id)) {
LOG.debug("updateDeobfMap(): Removing entry " + deobfMap.get(i));
LOG.debug("updateDeobfMap(): Removing entry {}", deobfMap.get(i));
deobfMap.remove(i);
} else {
i++;
}
}
LOG.debug("updateDeobfMap(): Placing alias = " + alias);
LOG.debug("updateDeobfMap(): Placing alias = {}", alias);
deobfMap.add(alias);
return deobfMap;
}
......@@ -272,7 +272,7 @@ public class RenameDialog extends JDialog {
try {
cls.reload();
IndexJob.refreshIndex(cache, cls.getCls());
} catch (Throwable e) {
} catch (Exception e) {
LOG.error("Failed to reload class: {}", cls, e);
}
}
......
......@@ -155,7 +155,7 @@ public class CertificateManager {
public static String getThumbPrint(X509Certificate cert, String type)
throws NoSuchAlgorithmException, CertificateEncodingException {
MessageDigest md = MessageDigest.getInstance(type);
MessageDigest md = MessageDigest.getInstance(type); // lgtm [java/weak-cryptographic-algorithm]
byte[] der = cert.getEncoded();
md.update(der);
byte[] digest = md.digest();
......
#!/usr/bin/env bash
set -e
# upload coverage to codecov
./gradlew clean build jacocoTestReport
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
# run sonar checks
./gradlew clean sonarqube -Dsonar.host.url=${SONAR_HOST} -Dsonar.projectKey=jadx -Dsonar.organization=${SONAR_ORG} -Dsonar.login=${SONAR_TOKEN} || echo "Skip sonar build and upload"
#!/usr/bin/env bash
set -e
# upload coverage to codecov
./gradlew clean build jacocoTestReport
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
# run sonar checks
./gradlew clean sonarqube -Dsonar.host.url=${SONAR_HOST} -Dsonar.projectKey=jadx -Dsonar.organization=${SONAR_ORG} -Dsonar.login=${SONAR_TOKEN} || echo "Skip sonar build and upload"
# upload bundles to bintray unstable package
./gradlew clean dist
BINTRAY_PACKAGE=unstable bash scripts/bintray-upload.sh
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册