QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 184 of 184 total issues

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

            $scope.getTransitionMarkerDetails = function (locationName) {
                var found = $scope.transitionMarkers.filter(function (element, index, array) {
                    return (element.locationName == locationName);
                });
                if (found.length == 1) {
Severity: Major
Found in app/assets/javascripts/angular/controllers/experiments.js and 3 other locations - About 2 hrs to fix
app/assets/javascripts/angular/controllers/experiments.js on lines 1002..1010
app/assets/javascripts/angular/controllers/experiments.js on lines 1026..1034
app/assets/javascripts/angular/controllers/experiments.js on lines 1036..1044

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

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

            $scope.getLocationByOrderIdentifier = function (orderId) {
                var found = $scope.locations.filter(function (element, index, array) {
                    return (element.locationOrderIdentifier == orderId);
                });
                if (found.length == 1) {
Severity: Major
Found in app/assets/javascripts/angular/controllers/experiments.js and 3 other locations - About 2 hrs to fix
app/assets/javascripts/angular/controllers/experiments.js on lines 1002..1010
app/assets/javascripts/angular/controllers/experiments.js on lines 1026..1034
app/assets/javascripts/angular/controllers/experiments.js on lines 1058..1066

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

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

Method modify_ffmpeg has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def self.modify_ffmpeg(source, target, modify_parameters = {})
    # ffmpeg is the catch-all, so it will do anything specified in modify_parameters.

    raise ArgumentError, "Source is a wavpack file, use wavpack to convert to .wav first instead: #{File.basename(source)}" if source.match(/\.wv$/)

Severity: Minor
Found in lib/modules/audio_ffmpeg.rb - 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

Method modify_mp3splt has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def self.modify_mp3splt(source, target, modify_parameters = {})
    raise ArgumentError, "Source is not a mp3 file: #{File.basename(source)}" unless source.match(/\.mp3$/)
    raise ArgumentError, "Target is not a mp3 file: : #{File.basename(target)}" unless target.match(/\.mp3$/)
    raise ArgumentError, "Source does not exist: #{File.basename(source)}" unless File.exists? source
    raise ArgumentError, "Target exists: #{File.basename(target)}" if File.exists? target
Severity: Minor
Found in lib/modules/audio_mp3splt.rb - 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

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

            $scope.getLocation = function (name) {
                var found = $scope.locations.filter(function (element, index, array) {
                    return (element.name == name);
                });
                if (found.length == 1) {
Severity: Major
Found in app/assets/javascripts/angular/controllers/experiments.js and 3 other locations - About 2 hrs to fix
app/assets/javascripts/angular/controllers/experiments.js on lines 1026..1034
app/assets/javascripts/angular/controllers/experiments.js on lines 1036..1044
app/assets/javascripts/angular/controllers/experiments.js on lines 1058..1066

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

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

            $scope.getSpeciesInfo = function (speciesCommonName) {
                var found = $scope.species.filter(function (element, index, array) {
                    return (element.commonName == speciesCommonName);
                });
                if (found.length == 1) {
Severity: Major
Found in app/assets/javascripts/angular/controllers/experiments.js and 3 other locations - About 2 hrs to fix
app/assets/javascripts/angular/controllers/experiments.js on lines 1002..1010
app/assets/javascripts/angular/controllers/experiments.js on lines 1036..1044
app/assets/javascripts/angular/controllers/experiments.js on lines 1058..1066

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

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

    function createBox($parent, contextData, width, height, top, left) {

        if (contextData === undefined) {
            throw "Context data must be given";
        }
Severity: Major
Found in lib/assets/javascripts/jquery.drawabox.js - About 2 hrs to fix

    Function LoginCtrl has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function LoginCtrl($scope, $http, $location, authService, AuthenticationProviders, Authenticator) {
    
        // WARNING: Cookies required for this to work
        function checkLogin() {
            Authenticator.checkLogin();
    Severity: Minor
    Found in app/assets/javascripts/angular/controllers/login.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

    Method open_id_info has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def open_id_info(raw)
    
        open_id_name = raw.info.include?(:name) ? raw.info.name : ''
        open_id_nickname = raw.info.include?(:nickname) ? raw.info.nickname : ''
        open_id_any_name = open_id_nickname.blank? ?
    Severity: Minor
    Found in app/controllers/api/callbacks_controller.rb - 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

    Method create has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create
        success = nil
    
        post_data = request.raw_post
    
    
    Severity: Major
    Found in app/controllers/experiments_controller.rb - About 2 hrs to fix

      Method twitter_info has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def twitter_info(raw)
      
          twitter_name = raw['info'].include?('name') ? raw['info']['name'] : ''
          twitter_nickname = raw['info'].include?('nickname') ? raw['info']['nickname'] : ''
          twitter_any_name = twitter_name.blank? ? (twitter_nickname.blank? ? '' : twitter_nickname) : twitter_name
      Severity: Minor
      Found in app/controllers/api/callbacks_controller.rb - 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

      Method modify has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.modify(source, target, modify_parameters)
          raise ArgumentError, "Source does not exist: #{File.basename(source)}" unless File.exists? source
          raise ArgumentError, "Target exists: #{File.basename(target)}" unless !File.exists? target
          raise ArgumentError "Source and Target are the same file: #{File.basename(target)}" unless source != target
      
      Severity: Minor
      Found in lib/modules/audio.rb - 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

      Method create_or_update_user has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def create_or_update_user(canonical_data, user=nil)
          authorization = nil
      
          #uid = canonical_data[:canonical][:uid] # very likely to be present
          #name = canonical_data[:canonical][:name] # might be present
      Severity: Minor
      Found in app/controllers/api/callbacks_controller.rb - About 1 hr to fix

        Function link has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    link: function (scope, element, attrs) {
                        var $control = element,
                            $player = $control.children('div'),
                            cls = 'pause';
        
        
        Severity: Minor
        Found in app/assets/javascripts/angular/directives/directives.js - About 1 hr to fix

          Method modify_wavpack has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.modify_wavpack(source, target, modify_parameters = {})
              raise ArgumentError, "Source is not a wavpack file: #{File.basename(source)}" unless source.match(/\.wv$/)
              raise ArgumentError, "Target is not a wav file: : #{File.basename(target)}" unless target.match(/\.wav$/)
              raise ArgumentError "Source and Target are the same file: #{File.basename(target)}" unless source != target
          
          Severity: Minor
          Found in lib/modules/audio_wavpack.rb - 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

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

              if (typeof String.prototype.asFormat != "function") {
                  String.prototype.asFormat = function() {
                      var args = Array.prototype.slice.call(arguments);
                      args.unshift(this);
                      return stringformat.apply(null, args);
          Severity: Major
          Found in lib/assets/javascripts/100-String.format.js and 1 other location - About 1 hr to fix
          lib/assets/javascripts/100-String.format.js on lines 223..229

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

          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

                      $newBox.draggable({
                          containment: 'parent',
                          drag: function (event, ui) { contextData.options.boxMoving($newBox); },
                          stop: function (event, ui) { contextData.options.boxMoved($newBox); }
                      });
          Severity: Major
          Found in lib/assets/javascripts/jquery.drawabox.js and 1 other location - About 1 hr to fix
          lib/assets/javascripts/jquery.drawabox.js on lines 170..174

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

          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 (typeof String.prototype.format != "function") {
                  String.prototype.format = function() {
                      var args = Array.prototype.slice.call(arguments);
                      args.unshift(this);
                      return stringformat.apply(null, args);
          Severity: Major
          Found in lib/assets/javascripts/100-String.format.js and 1 other location - About 1 hr to fix
          lib/assets/javascripts/100-String.format.js on lines 230..236

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

          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

                      $newBox.resizable({
                          handles: "all",
                          resize: function (event, ui) { contextData.options.boxResizing($newBox); },
                          stop: function (event, ui) { contextData.options.boxResized($newBox); }
                      });
          Severity: Major
          Found in lib/assets/javascripts/jquery.drawabox.js and 1 other location - About 1 hr to fix
          lib/assets/javascripts/jquery.drawabox.js on lines 175..179

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

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

                      link: function (scope, elem, attrs) {
                          //once Angular is started, remove class:
                          elem.removeClass('waiting-for-angular');
          
                          var login = elem.find('#login-holder');
          Severity: Minor
          Found in app/assets/javascripts/angular/directives/auth.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language