Showing 20 of 22 total issues
Function notionBlockToMarkdown
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
exports.notionBlockToMarkdown = (block, lowerTitleLevel) => {
// Get the child content of the block.
let childMarkdown = (block.children ?? [])
.map((block) => this.notionBlockToMarkdown(block, lowerTitleLevel))
.join("")
- 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 notionBlockToMarkdown
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.notionBlockToMarkdown = (block, lowerTitleLevel) => {
// Get the child content of the block.
let childMarkdown = (block.children ?? [])
.map((block) => this.notionBlockToMarkdown(block, lowerTitleLevel))
.join("")
Function blockToString
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
exports.blockToString = (textBlocks) =>
textBlocks.reduce((text, textBlock) => {
const data = {
...textBlock.text,
...textBlock.annotations,
- 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 getBlocks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
exports.getBlocks = async ({ id, notionVersion, token }, reporter) => {
let hasMore = true
let blockContent = []
let startCursor = ""
- 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 getPages
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.getPages = async ({ token, databaseId, notionVersion = "2021-05-13" }, reporter, cache) => {
let hasMore = true
let startCursor = ""
const url = `https://api.notion.com/v1/databases/${databaseId}/query`
const body = {
- 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
Avoid too many return
statements within this function. Open
return [EOL_MD, block.embed.url, EOL_MD].join("")
Avoid too many return
statements within this function. Open
return `${EOL_MD}---${EOL_MD}`
Avoid too many return
statements within this function. Open
return [EOL_MD, `<!-- This block type '${block.type}' is not supported yet. -->`, EOL_MD].join("")
Avoid too many return
statements within this function. Open
return [EOL_MD, prependToLines(markdown, ">", false), EOL_MD].join("")
Avoid too many return
statements within this function. Open
return prependToLines(markdown, "*").concat(EOL_MD)
Avoid too many return
statements within this function. Open
return [
"<Column>",
EOL_MD,
EOL_MD,
markdown,
Avoid too many return
statements within this function. Open
return prependToLines(markdown, "1.").concat(EOL_MD)
Avoid too many return
statements within this function. Open
return [EOL_MD, block.video.external.url, EOL_MD].join("")
Avoid too many return
statements within this function. Open
return `${EOL_MD}[${bookmarkCaption}](${bookmarkUrl})${EOL_MD}`
Avoid too many return
statements within this function. Open
return [EOL_MD, "<audio controls>", `<source src="${audioUrl}" />`, "</audio>", EOL_MD].join("")
Avoid too many return
statements within this function. Open
return prependToLines(markdown, symbol).concat(EOL_MD)
Avoid too many return
statements within this function. Open
return `${EOL_MD}![${blockToString(block.image.caption)}](${imageUrl})${EOL_MD}`
Avoid too many return
statements within this function. Open
return [
EOL_MD,
"<details><summary>",
blockMarkdown,
"</summary>",
Avoid too many return
statements within this function. Open
return [
EOL_MD,
`\`\`\` ${block.code.language}${EOL_MD}`,
blockMarkdown,
EOL_MD,
Avoid too many return
statements within this function. Open
return [
EOL_MD,
"<ColumnList>",
EOL_MD,
markdown,