ConnorWiseman/jcink-custom-structure

View on GitHub

Showing 41 of 41 total issues

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

$cs.module.Stats.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 1282..1285
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 3 locations. Consider refactoring.
Open

$cs.module.Posts.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 1282..1285

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

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

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

            request.onreadystatechange = function() {
                if (request.readyState > 3 && callback && typeof(callback) == 'function') {
                    callback(request.responseText);
                }
            };
    Severity: Major
    Found in src/cs.js and 1 other location - About 1 hr to fix
    src/cs.js on lines 1375..1379

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

    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

            request.onreadystatechange = function() {
                if (request.readyState > 3 && callback && typeof(callback) == 'function') {
                    callback(request.responseText);
                }
            };
    Severity: Major
    Found in src/cs.js and 1 other location - About 1 hr to fix
    src/cs.js on lines 1397..1401

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

    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

    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

            Avoid deeply nested control flow statements.
            Open

                            switch (titleContents) {
                                case 'Announcements':
                                    rowClass = ' announcement-topic';
                                    topicsContent += '<div class="topic-title-row">' + this.config.announcementsDefault + '</div>';
                                    break;
            Severity: Major
            Found in src/cs.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if (postLinks[l].href.indexOf('act=Post&CODE=08') !== -1) {
              
                                      // ... attach an event listener.
                                      postLinks[l].addEventListener('click', function(event) {
                                          event.preventDefault();
              Severity: Major
              Found in src/cs.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if (child.nodeType === 1 && child.tagName === 'TD') {
                                        if (child.parentNode.parentNode.parentNode === table) {
                                            cells.push(child);
                                        }
                                    }
                Severity: Major
                Found in src/cs.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if (!topicTitle.getAttribute('title')) {
                                          topicTitle = cells[2].getElementsByTagName('a')[1];
                                      }
                  Severity: Major
                  Found in src/cs.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    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 - About 45 mins to fix

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

                      $cs.module.Posts.prototype.createEditForm = function(forumId, topicId, postId, pageId, response, contentContainer) {
                      Severity: Minor
                      Found in src/cs.js - About 45 mins to fix

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

                                if (userPhoto) {
                                    this.setValue('userPhoto', userPhoto.src);
                                } else {
                                    this.setValue('userPhoto', this.config.userPhotoDefault);
                                }
                        Severity: Minor
                        Found in src/cs.js and 1 other location - About 35 mins to fix
                        src/cs.js on lines 742..746

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

                        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 (userPhoto) {
                                    this.setValue('userPhoto', userPhoto.src);
                                } else {
                                    this.setValue('userPhoto', this.config.userPhotoDefault);
                                }
                        Severity: Minor
                        Found in src/cs.js and 1 other location - About 35 mins to fix
                        src/cs.js on lines 872..876

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

                        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

                                    if (postLinks.length > 1) {
                                        this.setValue('postAuthor', cells[0].innerHTML.split('normalname">')[1].slice(0, -7));
                                    } else {
                        Severity: Minor
                        Found in src/cs.js and 1 other location - About 35 mins to fix
                        src/cs.js on lines 1749..1751

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

                        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