NaturalIntelligence/fast-xml-parser

View on GitHub

Showing 135 of 267 total issues

Avoid too many return statements within this function.
Open

      return getErrorObject('InvalidTag', "Unclosed tag '"+tags[0].tagName+"'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
Severity: Major
Found in src/validator.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return getErrorObject('InvalidChar', "char '"+xmlData[i]+"' is not expected.", getLineNumberForPosition(xmlData, i));
    Severity: Major
    Found in src/validator.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return '';
      Severity: Major
      Found in src/xmlparser/OrderedObjParser.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
        Severity: Major
        Found in src/validator.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                        if (i.err) return i;
          Severity: Major
          Found in src/validator.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return true;
            Severity: Major
            Found in src/validator.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                            return getErrorObject('InvalidTag',
                              "Expected closing tag '"+otg.tagName+"' (opened in line "+openPos.line+", col "+openPos.col+") instead of closing tag '"+tagName+"'.",
                              getLineNumberForPosition(xmlData, tagStartPos));
              Severity: Major
              Found in src/validator.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return (
                        this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar +
                        val +
                        this.indentate(level) + tagEndExp    );
                Severity: Major
                Found in src/xmlbuilder/json2xml.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return getErrorObject('InvalidXml', 'Start tag expected.', 1);
                  Severity: Major
                  Found in src/validator.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return true;
                    Severity: Major
                    Found in src/validator.js - About 30 mins to fix

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

                      function parse(val){
                          if (typeof val === 'string') {
                              const temp = val.toLowerCase();
                              if(temp === 'true' || temp ==="yes" || temp==="1") return true;
                              else if(temp === 'false' || temp ==="no" || temp==="0") return false;
                      Severity: Minor
                      Found in src/v5/valueParsers/booleanParserExt.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 resolveNameSpace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function resolveNameSpace(name, removeNSPrefix) {
                        if (removeNSPrefix) {
                          const parts = name.split(':');
                          if(parts.length === 2){
                            if (parts[0] === 'xmlns') return '';
                      Severity: Minor
                      Found in src/v5/Xml2JsParser.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 closeTag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        closeTag(){
                          const tagName = this.tagName;
                          let value = this.value;
                          let textValue = this.textValue;
                      
                      
                      Severity: Minor
                      Found in src/v5/OutputBuilders/JsObjBuilder.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 validateNumberAmpersand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function validateNumberAmpersand(xmlData, i) {
                        let re = /\d/;
                        if (xmlData[i] === 'x') {
                          i++;
                          re = /[\da-fA-F]/;
                      Severity: Minor
                      Found in src/validator.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 readFromBuffer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        readFromBuffer(n, shouldUpdate) {
                          let ch;
                          if (n === 1) {
                            ch = this.buffer[this.startIndex];
                            if (ch === 10) {
                      Severity: Minor
                      Found in src/v5/inputSource/BufferSource.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