talyssonoc/jsT9

View on GitHub

Showing 12 of 12 total issues

File jst9.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @constructor
 */
var jsT9 = function jsT9(_wordList, _config) {
  'use strict';
Severity: Minor
Found in src/jst9.js - About 2 hrs to fix

    Function _slackSearch has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      _slackSearch: function _slackSearch(word, currentBranch) {
        var baseWord = '';
        var subString;
        var branch;
        var found;
    Severity: Minor
    Found in src/jst9.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 _normalSearch has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      _normalSearch: function _normalSearch(word, currentBranch) {
        var baseWord = '';
        var branchPrefix;
        var branch;
        var found;
    Severity: Minor
    Found in src/jst9.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 addWord has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      addWord: function addWord(word) {
    
        var branch = this.root;
        var stopSearchOnCurrentBranch = false;
        var newNode;
    Severity: Minor
    Found in src/jst9.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 jsT9 has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var jsT9 = function jsT9(_wordList, _config) {
      'use strict';
    
      this.config = {
        sort: function sort(wordA, wordB) {
    Severity: Minor
    Found in src/jst9.js - About 1 hr to fix

      Function _normalSearch has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _normalSearch: function _normalSearch(word, currentBranch) {
          var baseWord = '';
          var branchPrefix;
          var branch;
          var found;
      Severity: Minor
      Found in src/jst9.js - About 1 hr to fix

        Function _slackSearch has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _slackSearch: function _slackSearch(word, currentBranch) {
            var baseWord = '';
            var subString;
            var branch;
            var found;
        Severity: Minor
        Found in src/jst9.js - About 1 hr to fix

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

          var jsT9 = function jsT9(_wordList, _config) {
            'use strict';
          
            this.config = {
              sort: function sort(wordA, wordB) {
          Severity: Minor
          Found in src/jst9.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 _tryCase3 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _tryCase3: function _tryCase3(branch, word, b) {
              var newNode;
          
              for (var i = 0; i <= word.length - 1; i++) {
                //Cuts the word starting from the end,
          Severity: Minor
          Found in src/jst9.js - About 1 hr to fix

            Function addWord has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              addWord: function addWord(word) {
            
                var branch = this.root;
                var stopSearchOnCurrentBranch = false;
                var newNode;
            Severity: Minor
            Found in src/jst9.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                          if (currentBranch.branches[branch].prefix === subString) {
                            word = word.substring(word.length - i);
                          }
                          //In cases where it begins with the substring, but doesn't end with it
                          //so it should just start the search from there
              Severity: Major
              Found in src/jst9.js - About 45 mins to fix

                Function _tryCase3 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  _tryCase3: function _tryCase3(branch, word, b) {
                    var newNode;
                
                    for (var i = 0; i <= word.length - 1; i++) {
                      //Cuts the word starting from the end,
                Severity: Minor
                Found in src/jst9.js - About 25 mins 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

                Severity
                Category
                Status
                Source
                Language