PlanHubMe/PlanHub

View on GitHub

Showing 32 of 857 total issues

Function setColor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.page.setColor = function(color) {
    var complements = {
        "#333333": "#222222",
        "#990f0f": "#880e0e",
        "#0f993b": "#0e882a",
Severity: Minor
Found in public/js/page.js - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

                                    for (var wordIndex in titles.words) {
                                        var title = titles.words[wordIndex];
                                        if (title == "subjectName") {
                                            title = subjectName;
                                        }
    Severity: Major
    Found in public/js/planner.js - About 45 mins to fix

      Function sendFeedback has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      window.page.sendFeedback = function(type, msg, name, username, webpage, callback) {
      Severity: Minor
      Found in public/js/page.js - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

                        if (tag.toLowerCase() == "test" || tag.toLowerCase() == "exam" || tag.toLowerCase() == "midterm" || tag.toLowerCase() == "quiz" || tag.toLowerCase() == "ica" || tag.toLowerCase() == "lab") {
                            keyword = "on";
                        }
        Severity: Major
        Found in public/js/hwView.js - About 40 mins to fix

          Function request has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          roux.request = function(key, action, data, errCallback, callback) {
          Severity: Minor
          Found in roux.js - About 35 mins to fix

            Function setEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            window.planner.setEvent = function(date, subjectIndex, text, done, subId) {
            Severity: Minor
            Found in public/js/planner.js - About 35 mins to fix

              Function sendEmail has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              var sendEmail = function(templateName, to, templateObjs, done, err) {
              Severity: Minor
              Found in emails.js - About 35 mins to fix

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

                window.overview.HWphrase = function (id, hw) {
                    if(hw < 1){
                        document.getElementById(id).innerHTML = '<i class="fa fa-smile-o"></i> Looks like tonight will be an easy night! You have no homework due tomorrow!';
                    } else if (hw < 3) {
                        if (hw === 1){
                Severity: Minor
                Found in public/js/overview.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

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

                    parseText: function(text) {
                        var prefixes = window.utils.getPrefixes();
                        var flatPrefixes = window.utils.getFlatPrefixes();
                        var retObj = {
                            what: undefined,
                Severity: Minor
                Found in public/js/quickAdd.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;
                Severity: Major
                Found in routes/api_planner.js - About 30 mins to fix

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

                  window.planner.getAnnouncement = function(date, callback) {
                      window.api.get("planner/announcements/get/" + date, function(data) {
                          if (data.status == "ok") {
                              if (data.announcement !== null) {
                                  callback(data.announcement, date);
                  Severity: Minor
                  Found in public/js/planner.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 getPrefixClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  window.utils.getPrefixClass = function(prefix) {
                      var chkPrefix = prefix.toLowerCase();
                      var prefixes = window.utils.getPrefixes();
                      for (var prefixIndex in prefixes) {
                          for (var wordIndex in prefixes[prefixIndex].words) {
                  Severity: Minor
                  Found in public/js/utils.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

                  Severity
                  Category
                  Status
                  Source
                  Language