Showing 55 of 85 total issues
Function handleDeprecatedOptions
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleDeprecatedOptions (options) {
if (options.tags) {
const tagDefinitions = Object.entries(options.tags).map(
([selector, definition]) => ({ ...definition, selector: selector || '*' })
);
Function addInline
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
addInline (str, { noWordTransform = false } = {}) {
if (!(
this._stackItem instanceof BlockStackItem
|| this._stackItem instanceof ListItemStackItem
|| this._stackItem instanceof TableCellStackItem
Function formatList
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function formatList (elem, walk, builder, formatOptions, nextPrefixCallback) {
const isNestedList = get(elem, ['parent', 'name']) === 'li';
// With Roman numbers, index length is not as straightforward as with Arabic numbers or letters,
// so the dumb length comparison is the most robust way to get the correct value.
- 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 formatList
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function formatList (elem, walk, builder, formatOptions, nextPrefixCallback) {
const isNestedList = get(elem, ['parent', 'name']) === 'li';
// With Roman numbers, index length is not as straightforward as with Arabic numbers or letters,
// so the dumb length comparison is the most robust way to get the correct value.
- 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 formatAnchor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function formatAnchor (elem, walk, builder, formatOptions) {
function getHref () {
if (formatOptions.ignoreHref) { return ''; }
if (!elem.attribs || !elem.attribs.href) { return ''; }
let href = elem.attribs.href.replace(/^mailto:/, '');
Function formatAnchor
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function formatAnchor (elem, walk, builder, formatOptions) {
const attribs = elem.attribs || {};
if (attribs.name && !attribs.href) {
builder.startNoWrap();
builder.addInline(
Function splitLongWord
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
splitLongWord (word) {
const parts = [];
let idx = 0;
while (word.length > this.maxLineLength) {
Function compile
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function compile (options = {}) {
const selectorsWithoutFormat = options.selectors.filter(s => !s.format);
if (selectorsWithoutFormat.length) {
throw new Error(
'Following selectors have no specified format: ' +
Function findBases
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function findBases (dom, options, baseSelectorsPicker) {
const results = [];
function recursiveWalk (walk, /** @type { DomNode[] } */ dom) {
dom = dom.slice(0, options.limits.maxChildNodes);
Function collectDefinitionGroups
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function collectDefinitionGroups (elem) {
const defItems = [];
function handleDtDd (el) {
if (el.name === 'dt' || el.name === 'dd') {
defItems.push(el);
Function renderRowsTag
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function renderRowsTag (layout, colNumber, rowNumber) {
const outputLines = [];
for (let x = 0; x < colNumber; x++) {
for (let y = 0; y < rowNumber; y++) {
const cell = layout[x][y];
- 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 pushWord
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
pushWord (word, noWrap = false) {
if (this.nextLineAvailableChars <= 0 && !noWrap) {
this.startNewLine();
}
const isLineStart = this.nextLineWords.length === 0;
- 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 formatList
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function formatList (elem, walk, builder, formatOptions, nextPrefixCallback) {
const isNestedList = get(elem, ['parent', 'name']) === 'li';
// With Roman numbers, index length is not as straightforward as with Arabic numbers or letters,
// so the dumb length comparison is the most robust way to get the correct value.
Function recursiveWalk
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function recursiveWalk (walk, dom, builder) {
if (!dom) { return; }
const options = builder.options;
Function formatList
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function formatList (elem, walk, builder, formatOptions, nextPrefixCallback) {
const isNestedList = get(elem, ['parent', 'name']) === 'li';
// With Roman numbers, index length is not as straightforward as with Arabic numbers or letters,
// so the dumb length comparison is the most robust way to get the correct value.
Function walkTable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function walkTable (elem) {
if (elem.type !== 'tag') { return; }
switch (elem.name) {
case 'thead':
Function addInline
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
addInline (str, { noWordTransform = false } = {}) {
if (!(
this._stackItem instanceof BlockStackItem
|| this._stackItem instanceof ListItemStackItem
|| this._stackItem instanceof TableCellStackItem
- 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 renderRowsFirstCol
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function renderRowsFirstCol (layout, colNumber, rowNumber) {
const outputLines = [];
for (let x = 0; x < colNumber; x++) {
for (let y = 0; y < rowNumber; y++) {
const cell = layout[x][y];
- 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 renderRowsFirstRow
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function renderRowsFirstRow (layout, colNumber, rowNumber) {
const outputLines = [];
for (let x = 0; x < colNumber; x++) {
for (let y = 0; y < rowNumber; y++) {
const cell = layout[x][y];
- 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 process
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function process (html, metadata, options, picker, findBaseElements, walk) {