Showing 6 of 11 total issues
Function serializeToXml
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serializeToXml (value, name = undefined, options = undefined, indentDepth = 0) {
const isComplex = isComplexValue(value)
const isScalar = isScalarValue(value)
if (!isComplex && !isScalar && !_.isNil(value)) {
throw new TypeError(`${typeof value} is not supported`)
Function serializeToXml
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function serializeToXml (value, name = undefined, options = undefined, indentDepth = 0) {
const isComplex = isComplexValue(value)
const isScalar = isScalarValue(value)
if (!isComplex && !isScalar && !_.isNil(value)) {
throw new TypeError(`${typeof value} is not supported`)
- Read upRead up
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 deserializeFromXml
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function deserializeFromXml (xml) {
const node = _.isString(xml)
? new DOMParser().parseFromString(xml).documentElement
: xml
- Read upRead up
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 deserializeFromXml
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function deserializeFromXml (xml) {
const node = _.isString(xml)
? new DOMParser().parseFromString(xml).documentElement
: xml
Function constructor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (selector = '/*/*') {
check.assert.string(selector)
super({
objectMode: false,
Function _transform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_transform (chunk, encoding, callback) {
let xmlChunk
try {
xmlChunk = serializeToXml(chunk, this.itemElementName, {
indent: this.indent
- Read upRead up
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"