takuyaa/kuromoji.js

View on GitHub

Showing 30 of 35 total issues

Avoid deeply nested control flow statements.
Open

                    if (head_char_class.class_name !== next_char_class.class_name) {
                        break;
                    }
Severity: Major
Found in src/viterbi/ViterbiBuilder.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if (compatible_category == null) {
                            continue;
                        }
    Severity: Major
    Found in src/dict/CharacterDefinition.js - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

          if (forward_id < 0 || backward_id < 0 || !isFinite(forward_id) || !isFinite(backward_id) ||
              this.connection_cost.forward_dimension <= forward_id || this.connection_cost.backward_dimension <= backward_id) {
              throw "Parse error of matrix.def";
          }
      Severity: Major
      Found in src/dict/builder/ConnectionCostsBuilder.js - About 40 mins to fix

        Function formatUnknownEntry has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        IpadicFormatter.prototype.formatUnknownEntry = function (word_id, position, type, features, surface_form) {
        Severity: Minor
        Found in src/util/IpadicFormatter.js - About 35 mins to fix

          Function put has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          TokenInfoDictionary.prototype.put = function (left_id, right_id, word_cost, surface_form, feature) {
          Severity: Minor
          Found in src/dict/TokenInfoDictionary.js - About 35 mins to fix

            Function CharacterClass has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function CharacterClass(class_id, class_name, is_always_invoke, is_grouping, max_length) {
            Severity: Minor
            Found in src/dict/CharacterClass.js - About 35 mins to fix

              Function getString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              ByteBuffer.prototype.getString = function (index) {
                  var buf = [],
                      ch;
                  if (index == null) {
                      index = this.position;
              Severity: Minor
              Found in src/util/ByteBuffer.js - About 35 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

              Function putLine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              ConnectionCostsBuilder.prototype.putLine = function (line) {
                  if (this.lines === 0) {
                      var dimensions = line.split(" ");
                      var forward_dimension = dimensions[0];
                      var backward_dimension = dimensions[1];
              Severity: Minor
              Found in src/dict/builder/ConnectionCostsBuilder.js - About 35 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

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

              TokenInfoDictionary.prototype.buildDictionary = function (entries) {
                  var dictionary_entries = {};  // using as hashmap, string -> string (word_id -> surface_form) to build dictionary
              
                  for (var i = 0; i < entries.length; i++) {
                      var entry = entries[i];
              Severity: Minor
              Found in src/dict/TokenInfoDictionary.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

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

              SurrogateAwareString.prototype.charCodeAt = function (index) {
                  if (this.index_mapping.length <= index) {
                      return NaN;
                  }
                  var surrogate_aware_index = this.index_mapping[index];
              Severity: Minor
              Found in src/util/SurrogateAwareString.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