Method checkForUpdates
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void checkForUpdates(final HttpUrl baseUrl) {
HttpUrl manifestUrl = baseUrl.newBuilder().addPathSegment("manifest.json").build();
Request request = new Request.Builder().url(manifestUrl).build();
Method downloadAssetBundle
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
synchronized protected void downloadAssetBundle(final AssetBundle assetBundle, HttpUrl baseUrl) {
Set<AssetBundle.Asset> missingAssets = new HashSet<AssetBundle.Asset>();
for (AssetBundle.Asset asset : assetBundle.getOwnAssets()) {
// Create containing directories for the asset if necessary
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method downloadAssetBundle
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
synchronized protected void downloadAssetBundle(final AssetBundle assetBundle, HttpUrl baseUrl) {
Set<AssetBundle.Asset> missingAssets = new HashSet<AssetBundle.Asset>();
for (AssetBundle.Asset asset : assetBundle.getOwnAssets()) {
// Create containing directories for the asset if necessary
Method moveExistingDownloadDirectoryIfNeeded
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private void moveExistingDownloadDirectoryIfNeeded() {
if (downloadDirectory.exists()) {
if (partialDownloadDirectory.exists()) {
if (!IOUtils.deleteRecursively(partialDownloadDirectory)) {
Log.w(LOG_TAG, "Could not delete partial download directory");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method cachedAssetForAsset
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected AssetBundle.Asset cachedAssetForAsset(AssetBundle.Asset asset) {
for (AssetBundle assetBundle : downloadedAssetBundlesByVersion.values()) {
AssetBundle.Asset cachedAsset = assetBundle.cachedAssetForUrlPath(asset.urlPath, asset.hash);
if (cachedAsset != null) {
return cachedAsset;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method loadDownloadedAssetBundles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private void loadDownloadedAssetBundles() throws WebAppException {
for (File file: versionsDirectory.listFiles()) {
if (downloadDirectory.equals(file)) continue;
if (partialDownloadDirectory.equals(file)) continue;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;