thorio/KGrabber

View on GitHub

Showing 5 of 12 total issues

Function loadPlugins has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function loadPlugins() {
    getAllowedPlugins();
    let foundPlugins = discoverPlugins();
    if (foundPlugins.length > 0) {
        let context = new PluginContext({
Severity: Minor
Found in src/js/pluginLoader.js - About 1 hr 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 load has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function load(defaults) {
    let saved = JSON.parse(GM_getValue("KG-preferences", "{}"));

    for (let i in saved) {
        if (defaults[i] === undefined) { // delete every category that doesn't exist in defaults
Severity: Minor
Found in src/js/config/preferenceManager.js - About 1 hr 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 loadPlugins has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function loadPlugins() {
    getAllowedPlugins();
    let foundPlugins = discoverPlugins();
    if (foundPlugins.length > 0) {
        let context = new PluginContext({
Severity: Minor
Found in src/js/pluginLoader.js - About 1 hr to fix

    Function load has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    let load = (preferences) => {
        for (let i in preferences) {
            let group = preferences[i];
            let $group = $(`<div id="KG-preferences-container"></div>`);
            for (let j in preferences[i]) {
    Severity: Minor
    Found in src/js/ui/preferences.js - About 1 hr 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 runExport has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function runExport(status) {
        let listing = $(".listing a").get().reverse();
        let title = util.makeBatSafe(status.title);
        let str = getHeader(title);
        for (let episode of status.episodes) {
    Severity: Minor
    Found in src/js/exporters/idmbat.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

    Severity
    Category
    Status
    Source
    Language