showdownjs/showdown

View on GitHub
src/subParsers/makehtml/links.js

Summary

Maintainability
D
3 days
Test Coverage

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 createEvent has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

  function createEvent (rgx, evtName, wholeMatch, text, id, url, title, options, globals) {
Severity: Major
Found in src/subParsers/makehtml/links.js - About 1 hr to fix

Function replaceAnchorTagReference has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  function replaceAnchorTagReference (rgx, evtRootName, options, globals, emptyCase) {
Severity: Minor
Found in src/subParsers/makehtml/links.js - About 35 mins to fix

Function replaceAnchorTagBaseUrl has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  function replaceAnchorTagBaseUrl (rgx, evtRootName, options, globals, emptyCase) {
Severity: Minor
Found in src/subParsers/makehtml/links.js - About 35 mins to fix

TODO found
Open

   * TODO WRITE THIS DOCUMENTATION
Severity: Minor
Found in src/subParsers/makehtml/links.js by fixme

TODO found
Open

   * TODO WRITE THIS DOCUMENTATION
Severity: Minor
Found in src/subParsers/makehtml/links.js by fixme

TODO found
Open

   * TODO WRITE THIS DOCUMENTATION
Severity: Minor
Found in src/subParsers/makehtml/links.js by fixme

TODO found
Open

   * TODO Normalize this
Severity: Minor
Found in src/subParsers/makehtml/links.js by fixme

TODO found
Open

   * TODO WRITE THIS DOCUMENTATION
Severity: Minor
Found in src/subParsers/makehtml/links.js by fixme

TODO found
Open

      // TODO Validation should be done at initialization not at runtime
Severity: Minor
Found in src/subParsers/makehtml/links.js by fixme

TODO found
Open

   * TODO MAKE THIS WORK (IT'S NOT ACTIVATED)
Severity: Minor
Found in src/subParsers/makehtml/links.js by fixme

TODO found
Open

   * TODO WRITE THIS DOCUMENTATION
Severity: Minor
Found in src/subParsers/makehtml/links.js by fixme

TODO found
Open

   * TODO WRITE THIS DOCUMENTATION
Severity: Minor
Found in src/subParsers/makehtml/links.js by fixme

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  showdown.subParser('makehtml.links.referenceShortcut', function (text, options, globals) {
    var evtRootName = evtRootName + '.referenceShortcut';

    text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();

Severity: Major
Found in src/subParsers/makehtml/links.js and 1 other location - About 4 hrs to fix
src/subParsers/makehtml/links.js on lines 228..239

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 134.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  showdown.subParser('makehtml.links.reference', function (text, options, globals) {
    var evtRootName = evtRootName + '.reference';

    text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();

Severity: Major
Found in src/subParsers/makehtml/links.js and 1 other location - About 4 hrs to fix
src/subParsers/makehtml/links.js on lines 244..255

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 134.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        } else if (/]/.test(char)) {
          var opPar2 = url.match(/\[/g) || [];
          var clPar2 = url.match(/\]/g);
          // it's a squared parenthesis so we need to check for "balance" (kinda)
          if (opPar2.length < clPar2.length) {
Severity: Major
Found in src/subParsers/makehtml/links.js and 1 other location - About 3 hrs to fix
src/subParsers/makehtml/links.js on lines 359..389

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 104.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        } else if (/\)/.test(char)) {
          var opPar = url.match(/\(/g) || [];
          var clPar = url.match(/\)/g);

          // it's a curved parenthesis so we need to check for "balance" (kinda)
Severity: Major
Found in src/subParsers/makehtml/links.js and 1 other location - About 3 hrs to fix
src/subParsers/makehtml/links.js on lines 373..389

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 104.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      if (options.encodeEmails) {
        url = showdown.helper.encodeEmailAddress(url + mail);
        mail = showdown.helper.encodeEmailAddress(mail);
      } else {
        url = url + mail;
Severity: Major
Found in src/subParsers/makehtml/links.js and 1 other location - About 1 hr to fix
src/subParsers/makehtml/links.js on lines 315..320

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      if (options.encodeEmails) {
        url = showdown.helper.encodeEmailAddress(url + mail);
        mail = showdown.helper.encodeEmailAddress(mail);
      } else {
        url = url + mail;
Severity: Major
Found in src/subParsers/makehtml/links.js and 1 other location - About 1 hr to fix
src/subParsers/makehtml/links.js on lines 414..419

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status