Showing 51 of 65 total issues
Function exports
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var headings = module.exports = function (md, options) {
var headingAnchorClass = options.headingAnchorClass || 'anchor'
var headingSvgClass = options.headingSvgClass || ['octicon', 'octicon-link']
var iconClasses = [].concat(headingSvgClass).join(' ')
// shamelessly borrowed from GitHub, thanks y'all
- 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 exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
var marky = module.exports = function (markdown, options) {
var html
if (typeof markdown !== 'string') {
throw Error('first argument must be a string')
- 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 exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
var plugin = module.exports = function (md, options) {
// monkey patch the 'fence' parsing rule to restore markdown-it's pre-5.1 behavior
// (see https://github.com/markdown-it/markdown-it/issues/190)
var stockFenceRule = md.renderer.rules.fence
md.renderer.rules.fence = function (tokens, idx, options, env, slf) {
- 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 heading_open
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.heading_open = function (tokens, idx, options, env, self) {
Function fence
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.fence = function (tokens, idx, options, env, slf) {
Function fence
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.fence = function (tokens, idx, options, env, slf) {
Function image
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.image = function (tokens, idx, options, env, self) {
Function paragraph_open
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.paragraph_open = function (tokens, idx, options, env, self) {
Function html_block
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.html_block = function (tokens, idx, options, env, self) {
Function html_inline
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.html_inline = function (tokens, idx, options, env, self) {
Function link_open
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.link_open = function handleLink (tokens, idx, options, env, self) {
Function image
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.image = function (tokens, idx, options, env, self) {
Function replaceTagAttribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function replaceTagAttribute (html, tag, attribute, buildUrl, repository) {
Function defaultRender
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var defaultRender = md.renderer.rules.link_open || function (tokens, idx, options, env, self) {
Function link_open
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.link_open = function (tokens, idx, options, env, self) {
Function image
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.image = function (tokens, idx, options, env, self) {
Function heading_open
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
md.renderer.rules.heading_open = function (tokens, idx, opts, env, self) {
Function exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (md, opts) {
if (!opts) return
if (!opts.package) return
if (!opts.package.name) return
if (!opts.package.version) return
- 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 replaceTagAttribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function replaceTagAttribute (html, tag, attribute, buildUrl, repository) {
// look for the attribute's value
var regex = new RegExp('<\\s*' + tag + '[^>]*\\b' + attribute + '\\s*=\\s*', 'i')
var attr = html.match(regex)
if (attr) {
- 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 isYoutubeIframe
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function isYoutubeIframe (content) {
// look for the src attribute's value
var attr = content.match(/<\s*iframe[^>]*\bsrc\s*=\s*/)
if (attr) {
// mark the location and figure out what kind of quotation mark is delimiting the 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"