mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-20 16:24:11 +01:00
minor codacy suggested changes
This commit is contained in:
@@ -37,6 +37,16 @@ import org.owasp.dependencycheck.utils.Settings;
|
|||||||
*/
|
*/
|
||||||
public class FileNameAnalyzer extends AbstractAnalyzer {
|
public class FileNameAnalyzer extends AbstractAnalyzer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Python init files
|
||||||
|
*/
|
||||||
|
//CSOFF: WhitespaceAfter
|
||||||
|
private static final NameFileFilter IGNORED_FILES = new NameFileFilter(new String[]{
|
||||||
|
"__init__.py",
|
||||||
|
"__init__.pyc",
|
||||||
|
"__init__.pyo",});
|
||||||
|
//CSON: WhitespaceAfter
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer">
|
//<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer">
|
||||||
/**
|
/**
|
||||||
* The name of the analyzer.
|
* The name of the analyzer.
|
||||||
@@ -78,16 +88,6 @@ public class FileNameAnalyzer extends AbstractAnalyzer {
|
|||||||
}
|
}
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
|
|
||||||
/**
|
|
||||||
* Python init files
|
|
||||||
*/
|
|
||||||
//CSOFF: WhitespaceAfter
|
|
||||||
private static final NameFileFilter IGNORED_FILES = new NameFileFilter(new String[]{
|
|
||||||
"__init__.py",
|
|
||||||
"__init__.pyc",
|
|
||||||
"__init__.pyo",});
|
|
||||||
//CSON: WhitespaceAfter
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collects information about the file name.
|
* Collects information about the file name.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ public class NuspecAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initializeFileTypeAnalyzer() throws InitializationException {
|
public void initializeFileTypeAnalyzer() throws InitializationException {
|
||||||
|
//nothing to initialize
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -802,10 +802,8 @@ public final class CveDB implements AutoCloseable {
|
|||||||
try {
|
try {
|
||||||
final PreparedStatement cs = getPreparedStatement(COUNT_CPE);
|
final PreparedStatement cs = getPreparedStatement(COUNT_CPE);
|
||||||
rs = cs.executeQuery();
|
rs = cs.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next() && rs.getInt(1) > 0) {
|
||||||
if (rs.getInt(1) > 0) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
String dd;
|
String dd;
|
||||||
@@ -911,10 +909,9 @@ public final class CveDB implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
//this can't dereference a null 'identifiedVersion' because if it was null we would have exited
|
//this can't dereference a null 'identifiedVersion' because if it was null we would have exited
|
||||||
//in the above loop or just after loop (if matchesAnyPrevious return null).
|
//in the above loop or just after loop (if matchesAnyPrevious return null).
|
||||||
if (entry.getValue() && identifiedVersion != null && identifiedVersion.compareTo(v) <= 0) {
|
if (entry.getValue() && identifiedVersion != null && identifiedVersion.compareTo(v) <= 0
|
||||||
if (!(isVersionTwoADifferentProduct && !identifiedVersion.getVersionParts().get(0).equals(v.getVersionParts().get(0)))) {
|
&& !(isVersionTwoADifferentProduct && !identifiedVersion.getVersionParts().get(0).equals(v.getVersionParts().get(0)))) {
|
||||||
return entry;
|
return entry;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ public class UrlStringUtilsTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testExtractImportantUrlData() throws Exception {
|
public void testExtractImportantUrlData() throws Exception {
|
||||||
String text = "http://github.com/jeremylong/DependencyCheck/index.html";
|
String text = "http://github.com/jeremylong/DependencyCheck/index.html";
|
||||||
List<String> expResult = Arrays.asList("github", "jeremylong", "DependencyCheck", "index");;
|
List<String> expResult = Arrays.asList("github", "jeremylong", "DependencyCheck", "index");
|
||||||
List<String> result = UrlStringUtils.extractImportantUrlData(text);
|
List<String> result = UrlStringUtils.extractImportantUrlData(text);
|
||||||
assertEquals(expResult, result);
|
assertEquals(expResult, result);
|
||||||
|
|
||||||
text = "http://github.com/jeremylong/DependencyCheck/.gitignore";
|
text = "http://github.com/jeremylong/DependencyCheck/.gitignore";
|
||||||
expResult = Arrays.asList("github", "jeremylong", "DependencyCheck", "gitignore");;
|
expResult = Arrays.asList("github", "jeremylong", "DependencyCheck", "gitignore");
|
||||||
result = UrlStringUtils.extractImportantUrlData(text);
|
result = UrlStringUtils.extractImportantUrlData(text);
|
||||||
assertEquals(expResult, result);
|
assertEquals(expResult, result);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user