PlanHubMe/PlanHub

View on GitHub

Showing 32 of 857 total issues

Function createSubjectRow has 220 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.planner.createSubjectRow = function(subjectName, subjectIndex) {
    var $row = $('<tr class="subjectRow"></tr>');
        $row.attr("data-subjectName", subjectName);
        $row.attr("data-subjectIndex", subjectIndex);

Severity: Major
Found in public/js/planner.js - About 1 day to fix

    File planner.js has 504 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    window.planner = {
        currentStartDate: null,
        loadState: 0,
        subjectCount: 0,
        saving: false,
    Severity: Major
    Found in public/js/planner.js - About 1 day to fix

      File api_planner.js has 488 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var express = require('express');
      var router = express.Router();
      
      router.get('/', global.apiCall, function(req, res, next) {
          res.json({
      Severity: Minor
      Found in routes/api_planner.js - About 7 hrs to fix

        Function context has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

        var context = context || (function () {
            
            var options = {
                fadeSpeed: 100,
                filter: function ($obj) {
        Severity: Minor
        Found in public/js/context.js - About 5 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 loadWholeWeek has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

        window.planner.loadWholeWeek = function(startDate, subjectIndex) {
            window.api.get("planner/events/getWholeWeek/" + window.utils.formatDate_api(startDate), function(data) {
                for (var announcementIndex in data.announcements) {
                    var announcement = data.announcements[announcementIndex];
                    var date = announcement.date.split("T")[0];
        Severity: Minor
        Found in public/js/planner.js - About 4 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 context has 116 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var context = context || (function () {
            
            var options = {
                fadeSpeed: 100,
                filter: function ($obj) {
        Severity: Major
        Found in public/js/context.js - About 4 hrs to fix

          Function addEventToList has 95 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          window.hwView.addEventToList = function(ev, list) {
              var tag = window.utils.getPrefix(ev.name);
              var name = ev.name.split(" ");
              name.splice(0, 1);
              name = name.join(" ");
          Severity: Major
          Found in public/js/hwView.js - About 3 hrs to fix

            Function createSubjectRow has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

            window.planner.createSubjectRow = function(subjectName, subjectIndex) {
                var $row = $('<tr class="subjectRow"></tr>');
                    $row.attr("data-subjectName", subjectName);
                    $row.attr("data-subjectIndex", subjectIndex);
            
            
            Severity: Minor
            Found in public/js/planner.js - About 3 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 addEventToList has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

            window.hwView.addEventToList = function(ev, list) {
                var tag = window.utils.getPrefix(ev.name);
                var name = ev.name.split(" ");
                name.splice(0, 1);
                name = name.join(" ");
            Severity: Minor
            Found in public/js/hwView.js - About 3 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 getPrefixes has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            window.utils.getPrefixes = function() {
                return [
                    {
                        color: "cal_hw",
                        words: ["HW", "Read", "Reading"],
            Severity: Major
            Found in public/js/utils.js - About 2 hrs to fix

              Function graph has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              window.graph.graph = function(){
                  //get data
                  var days = [];
                  var hwResult;
              
              
              Severity: Major
              Found in public/js/graphs.js - About 2 hrs to fix

                File app.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*
                    MyHomeworkSpace
                    https://myhomework.space/
                    https://github.com/MyHomeworkSpace/MyHomeworkSpace
                    Licensed under the MIT License.
                Severity: Minor
                Found in app.js - About 2 hrs to fix

                  Function loadWeek has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  window.planner.loadWeek = function(startDate) {
                      window.planner.loadState = 0;
                      window.page.showLoading();
                  
                      var startDate_obj = new Date(startDate);
                  Severity: Minor
                  Found in public/js/planner.js - About 1 hr to fix

                    Function loadWholeWeek has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    window.planner.loadWholeWeek = function(startDate, subjectIndex) {
                        window.api.get("planner/events/getWholeWeek/" + window.utils.formatDate_api(startDate), function(data) {
                            for (var announcementIndex in data.announcements) {
                                var announcement = data.announcements[announcementIndex];
                                var date = announcement.date.split("T")[0];
                    Severity: Minor
                    Found in public/js/planner.js - About 1 hr to fix

                      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

                              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

                              Function addContext has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function addContext(selector, data) {
                                      
                                      var d = new Date(),
                                          id = d.getTime(),
                                          $menu = buildMenu(data, id);
                              Severity: Minor
                              Found in public/js/context.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language