sverweij/mscgen_js

View on GitHub

Showing 33 of 33 total issues

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

  window.__btn_anim_dec.addEventListener('click',
    function () {
      dec()
      gaga.g('send', 'event', 'anim_dec', 'button')
    },
Severity: Major
Found in src/script/interpreter/animator.js and 4 other locations - About 55 mins to fix
src/script/interpreter/animator.js on lines 133..139
src/script/interpreter/animator.js on lines 147..153
src/script/interpreter/animator.js on lines 154..160
src/script/interpreter/animator.js on lines 161..167

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 53.

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 5 locations. Consider refactoring.
Open

  window.__btn_anim_inc.addEventListener('click',
    function () {
      inc()
      gaga.g('send', 'event', 'anim_inc', 'button')
    },
Severity: Major
Found in src/script/interpreter/animator.js and 4 other locations - About 55 mins to fix
src/script/interpreter/animator.js on lines 133..139
src/script/interpreter/animator.js on lines 140..146
src/script/interpreter/animator.js on lines 147..153
src/script/interpreter/animator.js on lines 161..167

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 53.

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 3 locations. Consider refactoring.
Open

  dotOnClick: function () {
    window.open(exporter.todotURI(uistate.getAST()))
    gaga.g('send', 'event', 'show_dot', 'button')
  },
Severity: Major
Found in src/script/interpreter/output-actions.js and 2 other locations - About 45 mins to fix
src/script/interpreter/output-actions.js on lines 71..74
src/script/interpreter/output-actions.js on lines 75..78

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 50.

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

Function _g has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function _g (pCommand, pEvent, pCategory, pAction, pLabel, pValue) {
Severity: Minor
Found in src/script/utl/gaga.js - About 45 mins to fix

    Function g has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      g: function (pCommand, pEvent, pCategory, pAction, pLabel, pValue) {
    Severity: Minor
    Found in src/script/utl/gaga.js - About 45 mins to fix

      Function processParams has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function processParams () {
        var lParams = queryString.parse(window.location.search)
        setupGA(maps.sanitizeBooleanesque(lParams.donottrack))
      
        uistate.setDebug(maps.sanitizeBooleanesque(lParams.debug))
      Severity: Minor
      Found in src/script/interpreter/param-actions.js - About 45 mins 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

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

        vanillaOnClick: function () {
          window.open(exporter.toVanillaMscGenURI(uistate.getAST()))
          gaga.g('send', 'event', 'show_vanilla', 'button')
        },
      Severity: Major
      Found in src/script/interpreter/output-actions.js and 2 other locations - About 45 mins to fix
      src/script/interpreter/output-actions.js on lines 67..70
      src/script/interpreter/output-actions.js on lines 75..78

      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 50.

      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 3 locations. Consider refactoring.
      Open

        doxygenOnClick: function () {
          window.open(exporter.toDoxygenURI(uistate.getAST()))
          gaga.g('send', 'event', 'show_doxygen', 'button')
        },
      Severity: Major
      Found in src/script/interpreter/output-actions.js and 2 other locations - About 45 mins to fix
      src/script/interpreter/output-actions.js on lines 67..70
      src/script/interpreter/output-actions.js on lines 71..74

      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 50.

      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

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

      function source2LocationString (pLocation, pSource, pLanguage, pMirrorEntities, pNamedStyle) {
      Severity: Minor
      Found in src/script/utl/exporter.js - About 35 mins to fix

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

          toLocationString: function (pLocation, pSource, pLanguage, pMirrorEntities, pNamedStyle) {
        Severity: Minor
        Found in src/script/utl/exporter.js - About 35 mins to fix

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

          function sourceIsURLable (pLocation, pSource, pLanguage, pMirrorEntities, pNamedStyle) {
          Severity: Minor
          Found in src/script/utl/exporter.js - About 35 mins to fix

            Function ajax has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              ajax: function (pURL, pSuccessFunction, pErrorFunction) {
                var lHttpRequest = new XMLHttpRequest()
                lHttpRequest.onreadystatechange = function (pEvent) {
                  if (pEvent.target.readyState === XMLHttpRequest.DONE) {
                    if (lHttpRequest.status === 200) {
            Severity: Minor
            Found in src/script/utl/domutl.js - About 35 mins 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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function render (pSource, pLanguage) {
              preRenderReset()
              try {
                var lAST = getASTBare(pSource, pLanguage)
                if (state.getDebug()) {
            Severity: Minor
            Found in src/script/interpreter/uistate.js - About 25 mins 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

            Severity
            Category
            Status
            Source
            Language