rbutrcom/rbutr-browser-extension

View on GitHub

Showing 77 of 77 total issues

File typeahead.js has 1130 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * typeahead.js 0.9.3
 * https://github.com/twitter/typeahead
 * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT
 */
Severity: Major
Found in src/vendors/typeahead.js - About 2 days to fix

    Function Popup has 318 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Popup = () => {
    
        'use strict';
    
        const ZERO = 0;
    Severity: Major
    Found in src/popup.js - About 1 day to fix

      Function Rbutr has 281 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Rbutr = () => {
      
          'use strict';
      
          let properties = {
      Severity: Major
      Found in src/background.js - About 1 day to fix

        Function Rbutr has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
        Open

        const Rbutr = () => {
        
            'use strict';
        
            let properties = {
        Severity: Minor
        Found in src/background.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 TypeaheadView has 215 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var TypeaheadView = function() {
                var html = {
                    wrapper: '<span class="twitter-typeahead"></span>',
                    hint: '<input class="tt-hint" type="text" autocomplete="off" spellcheck="off" disabled>',
                    dropdown: '<span class="tt-dropdown-menu"></span>'
        Severity: Major
        Found in src/vendors/typeahead.js - About 1 day to fix

          Function Content has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
          Open

          const Content = () => {
          
              'use strict';
          
              let canonicalValue = $('head link[rel=canonical]').attr('href');
          Severity: Minor
          Found in src/contentScript.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 Popup has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
          Open

          const Popup = () => {
          
              'use strict';
          
              const ZERO = 0;
          Severity: Minor
          Found in src/popup.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 Dataset has 192 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var Dataset = function() {
                  var keys = {
                      thumbprint: "thumbprint",
                      protocol: "protocol",
                      itemHash: "itemHash",
          Severity: Major
          Found in src/vendors/typeahead.js - About 7 hrs to fix

            Function Content has 185 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Content = () => {
            
                'use strict';
            
                let canonicalValue = $('head link[rel=canonical]').attr('href');
            Severity: Major
            Found in src/contentScript.js - About 7 hrs to fix

              File popup.js has 448 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*!
               * Rbutr Browser Extension v0.12.0
               * https://github.com/rbutrcom/rbutr-browser-extension
               *
               * Copyright 2012-2017 The Rbutr Community
              Severity: Minor
              Found in src/popup.js - About 6 hrs to fix

                Function DropdownView has 167 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var DropdownView = function() {
                        var html = {
                            suggestionsList: '<span class="tt-suggestions"></span>'
                        }, css = {
                            suggestionsList: {
                Severity: Major
                Found in src/vendors/typeahead.js - About 6 hrs to fix

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

                              if ($data.general.length > ZERO) {
                                  for (let index in $data.general) {
                  
                                      if (rbutrUtils.unicode2String($data.general[index].fromPage.url) === requestedUrl) {
                                          rebuttedCount++;
                  Severity: Major
                  Found in src/contentScript.js and 1 other location - About 6 hrs to fix
                  src/contentScript.js on lines 317..328

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

                  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 ($data.direct.length > ZERO) {
                                  for (let index in $data.direct) {
                  
                                      if (rbutrUtils.unicode2String($data.direct[index].fromPage.url) === requestedUrl) {
                                          rebuttedCount++;
                  Severity: Major
                  Found in src/contentScript.js and 1 other location - About 6 hrs to fix
                  src/contentScript.js on lines 329..340

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

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

                      var InputView = function() {
                          function InputView(o) {
                              var that = this;
                              utils.bindAll(this);
                              this.specialKeyCodeMap = {
                  Severity: Major
                  Found in src/vendors/typeahead.js - About 4 hrs to fix

                    File background.js has 364 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /*!
                     * Rbutr Browser Extension v0.12.0
                     * https://github.com/rbutrcom/rbutr-browser-extension
                     *
                     * Copyright 2012-2017 The Rbutr Community
                    Severity: Minor
                    Found in src/background.js - About 4 hrs to fix

                      File contentScript.js has 350 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*!
                       * Rbutr Browser Extension v0.12.0
                       * https://github.com/rbutrcom/rbutr-browser-extension
                       *
                       * Copyright 2012-2017 The Rbutr Community
                      Severity: Minor
                      Found in src/contentScript.js - About 4 hrs to fix

                        Function RbutrApi has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const RbutrApi = (utils) => {
                        
                            'use strict';
                        
                            const devDomain = 'https://russell.rbutr.com';
                        Severity: Major
                        Found in src/rbutrApi.js - About 4 hrs to fix

                          Function binl_md5 has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function binl_md5(x, len)
                          {
                            /* append padding */
                            x[len >> 5] |= 0x80 << ((len) % 32);
                            x[(((len + 64) >>> 9) << 4) + 14] = len;
                          Severity: Major
                          Found in src/vendors/md5.js - About 3 hrs to fix

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

                                    api.submitRebuttalRequest(submitParameters, (success, result) => {
                                        if (success === true) {
                                            popupPort.postMessage({response: 'submitRebuttalRequest', status: 'success', result: result});
                                        } else {
                                            popupPort.postMessage({response: 'submitRebuttalRequest', status: 'error', result: `Rebuttal request could not be submitted: ${result}`});
                            Severity: Major
                            Found in src/background.js and 1 other location - About 3 hrs to fix
                            src/background.js on lines 429..435

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

                            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

                                    api.submitIdea(submitParameters, (success, result) => {
                                        if (success === true) {
                                            popupPort.postMessage({response: 'submitIdea', status: 'success', result: result});
                                        } else {
                                            popupPort.postMessage({response: 'submitIdea', status: 'error', result: `Idea could not be submitted: ${result}`});
                            Severity: Major
                            Found in src/background.js and 1 other location - About 3 hrs to fix
                            src/background.js on lines 456..462

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

                            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