ConnorWiseman/jcink-custom-structure

View on GitHub

Showing 26 of 41 total issues

File cs.js has 1047 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @file
 * A DOM manipilation utility library for the version of IPB running on the
 * free forum hosting service, Jcink, that reads table information and accepts
 * a user-defined template for text replacement. Allows for the structuring
Severity: Major
Found in src/cs.js - About 2 days to fix

    Function execute has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
    Open

    $cs.module.Profile.prototype.execute = function() {
        var portalStyle = document.getElementById('profile-heading'),
            defaultStyle = document.getElementById('profilename');
        // Check for personal portal style profiles first, since those are the default.
        if (portalStyle) {
    Severity: Minor
    Found in src/cs.js - About 1 day 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 execute has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
    Open

    $cs.module.Topics.prototype.execute = function() {
        var topicList = document.getElementById('topic-list');
        // If we couldn't find the default topic list, check what page we're on.
        if (!topicList) {
            if (this.config.activeTopics && window.location.href.indexOf('act=Search&CODE=getactive') > -1) {
    Severity: Minor
    Found in src/cs.js - About 1 day 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 execute has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

    $cs.module.Posts.prototype.execute = function() {
        // Make sure we're viewing a topic before executing.
        if (window.location.href.indexOf('showtopic') !== -1 || window.location.href.indexOf('ST') !== -1) {
            var posts = document.getElementsByClassName('post-normal');
    
    
    Severity: Minor
    Found in src/cs.js - About 1 day 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 execute has 220 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    $cs.module.Profile.prototype.execute = function() {
        var portalStyle = document.getElementById('profile-heading'),
            defaultStyle = document.getElementById('profilename');
        // Check for personal portal style profiles first, since those are the default.
        if (portalStyle) {
    Severity: Major
    Found in src/cs.js - About 1 day to fix

      Function readTable has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

      $cs.module.Index.prototype.readTable = function(table, index) {
          // Acquire all the rows in the table.
          var rows = table.getElementsByTagName('tr');
      
          // Temporarily hide the table. It will be removed altogether later on.
      Severity: Minor
      Found in src/cs.js - About 6 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 execute has 122 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      $cs.module.Topics.prototype.execute = function() {
          var topicList = document.getElementById('topic-list');
          // If we couldn't find the default topic list, check what page we're on.
          if (!topicList) {
              if (this.config.activeTopics && window.location.href.indexOf('act=Search&CODE=getactive') > -1) {
      Severity: Major
      Found in src/cs.js - About 4 hrs to fix

        Function execute has 94 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        $cs.module.Posts.prototype.execute = function() {
            // Make sure we're viewing a topic before executing.
            if (window.location.href.indexOf('showtopic') !== -1 || window.location.href.indexOf('ST') !== -1) {
                var posts = document.getElementsByClassName('post-normal');
        
        
        Severity: Major
        Found in src/cs.js - About 3 hrs to fix

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

          $cs.module.Default.prototype.initialize = function(settings) {
              // Make sure we have an object to work with.
              settings = settings || {};
          
              // If we have an empty settings object, display an error message and return false.
          Severity: Minor
          Found in src/cs.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 readTable has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          $cs.module.Index.prototype.readTable = function(table, index) {
              // Acquire all the rows in the table.
              var rows = table.getElementsByTagName('tr');
          
              // Temporarily hide the table. It will be removed altogether later on.
          Severity: Major
          Found in src/cs.js - About 3 hrs to fix

            Function createEditForm has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            $cs.module.Posts.prototype.createEditForm = function(forumId, topicId, postId, pageId, response, contentContainer) {
                // Create all our elements.
                var form = document.createElement('form'),
                    textarea = document.createElement('textarea'),
                    buttons = document.createElement('div'),
            Severity: Major
            Found in src/cs.js - About 3 hrs to fix

              Function execute has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              $cs.module.Stats.prototype.execute = function() {
                  var boardStats = document.getElementById('boardstats');
                  if (boardStats) {
                      var table = boardStats.lastElementChild;
                      // Hide the original table.
              Severity: Major
              Found in src/cs.js - About 2 hrs to fix

                Function formatQuoteCodeTags has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                $cs.module.Posts.prototype.formatQuoteCodeTags = function(tags) {
                    for (var m = tags.length; m > -1; m--) {
                        if (typeof tags[m] !== 'undefined' && tags[m].id == 'QUOTE-WRAP') {
                            tags[m].style.display = 'none';
                            var quoteTitleContents = tags[m].firstElementChild.firstElementChild.firstElementChild.innerHTML.slice(14, -1).split(' @ ');
                Severity: Minor
                Found in src/cs.js - About 1 hr to fix

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

                  $cs.module.Stats.prototype.execute = function() {
                      var boardStats = document.getElementById('boardstats');
                      if (boardStats) {
                          var table = boardStats.lastElementChild;
                          // Hide the original table.
                  Severity: Minor
                  Found in src/cs.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 initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  $cs.module.Default.prototype.initialize = function(settings) {
                      // Make sure we have an object to work with.
                      settings = settings || {};
                  
                      // If we have an empty settings object, display an error message and return false.
                  Severity: Minor
                  Found in src/cs.js - About 1 hr to fix

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

                    $cs.module.Posts.prototype.formatQuoteCodeTags = function(tags) {
                        for (var m = tags.length; m > -1; m--) {
                            if (typeof tags[m] !== 'undefined' && tags[m].id == 'QUOTE-WRAP') {
                                tags[m].style.display = 'none';
                                var quoteTitleContents = tags[m].firstElementChild.firstElementChild.firstElementChild.innerHTML.slice(14, -1).split(' @ ');
                    Severity: Minor
                    Found in src/cs.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

                    Avoid deeply nested control flow statements.
                    Open

                                        if (key in this) {
                                            this[key][subkey] = settings[key][subkey];
                                        }
                    Severity: Major
                    Found in src/cs.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if (reputation.indexOf('pts') !== -1) {
                                              this.setValue('reputationTotal', reputation.split('pts [')[0]);
                                          } else {
                                              this.setValue('reputationTotal', '0');
                                          }
                      Severity: Major
                      Found in src/cs.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        else if (this.config.activeTopics) {
                                            this.setValue('folder', cells[0].innerHTML);
                                            this.setValue('marker', cells[1].innerHTML);
                                            var topicTitleLinks = cells[2].getElementsByTagName('a');
                                            if (topicTitleLinks[0].href.indexOf('view=getnewpost') === -1) {
                        Severity: Major
                        Found in src/cs.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                          if (!viewingActiveTopics) {
                                              // This forum contains no topics. Display a message and call it good.
                                              topicsContent += '<div class="no-topics">' + this.config.noTopics + '</div>';
                                          } else if (this.config.activeTopics) {
                                              // This active topics list is blank. Display a message and call it good.
                          Severity: Major
                          Found in src/cs.js - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language