publiclab/spectral-workbench

View on GitHub
app/assets/javascripts/capture.js

Summary

Maintainability
F
1 wk
Test Coverage

File capture.js has 625 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//= require graph.js
// window.webcam.getCameraList()
$W = {
  data: null,
  baseline: null,
Severity: Major
Found in app/assets/javascripts/capture.js - About 1 day to fix

    Function getRow has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
    Open

      getRow: function(y) {
        $W.frame += 1
        if ($W.options.context === 'webrtc') {
          var video = $('video')[0];
          // Grab the existing canvas:
    Severity: Minor
    Found in app/assets/javascripts/capture.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 getRow has 113 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getRow: function(y) {
        $W.frame += 1
        if ($W.options.context === 'webrtc') {
          var video = $('video')[0];
          // Grab the existing canvas:
    Severity: Major
    Found in app/assets/javascripts/capture.js - About 4 hrs to fix

      `` has 31 functions (exceeds 20 allowed). Consider refactoring.
      Open

      $W = {
        data: null,
        baseline: null,
        full_data: [],
        unflipped_data: [],
      Severity: Minor
      Found in app/assets/javascripts/capture.js - About 3 hrs to fix

        Function initialize has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          initialize: function(args) {
            this.mobile = args['mobile'] || false
            this.flipped = args['flipped'] == true || false
            this.interface = args['interface'] || false
            this.mode = args['mode'] || 'combined'
        Severity: Minor
        Found in app/assets/javascripts/capture.js - About 1 hr to fix

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

            auto_detect_sample_row: function() {
                  
              // We need a separate canvas to draw the snapshot, whenever we try to auto detect the sample row.
              if ($('#autoDetectCanvas').length == 0) {
                $('body').append("<canvas style='display:none;' id='autoDetectCanvas'></canvas>")
          Severity: Minor
          Found in app/assets/javascripts/capture.js - About 1 hr to fix

            Function toggle_rotation has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              toggle_rotation: function() {
                $W.rotated = !$W.rotated
                if ($W.rotated == true) $('.btn-rotate').addClass('active');
                else                    $('.btn-rotate').removeClass('active');
                var style = $('#heightIndicator')[0].style
            Severity: Minor
            Found in app/assets/javascripts/capture.js - About 1 hr to fix

              Function setSampleRowClickListener has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                setSampleRowClickListener: function() {
                  $('#webcam').click(function(e){
                    var offX, offY;
                    if (!(e.offsetX || e.offsetY)) {
                      offX = e.pageX - $(e.target).offset().left;
              Severity: Minor
              Found in app/assets/javascripts/capture.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 getCrossSection has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                getCrossSection: function(video) {
                  // draw the new data on the top row of pixels of the canvas, overwriting what's there now
                  if ($W.mobile) {
                    // this is only for the deprecated mobile version
                    $W.ctx.scale(3,1)
              Severity: Minor
              Found in app/assets/javascripts/capture.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 resetHeightIndicators has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                resetHeightIndicators: function(legacy) {
                  if ($W.rotated) {
                    if (legacy != true) $('#heightIndicator')[0].style.marginLeft = parseInt($W.width_percent*320)+'px';
                    if (legacy != true) $('#heightIndicatorPrev')[0].style.marginLeft = parseInt($W.width_percent*$('#preview').width())+'px';
                  } else {
              Severity: Minor
              Found in app/assets/javascripts/capture.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 auto_detect_sample_row has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                auto_detect_sample_row: function() {
                      
                  // We need a separate canvas to draw the snapshot, whenever we try to auto detect the sample row.
                  if ($('#autoDetectCanvas').length == 0) {
                    $('body').append("<canvas style='display:none;' id='autoDetectCanvas'></canvas>")
              Severity: Minor
              Found in app/assets/javascripts/capture.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

              Avoid deeply nested control flow statements.
              Open

                        if (green == 255) $W.data[4].data.push([w,100])
              Severity: Major
              Found in app/assets/javascripts/capture.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          if ($W.baseline != null) {
                            var wavelength = parseInt($W.getWavelength(col))
                            $W.data[0].data.push([wavelength,$W.baseline[wavelength]-intensity/2.55])
                          } else $W.data[0].data.push([parseInt($W.getWavelength(col)),intensity/2.55])
                Severity: Major
                Found in app/assets/javascripts/capture.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            if (blue == 255) $W.data[4].data.push([w,100])
                  Severity: Major
                  Found in app/assets/javascripts/capture.js - About 45 mins to fix

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

                      alert_overexposure: function() {
                        console.log('Checking for overexposure');
                        var oe = $W.detect_overexposure()
                        if (oe.r || oe.g || oe.b) {
                          var msg = "<b>Light source too strong</b>; clipping in channels: "
                    Severity: Minor
                    Found in app/assets/javascripts/capture.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

                    Avoid deeply nested control flow statements.
                    Open

                              if (red == 255) $W.data[4].data.push([w,100])
                    Severity: Major
                    Found in app/assets/javascripts/capture.js - About 45 mins to fix

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

                        initialize: function(args) {
                          this.mobile = args['mobile'] || false
                          this.flipped = args['flipped'] == true || false
                          this.interface = args['interface'] || false
                          this.mode = args['mode'] || 'combined'
                      Severity: Minor
                      Found in app/assets/javascripts/capture.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

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

                        excerptCanvas: function(x1,y1,x2,y2,source) {
                      Severity: Minor
                      Found in app/assets/javascripts/capture.js - About 35 mins to fix

                        Function success has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          success: function (stream) {
                            //console.log('success')
                            if ($W.options.context === 'webrtc') {
                              $('#heightIndicator').show()
                              $('#webcam-msg').hide()
                        Severity: Minor
                        Found in app/assets/javascripts/capture.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

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

                          notify: function(msg,type,expire) {
                            if (expire == null) expire = true
                            var id = parseInt(Math.random()*100000)
                            $('#notify').html($('#notify').html()+"<div id='notify_"+id+"' class='notify'></div>")
                            if (type == "warning") $('#notify_'+id).html("<b>Warning:</b> "+msg).addClass('warning')
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 1 day to fix
                        app/assets/javascripts/analyze.js on lines 190..201

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

                        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

                            if ($W.rotated) {
                              style.marginTop = '0px';
                              style.borderBottomWidth = "0px"
                              style.borderRightWidth = "2px"
                              style.height = "240px"
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 6 hrs to fix
                        app/assets/javascripts/capture.js on lines 589..604

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

                        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 {
                              style.marginLeft = '0px';
                              style.borderBottomWidth = "2px"
                              style.borderRightWidth = "0px"
                              style.width = "320px"
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 6 hrs to fix
                        app/assets/javascripts/capture.js on lines 574..589

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

                        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 ($W.baseline != null) {
                                    var wavelength = parseInt($W.getWavelength(col))
                                    $W.data[0].data.push([wavelength,$W.baseline[wavelength]-intensity/2.55])
                                  } else $W.data[0].data.push([parseInt($W.getWavelength(col)),intensity/2.55])
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 4 hrs to fix
                        app/assets/javascripts/capture.js on lines 311..314

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

                        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 ($W.baseline != null) {
                                    var wavelength = parseInt($W.getWavelength(col))
                                    $W.data[0].data.push([wavelength,$W.baseline[wavelength]-intensity/2.55])
                                  } else $W.data[0].data.push([parseInt($W.getWavelength(col)),intensity/2.55])
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 4 hrs to fix
                        app/assets/javascripts/capture.js on lines 301..304

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

                        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

                              if (!(e.offsetX || e.offsetY)) {
                                offX = e.pageX - $(e.target).offset().left;
                                offY = e.pageY - $(e.target).offset().top;
                              } else {
                                offX = e.offsetX;
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 4 hrs to fix
                        app/assets/javascripts/analyze.js on lines 305..311

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

                        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

                            if ($W.rotated) {
                              if (legacy != true) $('#heightIndicator')[0].style.marginLeft = parseInt($W.width_percent*320)+'px';
                              if (legacy != true) $('#heightIndicatorPrev')[0].style.marginLeft = parseInt($W.width_percent*$('#preview').width())+'px';
                            } else {
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 3 hrs to fix
                        app/assets/javascripts/capture.js on lines 488..491

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

                        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 (legacy != true) $('#heightIndicator')[0].style.marginTop = parseInt($W.height_percent*240)+'px';
                              if (legacy != true) $('#heightIndicatorPrev')[0].style.marginTop = parseInt($W.height_percent*$('#preview').height())+'px';
                            }
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 3 hrs to fix
                        app/assets/javascripts/capture.js on lines 485..488

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

                        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 (loc.coords) {
                              $('#lat').val(loc.coords.latitude)
                              $('#lon').val(loc.coords.longitude)
                            }
                            else {
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 3 hrs to fix
                        app/assets/javascripts/upload.js on lines 17..27

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

                        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 {
                              style.webkitTransform = "scaleX(1)"
                              style.mozTransform = "scaleX(1)"
                              style.oTransform = "scaleX(1)"
                              style.transform = "scaleX(1)"
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/capture.js on lines 551..558

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

                        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

                            if ($W.flipped) {
                              style.webkitTransform = "scaleX(-1)"
                              style.mozTransform = "scaleX(-1)"
                              style.oTransform = "scaleX(-1)"
                              style.transform = "scaleX(-1)"
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/capture.js on lines 558..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 69.

                        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

                              for (row=0;row<$W.sample_height;row++) {
                                 green += img.data[((row*(img.width*4)) + (col*4)) + 1]
                              }
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 2 other locations - About 1 hr to fix
                        app/assets/javascripts/capture.js on lines 267..269
                        app/assets/javascripts/capture.js on lines 277..279

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

                        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

                              for (row=0;row<$W.sample_height;row++) {
                                 red += img.data[((row*(img.width*4)) + (col*4)) + 0]
                              }
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 2 other locations - About 1 hr to fix
                        app/assets/javascripts/capture.js on lines 272..274
                        app/assets/javascripts/capture.js on lines 277..279

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

                        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

                              for (row=0;row<$W.sample_height;row++) {
                                 blue += img.data[((row*(img.width*4)) + (col*4)) + 2]
                              }
                        Severity: Major
                        Found in app/assets/javascripts/capture.js and 2 other locations - About 1 hr to fix
                        app/assets/javascripts/capture.js on lines 267..269
                        app/assets/javascripts/capture.js on lines 272..274

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

                        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

                            $('.btn-switch-calibration-configure').click(function() {
                              window.location = "/capture?calibration_id=" + $('.select-calibration-configure').val()
                            });
                        Severity: Minor
                        Found in app/assets/javascripts/capture.js and 1 other location - About 30 mins to fix
                        app/assets/javascripts/capture.js on lines 69..71

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

                        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

                            $('.btn-switch-calibration-capture').click(function() {
                              window.location = "/capture?calibration_id=" + $('.select-calibration-capture').val()
                            });
                        Severity: Minor
                        Found in app/assets/javascripts/capture.js and 1 other location - About 30 mins to fix
                        app/assets/javascripts/capture.js on lines 65..67

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

                        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