File mgEntry.js
has 565 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
This file is part of All Mangas Reader.
All Mangas Reader is free software: you can redistribute it and/or modify
- Create a ticketCreate a ticket
Function updateWebsitesFromRepository
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateWebsitesFromRepository(callback) {
"use strict";
$.ajax({
type: 'GET',
url: amrc_repository + "websites.json",
- Create a ticketCreate a ticket
Function success
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
success : function (resp) {
//distant descriptions
var wsdist = resp;
//local description
amrcsql.webdb.getWebsites(function (list) {
- Create a ticketCreate a ticket
Function releaseImplentationFromId
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function releaseImplentationFromId(id, callback) {
"use strict";
$.ajax({
url : amrc_root + "service.php?name=implementation_getrelease_v2&id=" + id,
beforeSend : function (xhr) {
- Create a ticketCreate a ticket
Function importImplentationFromId
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function importImplentationFromId(id, callback) {
"use strict";
$.ajax({
url : amrc_root + "service.php?name=implementation_get_v2&id=" + id,
beforeSend : function (xhr) {
- Create a ticketCreate a ticket
Function getMirrorsDescription
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getMirrorsDescription(callback) {
"use strict";
amrcsql.webdb.getWebsites(function (list) {
var websites = list,
mustUpdate = false,
- Create a ticketCreate a ticket
Function success
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
success : function (resp) {
//distant description
var description = JSON.parse(resp);
//local description
- Create a ticketCreate a ticket
Function loadJSFromRepositoryForActivatedMirrors
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadJSFromRepositoryForActivatedMirrors(list, pos, input) {
"use strict";
chrome.extension.getBackgroundPage().isReady(false, "Downloading activated mirrors from repository");
var docache = true;
if (input.jsCode.indexOf(".php") !== -1) {
- Create a ticketCreate a ticket
Function success
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
success : function (resp) {
//distant description
var description = JSON.parse(resp);
//local description
- Create a ticketCreate a ticket
Function doesCurrentPageMatchManga
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function doesCurrentPageMatchManga(url, activatedMirrors, callback) {
"use strict";
getMirrorsDescription(function (list) {
var wsloc = list,
isok = false,
- Create a ticketCreate a ticket
Function loadJSFromRepositoryForMirrors
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadJSFromRepositoryForMirrors(list, pos, input) {
"use strict";
var docache = true;
if (input.jsCode.indexOf(".php") !== -1) {
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!validURL(wsloc[j].jsCode)) {
// object correspond to old description (js code in database... switch to manifest 2)
console.log("Website " + wsdist[i].mirrorName + " has an old description... swintch to new one...");
var change = {
description : wsdist[i],
- Create a ticketCreate a ticket
Function waitForFinishRepository
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function waitForFinishRepository(websites, callback) {
"use strict";
chrome.extension.getBackgroundPage().isReady(false, "Waiting for mirrors to be loaded");
var done = true,
i;
- Read upRead up
- Create a ticketCreate a ticket
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (params.shownotifws === 1) {
var wsData = {
ws : description.mirrorName,
developer : description.developer,
revision : description.revision,
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 72.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (params.shownotifws === 1) {
var wsData = {
ws : description.mirrorName,
developer : description.developer,
revision : description.revision,
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 72.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
for (i = 0; i < websites.length; i += 1) {
if (!websites[i].loaded || websites[i].loaded === false) {
done = false;
break;
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 68.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
for (i = 0; i < mirrors.length; i += 1) {
if (!mirrors[i].loadedscript || mirrors[i].loadedscript === false) {
done = false;
break;
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 68.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
for (i = 0; i < changes.length; i += 1) {
if (!changes[i].loaded || changes[i].loaded === false) {
done = false;
break;
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 68.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
for (j = 0; j < wsloc.length; j += 1) {
if (description.mirrorName === wsloc[j].mirrorName) {
found = wsloc[j];
break;
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
for (j = 0; j < wsloc.length; j += 1) {
if (description.mirrorName === wsloc[j].mirrorName) {
found = wsloc[j];
break;
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76