ConnorWiseman/jcink-custom-structure

View on GitHub

Showing 41 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

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

                            if (topicSpans[0].textContent.indexOf('(Pages ') !== -1) {
                                this.setValue('pagination', topicSpans[0].innerHTML);
                                this.setValue('topicDescription', topicSpans[1].textContent);
                            } else {
                                this.setValue('pagination', this.config.paginationDefault);
        Severity: Major
        Found in src/cs.js and 1 other location - About 3 hrs to fix
        src/cs.js on lines 1176..1182

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

        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 (topicSpans[0].textContent.indexOf('(Pages ') !== -1) {
                                this.setValue('pagination', topicSpans[0].innerHTML);
                                this.setValue('topicDescription', topicSpans[1].textContent);
                            } else {
                                this.setValue('pagination', this.config.paginationDefault);
        Severity: Major
        Found in src/cs.js and 1 other location - About 3 hrs to fix
        src/cs.js on lines 1207..1213

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

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

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

                    var form = document.createElement('form'),
                        textarea = document.createElement('textarea'),
                        buttons = document.createElement('div'),
                        edit = document.createElement('button'),
                        cancel = document.createElement('button'),
                Severity: Major
                Found in src/cs.js and 1 other location - About 2 hrs to fix
                src/cs.js on lines 725..730

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

                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

                        var personalInfo = document.getElementById('profile-personalinfo'),
                            customFields = document.getElementById('profile-customfields'),
                            statistics   = document.getElementById('profile-statistics'),
                            contactInfo  = document.getElementById('profile-contactinfo'),
                            signature    = document.getElementById('sig_popup'),
                Severity: Major
                Found in src/cs.js and 1 other location - About 2 hrs to fix
                src/cs.js on lines 1457..1462

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

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

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

                  $cs.module.Topics.prototype.initialize = function(settings) {
                      // Call $cs.module.Default's initialize method instead.
                      $cs.module.Default.prototype.initialize.call(this, settings);
                  };
                  Severity: Major
                  Found in src/cs.js and 2 other locations - About 1 hr to fix
                  src/cs.js on lines 647..650
                  src/cs.js on lines 1850..1853

                  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

                  $cs.module.Profile.prototype.initialize = function(settings) {
                      // Call $cs.module.Default's initialize method instead.
                      $cs.module.Default.prototype.initialize.call(this, settings);
                  };
                  Severity: Major
                  Found in src/cs.js and 1 other location - About 1 hr to fix
                  src/cs.js on lines 319..322

                  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

                  $cs.module.Index.prototype.initialize = function(settings) {
                      // Call $cs.module.Default's initialize method instead.
                      $cs.module.Default.prototype.initialize.call(this, settings);
                  };
                  Severity: Major
                  Found in src/cs.js and 1 other location - About 1 hr to fix
                  src/cs.js on lines 1040..1043

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language