digitalheir/bibliography-js

View on GitHub

Showing 49 of 101 total issues

Avoid too many return statements within this function.
Open

    else if (typeof obj === 'object' && (obj.type == 'quotedstringwrapper' || obj.type == 'bracedstringwrapper')) return StringValue.computeUnicodeString(0, obj.data);
Severity: Major
Found in depr/bibtex/field_value/StringValue.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          if (diacriticHandler) return diacriticHandler(escapeString.substring(2));
    Severity: Major
    Found in depr/bibtex/field_value/StringValue.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        else if (obj.constructor == Number) return obj+"";
      Severity: Major
      Found in depr/bibtex/field_value/StringValue.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return ({
              type: 'braced',
              data: flatten(obj.data)
            });
        Severity: Major
        Found in depr/bibtex/field_value/StringValue.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return tokens;
          Severity: Major
          Found in depr/bibtex/field_value/StringValue.js - About 30 mins to fix

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

                {"name": "stringreftoken", "symbols": ["stringreftoken$subexpression$1"], "postprocess": function (data, location, reject) { if(typeof data[0][0]=='object') {if(!data[0][0].string)throw new Error("Expected "+data[0]+"to have a 'string' field");return data[0][0].string;} else {if((!(typeof data[0][0] == 'string'||typeof data[0][0]=='number')))throw new Error("Expected "+data[0][0]+" to be a string");return data[0][0]; }}},
            Severity: Minor
            Found in depr/bibtex/parser/parser.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 postprocess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                {"name": "stringreftoken_n_num", "symbols": ["stringreftoken_n_num$subexpression$1"], "postprocess": function (data, location, reject) { if(typeof data[0][0]=='object') {if(!data[0][0].string)throw new Error("Expected "+data[0]+"to have a 'string' field");return data[0][0].string;} else {if((!(typeof data[0][0] == 'string'||typeof data[0][0]=='number')))throw new Error("Expected "+data[0][0]+" to be a string");return data[0][0]; }}},
            Severity: Minor
            Found in depr/bibtex/parser/parser.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 flattenToString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function flattenToString(authorToken) {
              if (typeof authorToken === 'string') return authorToken;
              else if (authorToken.type == 'braced')  return flattenToString(authorToken.data);
              else if (authorToken.type == 'ws') {
                //console.log(authorToken)
            Severity: Minor
            Found in depr/bibtex/field_value/utils.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 getStringUntilNonEscapedChar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              getStringUntilNonEscapedChar(terminalRegex) {
                if (typeof terminalRegex === 'string') {
                }
                const chars = [];
                for (let i = this.pos; i < this.len; i++) {
            Severity: Minor
            Found in depr/bibtex/lexer/lexer.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