showdownjs/showdown

View on GitHub

Showing 54 of 103 total issues

File helpers.js has 2173 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * showdownjs helper functions
 */

if (!showdown.hasOwnProperty('helper')) {
Severity: Major
Found in src/helpers.js - About 6 days to fix

Function Converter has a Cognitive Complexity of 151 (exceeds 5 allowed). Consider refactoring.
Open

showdown.Converter = function (converterOptions) {
  'use strict';

  var
      /**
Severity: Minor
Found in src/converter.js - About 3 days 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 Converter has 330 lines of code (exceeds 25 allowed). Consider refactoring.
Open

showdown.Converter = function (converterOptions) {
  'use strict';

  var
      /**
Severity: Major
Found in src/converter.js - About 1 day to fix

Function validate has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

function validate (extension, name) {
  'use strict';

  var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
      ret = {
Severity: Minor
Found in src/showdown.js - About 1 day 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 getDefaultOpts has 182 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getDefaultOpts (simple) {
  'use strict';

  var defaultOptions = {
    omitExtraWLInCodeBlocks: {
Severity: Major
Found in src/options.js - About 7 hrs to fix

Function makehtmlCommand has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

function makehtmlCommand (options, cmd) {
  'use strict';

  // show configuration options for showdown helper if configHelp was passed
  if (options.configHelp) {
Severity: Minor
Found in src/cli/cli.js - About 4 hrs 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

File converter.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Created by Estevao on 31-05-2015.
 */

/**
Severity: Minor
Found in src/converter.js - About 4 hrs to fix

Function makehtmlCommand has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function makehtmlCommand (options, cmd) {
  'use strict';

  // show configuration options for showdown helper if configHelp was passed
  if (options.configHelp) {
Severity: Major
Found in src/cli/cli.js - About 3 hrs to fix

Function validate has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function validate (extension, name) {
  'use strict';

  var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
      ret = {
Severity: Major
Found in src/showdown.js - About 3 hrs to fix

Function processListItems has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function processListItems (listStr, trimTrailing) {
    // The $g_list_level global keeps track of when we're inside a list.
    // Each time we enter a list, we increment it; when we leave a list,
    // we decrement. If it's zero, we're not in a list anymore.
    //
Severity: Major
Found in src/subParsers/makehtml/lists.js - About 3 hrs to fix

Function rgxFindMatchPos has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

var rgxFindMatchPos = function (str, left, right, flags) {
  'use strict';
  var f = flags || '',
      g = f.indexOf('g') > -1,
      x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
Severity: Minor
Found in src/helpers.js - About 3 hrs 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 exports has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (config) {
  config.set({
    // global config of your BrowserStack account
    browserStack: {
      username: process.env.BROWSERSTACK_USERNAME,
Severity: Major
Found in karma.browserstack.js - About 2 hrs to fix

Function makeMarkdown has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  this.makeMarkdown = function (src) {

    // replace \r\n with \n
    src = src.replace(/\r\n/g, '\n');
    src = src.replace(/\r/g, '\n'); // old macs
Severity: Major
Found in src/converter.js - About 2 hrs to fix

Function makeHtml has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  this.makeHtml = function (text) {
    //check if text is not falsy
    if (!text) {
      return text;
    }
Severity: Major
Found in src/converter.js - About 2 hrs to fix

Function parseTable has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function parseTable (rawTable) {
    var i, tableLines = rawTable.split('\n');

    for (i = 0; i < tableLines.length; ++i) {
      // strip wrong first and last column if wrapped tables are used
Severity: Major
Found in src/subParsers/makehtml/tables.js - About 2 hrs to fix

Function headerId has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function headerId (m) {
    var title,
        prefix;

    // It is separate from other options to allow combining prefix and customized
Severity: Minor
Found in src/subParsers/makehtml/headers.js - About 1 hr to fix

Function writeImageTag has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {

    var gUrls   = globals.gUrls,
        gTitles = globals.gTitles,
        gDims   = globals.gDimensions;
Severity: Minor
Found in src/subParsers/makehtml/images.js - About 1 hr to fix

Function writeAnchorTag has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function writeAnchorTag (evt, options, globals, emptyCase) {

    var wholeMatch = evt.getMatches().wholeMatch;
    var text = evt.getMatches().text;
    var id = evt.getMatches().id;
Severity: Minor
Found in src/subParsers/makehtml/links.js - About 1 hr to fix

Function forEach has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

showdown.helper.forEach = function (obj, callback) {
  'use strict';
  // check if obj is defined
  if (showdown.helper.isUndefined(obj)) {
    throw new Error('obj param is required');
Severity: Minor
Found in src/helpers.js - About 1 hr 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 Event has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

showdown.helper.Event = function (name, text, params) {
  'use strict';

  var regexp = params.regexp || null;
  var matches = params.matches || {};
Severity: Minor
Found in src/helpers.js - About 1 hr to fix
Severity
Category
Status
Source
Language