AllMangasReader-dev/AMR

View on GitHub
js/popupSearch.js

Summary

Maintainability
F
1 wk
Test Coverage

File popupSearch.js has 448 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
  it under the terms of the GNU General Public License as published by
Severity: Minor
Found in js/popupSearch.js - About 6 hrs to fix

Function loadSelectors has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function loadSelectors() {
    var selAll = $("<img src='" + chrome.extension.getURL("img/select_all.png") + "' title='Select all'/>");
    var selNone = $("<img src='" + chrome.extension.getURL("img/select_none.png") + "' title='Select none'/>");
    var selUsed = $("<img src='" + chrome.extension.getURL("img/bookmark.png") + "' title='Select all on which i have at least one manga in my list'/>");
    selAll.click(function () {
Severity: Major
Found in js/popupSearch.js - About 3 hrs to fix

Function waitForEndLoad has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function waitForEndLoad() {
    if (nbToLoad != ancNbToLoad) {
        ancNbToLoad = nbToLoad;
        tempMirrorListAll.sort(function (a, b) {
            var aname = formatMgName(a.name);
Severity: Minor
Found in js/popupSearch.js - About 2 hrs to fix

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

Function fillListOfSearchAll has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

function fillListOfSearchAll(lst) {
    $("#resTr").css("display", "table-row");
    $("#results").empty();
    if (lst.length > 0) {
        $("#nores").css("display", "none");
Severity: Minor
Found in js/popupSearch.js - About 2 hrs to fix

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

Function refreshSearchAll has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function refreshSearchAll(toSearch) {
    isOver = false;
    tempMirrorListAll = [];
    nbToLoad = mirrors.length;
    ancNbToLoad = nbToLoad;
Severity: Major
Found in js/popupSearch.js - About 2 hrs to fix

Function waitForEndLoad has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function waitForEndLoad() {
    if (nbToLoad != ancNbToLoad) {
        ancNbToLoad = nbToLoad;
        tempMirrorListAll.sort(function (a, b) {
            var aname = formatMgName(a.name);
Severity: Minor
Found in js/popupSearch.js - About 1 hr to fix

Function bindSearchGlobActs has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function bindSearchGlobActs() {
    $(".mirrorsearchimg").click(function () {
        chrome.runtime.sendMessage({
            action : 'opentab',
            url : $(this).data("urlmirror")
Severity: Minor
Found in js/popupSearch.js - About 1 hr to fix

Function fillListOfSearchAll has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function fillListOfSearchAll(lst) {
    $("#resTr").css("display", "table-row");
    $("#results").empty();
    if (lst.length > 0) {
        $("#nores").css("display", "none");
Severity: Minor
Found in js/popupSearch.js - About 1 hr to fix

Function loadSearch has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function loadSearch() {
    loadSelectors();
    for (var i = 0; i < mirrors.length; i++) {
        var newItem = $("<div class='mirrorF'><table><tr><td class='mirrorIcon'><img src='" + mirrors[i].mirrorIcon + "' title='" + mirrors[i].mirrorName + "'/></td></tr><tr><td class='mirrorStatus'><img src='" + chrome.extension.getURL("img/gray.png") + "'/></td></tr></table></div>");
        newItem.appendTo($("#filMirrors"));
Severity: Minor
Found in js/popupSearch.js - About 1 hr to fix

Function fillCurrentLstSingleMg has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function fillCurrentLstSingleMg(lstCur, nbForPij) {
    var nameCur = lstCur[lstCur.length - 1].name;
    var trCur;
    if (nbForPij % 2 === 0) {
        trCur = $("<tr class='odd'></tr>");
Severity: Minor
Found in js/popupSearch.js - About 1 hr to fix

Function setMirrorState has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function setMirrorState(mirrorName, state) {
    if (localStorage["searchMirrorsState"] !== undefined) {
        var obj = JSON.parse(localStorage["searchMirrorsState"]);
        var isFound = false;
        for (var i = 0; i < obj.length; i++) {
Severity: Minor
Found in js/popupSearch.js - About 1 hr to fix

Function loadSearch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function loadSearch() {
    loadSelectors();
    for (var i = 0; i < mirrors.length; i++) {
        var newItem = $("<div class='mirrorF'><table><tr><td class='mirrorIcon'><img src='" + mirrors[i].mirrorIcon + "' title='" + mirrors[i].mirrorName + "'/></td></tr><tr><td class='mirrorStatus'><img src='" + chrome.extension.getURL("img/gray.png") + "'/></td></tr></table></div>");
        newItem.appendTo($("#filMirrors"));
Severity: Minor
Found in js/popupSearch.js - About 55 mins to fix

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

Function setMirrorState has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function setMirrorState(mirrorName, state) {
    if (localStorage["searchMirrorsState"] !== undefined) {
        var obj = JSON.parse(localStorage["searchMirrorsState"]);
        var isFound = false;
        for (var i = 0; i < obj.length; i++) {
Severity: Minor
Found in js/popupSearch.js - About 55 mins to fix

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 deeply nested control flow statements.
Open

                        for (var j = 0; j < list.length; j++) {
                            if (formatMgName(list[j][0]).indexOf(formatMgName(toSearch)) != -1) {
                                var obj = {};
                                obj.url = list[j][1];
                                obj.name = list[j][0];
Severity: Major
Found in js/popupSearch.js - About 45 mins to fix

Function refreshSearchAll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function refreshSearchAll(toSearch) {
    isOver = false;
    tempMirrorListAll = [];
    nbToLoad = mirrors.length;
    ancNbToLoad = nbToLoad;
Severity: Minor
Found in js/popupSearch.js - About 35 mins to fix

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 function.
Open

                    return -1;
Severity: Major
Found in js/popupSearch.js - About 30 mins to fix

Function fillCurrentLstSingleMg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function fillCurrentLstSingleMg(lstCur, nbForPij) {
    var nameCur = lstCur[lstCur.length - 1].name;
    var trCur;
    if (nbForPij % 2 === 0) {
        trCur = $("<tr class='odd'></tr>");
Severity: Minor
Found in js/popupSearch.js - About 25 mins to fix

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

Function isMirrorEnable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function isMirrorEnable(mirrorName) {
    if (localStorage["searchMirrorsState"] !== undefined) {
        var obj = JSON.parse(localStorage["searchMirrorsState"]);
        for (var i = 0; i < obj.length; i++) {
            if (obj[i].mirror == mirrorName) {
Severity: Minor
Found in js/popupSearch.js - About 25 mins to fix

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    selAll.click(function () {
        $(".mirrorIcon img").each(function (index) {
            $(this).removeClass("disabled");
            $("img", $(this).closest("tr").next()).show();
            setMirrorState($(this).attr("title"), true);
Severity: Major
Found in js/popupSearch.js and 1 other location - About 5 hrs to fix
js/popupSearch.js on lines 143..151

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 144.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    selNone.click(function () {
        $(".mirrorIcon img").each(function (index) {
            $(this).addClass("disabled");
            $("img", $(this).closest("tr").next()).hide();
            setMirrorState($(this).attr("title"), false);
Severity: Major
Found in js/popupSearch.js and 1 other location - About 5 hrs to fix
js/popupSearch.js on lines 134..142

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 144.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    $(".addsinglemg").click(function () {
        var img = $("img.mirrorsearchimg", $(this).closest(".eltmirrorsearch"));
        var obj = {
            action : "readManga",
            mirror : img.data("mirrorname"),
Severity: Major
Found in js/popupSearch.js and 1 other location - About 4 hrs to fix
js/backsite.js on lines 158..166

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 115.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                            if (formatMgName(list[j][0]).indexOf(formatMgName(toSearch)) != -1) {
                                var obj = {};
                                obj.url = list[j][1];
                                obj.name = list[j][0];
                                obj.mirror = mirror;
Severity: Major
Found in js/popupSearch.js and 1 other location - About 3 hrs to fix
js/popupSearch.js on lines 439..445

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 109.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if (formatMgName(lst[j][0]).indexOf(formatMgName(curSearch)) != -1) {
            var obj = {};
            obj.url = lst[j][1];
            obj.name = lst[j][0];
            obj.mirror = mirror;
Severity: Major
Found in js/popupSearch.js and 1 other location - About 3 hrs to fix
js/popupSearch.js on lines 248..254

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 109.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    $(".mirrorIcon img").each(function (index) {
        if ($(this).attr("title") == mirror) {
            $("img", $(this).closest("tr").next()).attr("src", chrome.extension.getURL("img/blue.png"));
        }
    });
Severity: Major
Found in js/popupSearch.js and 1 other location - About 2 hrs to fix
js/popupSearch.js on lines 262..266

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 92.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                    $(".mirrorIcon img").each(function (index) {
                        if ($(this).attr("title") == mirror) {
                            $("img", $(this).closest("tr").next()).attr("src", chrome.extension.getURL("img/blue.png"));
                        }
                    });
Severity: Major
Found in js/popupSearch.js and 1 other location - About 2 hrs to fix
js/popupSearch.js on lines 447..451

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 92.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                if (!isFound) {
                    $(this).addClass("disabled");
                    $("img", $(this).closest("tr").next()).hide();
                    setMirrorState($(this).attr("title"), false);
                } else {
Severity: Major
Found in js/popupSearch.js and 1 other location - About 1 hr to fix
js/popupSearch.js on lines 162..170

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 73.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            if (isFound) {
                $(this).addClass("disabled");
                $("img", $(this).closest("tr").next()).hide();
                setMirrorState($(this).attr("title"), false);
            } else {
Severity: Major
Found in js/popupSearch.js and 1 other location - About 1 hr to fix
js/popupSearch.js on lines 197..205

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 73.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    $(".mirrorsearchimg").click(function () {
        chrome.runtime.sendMessage({
            action : 'opentab',
            url : $(this).data("urlmirror")
        }, function (response) {});
Severity: Major
Found in js/popupSearch.js and 1 other location - About 1 hr to fix
js/backsite.js on lines 154..156

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 65.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

function formatMgName(name) {
    if (name === undefined || name === null || name == "null")
        return "";
    return name.trim().replace(/[^0-9A-Za-z]/g, '').toUpperCase();
}
Severity: Major
Found in js/popupSearch.js and 1 other location - About 1 hr to fix
js/background.js on lines 395..399

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                for (var i = 0; i < langMirrors.length; i++) {
                    if (langMirrors[i] == $(this).attr("title")) {
                        isFound = true;
                        break;
                    }
Severity: Major
Found in js/popupSearch.js and 1 other location - About 1 hr to fix
js/popupSearch.js on lines 156..161

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            for (var i = 0; i < unused.length; i++) {
                if (unused[i] == $(this).attr("title")) {
                    isFound = true;
                    break;
                }
Severity: Major
Found in js/popupSearch.js and 1 other location - About 1 hr to fix
js/popupSearch.js on lines 191..196

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if ($(this).hasClass("disabled")) {
            $("img", $(this).closest("tr").next()).hide();
            setMirrorState($(this).attr("title"), false);
        } else {
Severity: Major
Found in js/popupSearch.js and 1 other location - About 1 hr to fix
js/popupSearch.js on lines 110..113

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 57.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        } else {
            $("img", $(this).closest("tr").next()).show();
            setMirrorState($(this).attr("title"), true);
        }
Severity: Major
Found in js/popupSearch.js and 1 other location - About 1 hr to fix
js/popupSearch.js on lines 107..110

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 57.

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

Further Reading

Similar blocks of code found in 8 locations. Consider refactoring.
Open

            for (var i = toDel.length - 1; i >= 0; i--) {
                tempMirrorListAll.remove(toDel[i], toDel[i]);
            }
Severity: Major
Found in js/popupSearch.js and 7 other locations - About 50 mins to fix
js/background.js on lines 129..131
js/background.js on lines 1948..1950
js/background.js on lines 1965..1967
js/background.js on lines 2009..2011
js/background.js on lines 2059..2061
js/listmanager.js on lines 198..200
js/listmanager.js on lines 205..207

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 51.

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

Further Reading

There are no issues that match your filters.

Category
Status