PlanHubMe/PlanHub

View on GitHub

Showing 857 of 857 total issues

Function 'buildMenu' has a complexity of 12.
Open

    function buildMenu(data, id, subMenu) {
Severity: Minor
Found in public/js/context.js by eslint

Limit Cyclomatic Complexity (complexity)

Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

function a(x) {
    if (true) {
        return x; // 1st path
    } else if (false) {
        return x+1; // 2nd path
    } else {
        return 4; // 3rd path
    }
}

Rule Details

This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

Examples of incorrect code for a maximum of 2:

/*eslint complexity: ["error", 2]*/

function a(x) {
    if (true) {
        return x;
    } else if (false) {
        return x+1;
    } else {
        return 4; // 3rd path
    }
}

Examples of correct code for a maximum of 2:

/*eslint complexity: ["error", 2]*/

function a(x) {
    if (true) {
        return x;
    } else {
        return 4;
    }
}

Options

Optionally, you may specify a max object property:

"complexity": ["error", 2]

is equivalent to

"complexity": ["error", { "max": 2 }]

Deprecated: the object property maximum is deprecated. Please use the property max instead.

When Not To Use It

If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

Further Reading

Related Rules

  • [max-depth](max-depth.md)
  • [max-len](max-len.md)
  • [max-nested-callbacks](max-nested-callbacks.md)
  • [max-params](max-params.md)
  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

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

        if (hw === 1){
            document.getElementById(id).innerHTML = '<i class="fa fa-smile-o"></i> It seems like you will have some free time tonight! You have ' + hw + ' assignment due tomorrow.';
        } else {
            document.getElementById(id).innerHTML = '<i class="fa fa-smile-o"></i> It seems like you will have some free time tonight! You have ' + hw + ' assignments due tomorrow.';
        }
Severity: Major
Found in public/js/overview.js and 1 other location - About 1 hr to fix
public/js/overview.js on lines 39..43

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

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 if (hw < 5){
        document.getElementById(id).innerHTML = '<i class="fa fa-frown-o"></i> Tonight might be rough. You have ' + hw + ' assignments due tomorrow.';
    } else {
        document.getElementById(id).innerHTML = '<i class="fa fa-frown-o"></i> You might be up late doing homework tonight. You have ' + hw + ' assignments due tomorrow.';
    }
Severity: Major
Found in public/js/overview.js and 1 other location - About 1 hr to fix
public/js/overview.js on lines 34..38

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

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

function sendVerify(){
    window.api.post("sms/setPhone", {phone: phonenumber, carrier: phonecarrier}, function(phoneData) {
        window.api.post("sms/sendVerify", {}, function(verificationData) {
            setPage("smsverify");
        });
Severity: Major
Found in public/js/prefs.js and 1 other location - About 1 hr to fix
public/js/prefs.js on lines 6..12

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

Further Reading

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

    if (verifyphone(phonenumber)) {
        window.api.post("sms/setPhone", {phone: phonenumber, carrier: phonecarrier}, function(phoneData) {
            window.api.post("sms/sendVerify", {}, function(verificationData) {
                setPage("smsverify");
            });
Severity: Major
Found in public/js/prefs.js and 1 other location - About 1 hr to fix
public/js/prefs.js on lines 17..23

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

Further Reading

Function buildMenu has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function buildMenu(data, id, subMenu) {
        var subClass = (subMenu) ? ' dropdown-context-sub' : '',
            compressed = options.compress ? ' compressed-context' : '',
            $menu = $('<ul class="dropdown-menu dropdown-context' + subClass + compressed+'" id="dropdown-' + id + '"></ul>');
        var i = 0, linkTarget = '';
Severity: Minor
Found in public/js/context.js - About 1 hr to fix

    Function loadEvents has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    window.hwView.loadEvents = function(callback) {
        window.hwView.loadSubjects(function(data) {
            window.hwView.loadStep();
            window.api.get("hwView/getHw?date=" + moment().format('YYYY-MM-DD'), function(data) {
                var ev = data.events;
    Severity: Minor
    Found in public/js/hwView.js - About 1 hr to fix

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

          function Notify(title, options) {
      
              if (typeof title !== 'string') {
                  throw new Error('Notify(): first arg (title) must be a string.');
              }
      Severity: Minor
      Found in public/js/notify.js - About 1 hr to fix

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

        function setPage(newPage) {
            $(".page.open-page").removeClass("open-page");
            if ($("#" + newPage).length != 0) {
                // yay, it exists. go to it
                $("#" + newPage).addClass("open-page");
        Severity: Minor
        Found in public/js/page.js - About 1 hr to fix

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

              $("#planner-prev").click(function() {
                  window.planner.loadWeek(moment(window.planner.currentStartDate).subtract(7, "days").toDate());
              });
          Severity: Major
          Found in public/js/planner.js and 1 other location - About 1 hr to fix
          public/js/planner.js on lines 612..614

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

          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

              $("#planner-next").click(function() {
                  window.planner.loadWeek(moment(window.planner.currentStartDate).add(7, "days").toDate());
              });
          Severity: Major
          Found in public/js/planner.js and 1 other location - About 1 hr to fix
          public/js/planner.js on lines 608..610

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

          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

              if (req.body.subjectIndex === undefined || isNaN(parseInt(req.body.subjectIndex))) {
                  res.json({
                      status: "error",
                      error: "Missing or invalid section index parameter!"
                  });
          Severity: Major
          Found in routes/api_planner.js and 7 other locations - About 1 hr to fix
          routes/api_planner.js on lines 101..107
          routes/api_planner.js on lines 145..151
          routes/api_planner.js on lines 223..229
          routes/api_planner.js on lines 284..290
          routes/api_planner.js on lines 291..297
          routes/api_planner.js on lines 389..395
          routes/api_planner.js on lines 396..402

          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 8 locations. Consider refactoring.
          Open

              if (req.body.first === undefined || isNaN(parseInt(req.body.first))) {
                  res.json({
                      status: "error",
                      error: "Missing or invalid first index parameter!"
                  });
          Severity: Major
          Found in routes/api_planner.js and 7 other locations - About 1 hr to fix
          routes/api_planner.js on lines 101..107
          routes/api_planner.js on lines 145..151
          routes/api_planner.js on lines 202..208
          routes/api_planner.js on lines 223..229
          routes/api_planner.js on lines 284..290
          routes/api_planner.js on lines 291..297
          routes/api_planner.js on lines 396..402

          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 8 locations. Consider refactoring.
          Open

              if (req.params.section_index === undefined || isNaN(parseInt(req.params.section_index))) {
                  res.json({
                      status: "error",
                      error: "Missing or invalid section index parameter!"
                  });
          Severity: Major
          Found in routes/api_planner.js and 7 other locations - About 1 hr to fix
          routes/api_planner.js on lines 101..107
          routes/api_planner.js on lines 202..208
          routes/api_planner.js on lines 223..229
          routes/api_planner.js on lines 284..290
          routes/api_planner.js on lines 291..297
          routes/api_planner.js on lines 389..395
          routes/api_planner.js on lines 396..402

          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 8 locations. Consider refactoring.
          Open

              if (req.body.second === undefined || isNaN(parseInt(req.body.second))) {
                  res.json({
                      status: "error",
                      error: "Missing or invalid second index parameter!"
                  });
          Severity: Major
          Found in routes/api_planner.js and 7 other locations - About 1 hr to fix
          routes/api_planner.js on lines 101..107
          routes/api_planner.js on lines 145..151
          routes/api_planner.js on lines 202..208
          routes/api_planner.js on lines 223..229
          routes/api_planner.js on lines 284..290
          routes/api_planner.js on lines 291..297
          routes/api_planner.js on lines 389..395

          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 8 locations. Consider refactoring.
          Open

              if (req.body.subjectIndex === undefined || isNaN(parseInt(req.body.subjectIndex))) {
                  res.json({
                      status: "error",
                      error: "Missing or invalid section index parameter!"
                  });
          Severity: Major
          Found in routes/api_planner.js and 7 other locations - About 1 hr to fix
          routes/api_planner.js on lines 101..107
          routes/api_planner.js on lines 145..151
          routes/api_planner.js on lines 202..208
          routes/api_planner.js on lines 223..229
          routes/api_planner.js on lines 291..297
          routes/api_planner.js on lines 389..395
          routes/api_planner.js on lines 396..402

          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 8 locations. Consider refactoring.
          Open

              if (req.body.lines === undefined || isNaN(parseInt(req.body.lines))) {
                  res.json({
                      status: "error",
                      error: "Missing or invalid subId parameter!"
                  });
          Severity: Major
          Found in routes/api_planner.js and 7 other locations - About 1 hr to fix
          routes/api_planner.js on lines 101..107
          routes/api_planner.js on lines 145..151
          routes/api_planner.js on lines 202..208
          routes/api_planner.js on lines 223..229
          routes/api_planner.js on lines 284..290
          routes/api_planner.js on lines 389..395
          routes/api_planner.js on lines 396..402

          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 8 locations. Consider refactoring.
          Open

              if (req.params.section_index === undefined || isNaN(parseInt(req.params.section_index))) {
                  res.json({
                      status: "error",
                      error: "Missing or invalid section index parameter!"
                  });
          Severity: Major
          Found in routes/api_planner.js and 7 other locations - About 1 hr to fix
          routes/api_planner.js on lines 145..151
          routes/api_planner.js on lines 202..208
          routes/api_planner.js on lines 223..229
          routes/api_planner.js on lines 284..290
          routes/api_planner.js on lines 291..297
          routes/api_planner.js on lines 389..395
          routes/api_planner.js on lines 396..402

          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 8 locations. Consider refactoring.
          Open

              if (req.body.subId === undefined || isNaN(parseInt(req.body.subId))) {
                  res.json({
                      status: "error",
                      error: "Missing or invalid subId parameter!"
                  });
          Severity: Major
          Found in routes/api_planner.js and 7 other locations - About 1 hr to fix
          routes/api_planner.js on lines 101..107
          routes/api_planner.js on lines 145..151
          routes/api_planner.js on lines 202..208
          routes/api_planner.js on lines 284..290
          routes/api_planner.js on lines 291..297
          routes/api_planner.js on lines 389..395
          routes/api_planner.js on lines 396..402

          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

          Function loadEvents has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          window.hwView.loadEvents = function(callback) {
              window.hwView.loadSubjects(function(data) {
                  window.hwView.loadStep();
                  window.api.get("hwView/getHw?date=" + moment().format('YYYY-MM-DD'), function(data) {
                      var ev = data.events;
          Severity: Minor
          Found in public/js/hwView.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

          Severity
          Category
          Status
          Source
          Language