rbutrcom/rbutr-browser-extension

View on GitHub

Showing 77 of 77 total issues

Function PersistentStorage has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var PersistentStorage = function() {
        var ls, methods;
        try {
            ls = window.localStorage;
            ls.setItem("~~~", "!");
Severity: Major
Found in src/vendors/typeahead.js - About 3 hrs to fix

    Function Transport has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var Transport = function() {
            var pendingRequestsCount = 0, pendingRequests = {}, maxPendingRequests, requestCache;
            function Transport(o) {
                utils.bindAll(this);
                o = utils.isString(o) ? {
    Severity: Major
    Found in src/vendors/typeahead.js - About 3 hrs to fix

      Function RbutrApi has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      const RbutrApi = (utils) => {
      
          'use strict';
      
          const devDomain = 'https://russell.rbutr.com';
      Severity: Minor
      Found in src/rbutrApi.js - About 2 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 RbutrUtils has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      const RbutrUtils = () => {
      
          'use strict';
      
          const devStorageKey = 'rbutr.isDev';
      Severity: Minor
      Found in src/utils.js - About 2 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 RbutrUtils has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const RbutrUtils = () => {
      
          'use strict';
      
          const devStorageKey = 'rbutr.isDev';
      Severity: Major
      Found in src/utils.js - About 2 hrs to fix

        Function refreshSubmissionData has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const refreshSubmissionData = () => {
        
                const HTTP_LENGTH = 4;
        
                if (rbutr.getPropLen('sourceUrls') > ONE) {
        Severity: Major
        Found in src/popup.js - About 2 hrs to fix

          Function createMessageTemplate has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              const createMessageTemplate = ($data, requestedUrl) => {
          
                  let
                      messageTemplate = '',
                      rbutrLogo = '<img src="' + content.serverDomain + '/images/logohomepagelowres.png" width="24" class="rbutr-logo" alt="Rbutr">',
          Severity: Major
          Found in src/contentScript.js - About 2 hrs to fix

            File md5.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
             * Digest Algorithm, as defined in RFC 1321.
             * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
             * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
            Severity: Minor
            Found in src/vendors/md5.js - About 2 hrs to fix

              Function onreadystatechange has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              document.onreadystatechange = () => {
              
                  'use strict';
              
                  if (document.readyState === 'complete') {
              Severity: Major
              Found in src/contentScript.js - About 2 hrs to fix

                Function Platform has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const Platform = () => {
                
                    'use strict';
                
                    let properties = {
                Severity: Major
                Found in src/contentScript.js - About 2 hrs to fix

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

                              $('<img class="close" src="http://rbutr.com/images/button-removetag.png" id="s_x_' + i + '"/>').click((event) => {
                                  event.preventDefault();
                                  event.stopPropagation();
                                  rbutr.setProp('sourceUrls', i, null);
                                  refreshSubmissionData();
                  Severity: Major
                  Found in src/popup.js and 1 other location - About 2 hrs to fix
                  src/popup.js on lines 309..314

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

                  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

                              $('<img class="close" src="http://rbutr.com/images/button-removetag.png" id="r_x_' + j + '">').click((event) => {
                                  event.preventDefault();
                                  event.stopPropagation();
                                  rbutr.setProp('rebuttalUrls', j, null);
                                  refreshSubmissionData();
                  Severity: Major
                  Found in src/popup.js and 1 other location - About 2 hrs to fix
                  src/popup.js on lines 274..279

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

                  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

                      } else if (msg.response === 'submitRebuttalRequest') {
                          if (msg.status === 'success') {
                              popup.msg.add('info', msg.result);
                          } else if (msg.status === 'error') {
                              popup.msg.add('error', msg.result);
                  Severity: Major
                  Found in src/popup.js and 1 other location - About 2 hrs to fix
                  src/popup.js on lines 839..860

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

                  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

                      } else if (msg.response === 'submitIdea') {
                          if (msg.status === 'success') {
                              popup.msg.add('info', msg.result);
                          } else if (msg.status === 'error') {
                              popup.msg.add('error', msg.result);
                  Severity: Major
                  Found in src/popup.js and 1 other location - About 2 hrs to fix
                  src/popup.js on lines 846..860

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

                  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 Platform has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const Platform = () => {
                  
                      'use strict';
                  
                      let properties = {
                  Severity: Minor
                  Found in src/contentScript.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

                          for (let j = 0; j < getPropLen('sourceUrls'); j++) {
                              sourcePageTitles[j] = getProp('pageTitle', getProp('sourceUrls', j));
                              canonicalSourcePages[j] = getProp('urlIsCanonical', getProp('sourceUrls', j));
                          }
                  Severity: Major
                  Found in src/background.js and 1 other location - About 1 hr to fix
                  src/background.js on lines 378..381

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

                  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

                          for (let i = 0; i < getPropLen('rebuttalUrls'); i++) {
                              rebuttalPageTitles[i] = getProp('pageTitle', getProp('rebuttalUrls', i));
                              canonicalRebuttalPages[i] = getProp('urlIsCanonical', getProp('rebuttalUrls', i));
                          }
                  Severity: Major
                  Found in src/background.js and 1 other location - About 1 hr to fix
                  src/background.js on lines 383..386

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

                  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 getRebuttals has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      const getRebuttals = (tabId, url) => {
                  
                          setProp('rebuttals', tabId, null);
                          let canVote = false;
                          let recordedClick = getRecordedClickByToUrl(getProp('canonicalUrls', tabId));
                  Severity: Minor
                  Found in src/background.js - About 1 hr to fix

                    Function EventTarget has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        var EventTarget = function() {
                            var eventSplitter = /\s+/;
                            return {
                                on: function(events, callback) {
                                    var event;
                    Severity: Minor
                    Found in src/vendors/typeahead.js - About 1 hr to fix

                      Function submitRebuttals has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          const submitRebuttals = (tabId) => {
                      
                              let sourcePageTitles = [];
                              let rebuttalPageTitles = [];
                              let canonicalSourcePages = [];
                      Severity: Minor
                      Found in src/background.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language