In addition to applying high cohesion and low coupling, how to deal with codes like this? They may be readable but this excess of logical operators, I do not see it possible to refactor or even with switch-case
.
if (!entry.isDirectory()
&& !entry.getName().startsWith("__MACOSX/")
&& !entry.getName().startsWith("_images/")
&& !entry.getName().contains("/_images")
&& !entry.getName().contains("/._")
&& !entry.getName().contains("/_img")
&& !entry.getName().contains("/imgs")
&& !entry.getName().contains("/_old")) {
String filename = Util.buildFilename(nome);
filenameMap.put(filename, nome);
if (!nome.startsWith("[.]")
&& (nome.toLowerCase().endsWith(".swf")
|| nome.toLowerCase().endsWith(".gif")
|| nome.toLowerCase().endsWith(".jpg") || nome
.toLowerCase().endsWith(".jpeg"))) {
files.add(dest + nome);
}
File destFile = FileUtils.getFile(dest, filename);
copyInputStream(zipFile.getInputStream(entry),
new BufferedOutputStream(new FileOutputStream(destFile)));
}
SonarQube
Expressions should not be too complex
The complexity of an expression is defined by the number of & & and condition ifTrue: ifFalse operators it contains. The single expression should not be too high to keep the code readable.