Okazari/Rythm.js

View on GitHub

Showing 37 of 37 total issues

Function onload has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.onload = function() {
  if (fetch) {
    fetch('https://api.github.com/repos/okazari/rythm.js/stats/contributors')
      .then(d => d.json())
      .then(data => {
Severity: Major
Found in demo/example.js - About 5 hrs to fix

    Function Player has 98 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var Player = function Player(forceAudioContext) {
        var _this = this
    
        classCallCheck(this, Player)
    
    
    Severity: Major
    Found in rythm.js - About 3 hrs to fix

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

      export default (elem, value, options = {}) => {
        const max = !isNaN(options.max) ? options.max : 5
        const min = !isNaN(options.min) ? options.min : 0
        const borderWidth = (max - min) * value + min
        elem.style.borderWidth = `${borderWidth}px`
      Severity: Major
      Found in src/dances/border-width.js and 1 other location - About 3 hrs to fix
      src/dances/font-size.js on lines 1..6

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

      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

      export default (elem, value, options = {}) => {
        const max = !isNaN(options.max) ? options.max : 0.8
        const min = !isNaN(options.min) ? options.min : 1.2
        const fontSize = (max - min) * value + min
        elem.style.fontSize = `${fontSize}em`
      Severity: Major
      Found in src/dances/font-size.js and 1 other location - About 3 hrs to fix
      src/dances/border-width.js on lines 1..6

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

      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 Rythm has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var Rythm$1 = function Rythm(forceAudioContext) {
          var _this = this
      
          classCallCheck(this, Rythm)
      
      
      Severity: Major
      Found in rythm.js - About 3 hrs to fix

        Function Dancer has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var Dancer = (function() {
            function Dancer() {
              classCallCheck(this, Dancer)
        
              this.resets = {}
        Severity: Major
        Found in rythm.js - About 2 hrs to fix

          Function onload has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          window.onload = function() {
            if (fetch) {
              fetch('https://api.github.com/repos/okazari/rythm.js/stats/contributors')
                .then(d => d.json())
                .then(data => {
          Severity: Minor
          Found in demo/example.js - About 2 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 Analyser has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var Analyser = function Analyser() {
              var _this = this
          
              classCallCheck(this, Analyser)
          
          
          Severity: Minor
          Found in rythm.js - About 1 hr to fix

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

                if (typeof type === 'string') {
                  //In case of a built in dance
                  dance = this.dances[type] || this.dances['pulse']
                } else {
                  //In case of a custom dance
            Severity: Major
            Found in src/Dancer.js and 3 other locations - About 1 hr to fix
            src/Dancer.js on lines 65..71
            rythm.js on lines 559..565
            rythm.js on lines 576..582

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

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

                      if (typeof type === 'string') {
                        //In case of a built in dance
                        reset$$1 = this.resets[type] || this.resets['pulse']
                      } else {
                        //In case of a custom dance
            Severity: Major
            Found in rythm.js and 3 other locations - About 1 hr to fix
            src/Dancer.js on lines 52..58
            src/Dancer.js on lines 65..71
            rythm.js on lines 559..565

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

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

                if (typeof type === 'string') {
                  //In case of a built in dance
                  reset = this.resets[type] || this.resets['pulse']
                } else {
                  //In case of a custom dance
            Severity: Major
            Found in src/Dancer.js and 3 other locations - About 1 hr to fix
            src/Dancer.js on lines 52..58
            rythm.js on lines 559..565
            rythm.js on lines 576..582

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

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

                      if (typeof type === 'string') {
                        //In case of a built in dance
                        dance = this.dances[type] || this.dances['pulse']
                      } else {
                        //In case of a custom dance
            Severity: Major
            Found in rythm.js and 3 other locations - About 1 hr to fix
            src/Dancer.js on lines 52..58
            src/Dancer.js on lines 65..71
            rythm.js on lines 576..582

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

            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.reverse) {
                elem.style.opacity = max - vanish
              } else {
                elem.style.opacity = min + vanish
              }
            Severity: Minor
            Found in src/dances/vanish.js and 1 other location - About 55 mins to fix
            rythm.js on lines 278..282

            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

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

                if (options.reverse) {
                  elem.style.opacity = max - vanish
                } else {
                  elem.style.opacity = min + vanish
                }
            Severity: Minor
            Found in rythm.js and 1 other location - About 55 mins to fix
            src/dances/vanish.js on lines 5..9

            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

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

                this.addRythm = function(elementClass, type, startValue, nbValue, options) {
            Severity: Minor
            Found in rythm.js - About 35 mins to fix

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

                      var type = mappingItem.type,
                        elementClass = mappingItem.elementClass,
                        nbValue = mappingItem.nbValue,
                        startValue = mappingItem.startValue,
                        options = mappingItem.options
              Severity: Minor
              Found in rythm.js and 1 other location - About 35 mins to fix
              rythm.js on lines 659..663

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

              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

                      var type = mappingItem.type,
                        elementClass = mappingItem.elementClass,
                        nbValue = mappingItem.nbValue,
                        startValue = mappingItem.startValue,
                        options = mappingItem.options
              Severity: Minor
              Found in rythm.js and 1 other location - About 35 mins to fix
              rythm.js on lines 641..645

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

              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

              Severity
              Category
              Status
              Source
              Language