QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 184 of 184 total issues

Method modify_mp3splt has 41 lines of code (exceeds 25 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 1 hr to fix

    Method generate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.generate(source, target, modify_parameters)
        raise ArgumentError, "Target path for spectrogram generation already exists: #{target}." unless !File.exist?(target)
    
        # sample rate
        sample_rate_param = modify_parameters.include?(:sample_rate) ? modify_parameters[:sample_rate].to_i : 11025
    Severity: Minor
    Found in lib/modules/spectrogram.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

    Function filter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        Array.prototype.filter = function (fun /*, thisp */) {
            "use strict";
    
            if (this == null)
                throw new TypeError();
    Severity: Minor
    Found in lib/assets/javascripts/functions.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

    Method create_raw_query has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create_raw_query
    
        recordings_search = AudioRecording.scoped
    
        if self.invalid?
    Severity: Minor
    Found in app/models/saved_search/saved_search_store.rb - About 1 hr to fix

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

                      scope.$on('event:auth-loginConfirmed', function () {
      
                          var isOpen = isLoginBoxOpen();
                          if(isOpen){
                              console.warn("hiding login window");
      Severity: Major
      Found in app/assets/javascripts/angular/directives/auth.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/angular/directives/auth.js on lines 61..69

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

      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

                      scope.$on('event:auth-loginCancelled', function () {
      
                          var isOpen = isLoginBoxOpen();
                          if(isOpen){
                              console.warn("hiding login window");
      Severity: Major
      Found in app/assets/javascripts/angular/directives/auth.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/angular/directives/auth.js on lines 51..59

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

      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

        def self.recording_within_time(start_time, end_time)
          rel_query = scoped
          if start_time.kind_of?(Time)
            sqlite_calculation = "time(recorded_date, '+' || duration_seconds || ' seconds') >= :start_time"
            formatted_start_time = start_time.utc.strftime('%H:%M:%S')
      Severity: Major
      Found in app/models/audio_recording.rb and 1 other location - About 1 hr to fix
      app/models/audio_recording.rb on lines 107..124

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

      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

        def self.recording_within_date(start_date, end_date)
          rel_query = scoped
          if start_date.kind_of?(Time)
            sqlite_calculation = "datetime(recorded_date, '+' || duration_seconds || ' seconds') >= :start_date"
            formatted_start_date = start_date.utc.strftime('%Y-%m-%d %H:%M:%S')
      Severity: Major
      Found in app/models/audio_recording.rb and 1 other location - About 1 hr to fix
      app/models/audio_recording.rb on lines 127..144

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

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

                      var updatePlayer = function () {
                          $player.jPlayer({
                              // Flash fallback for outdated browser not supporting HTML5 audio/video tags
                              // http://jplayer.org/download/
                              swfPath: 'assets/',
      Severity: Minor
      Found in app/assets/javascripts/angular/directives/directives.js - About 1 hr to fix

        Method modify_sox has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.modify_sox(source, target, modify_parameters = {})
            raise ArgumentError, "Source is not a mp3 or wav file: #{File.basename(source)}" unless source.match(/\.mp3|\.wav$/)
            raise ArgumentError, "Target is not a mp3 or wav file: : #{File.basename(target)}" unless target.match(/\.mp3|\.wav$/)
            raise ArgumentError, "Source does not exist: #{File.basename(source)}" unless File.exists? source
            raise ArgumentError, "Target exists: #{File.basename(target)}" unless !File.exists? target
        Severity: Minor
        Found in lib/modules/audio_sox.rb - About 1 hr to fix

          Function radioInputType has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      link: function radioInputType(scope, element, attr) {
                          // make the name unique, if not defined
                          if (baw.angularCopies.isUndefined(attr.name)) {
                              element.attr('name', Number.Unique());
                          }
          Severity: Minor
          Found in app/assets/javascripts/angular/directives/directives.js - About 1 hr to fix

            Function verifyPreface has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        $scope.verifyPreface = function verifyPreface() {
                            $scope.errors.length = 0;
            
                            if ($scope.results.consented !== true) {
                                $scope.errors.push("You must consent to participate in this experiment.");
            Severity: Minor
            Found in app/assets/javascripts/angular/controllers/experiments.js - About 1 hr to fix

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

                      if (startPos.x > currentPos.x) {
                          $box.css('left', currentPos.x + 'px');
                      } else {
                          $box.css('left', startPos.x + 'px');
                      }
              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 43..47

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

              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 (startPos.y > currentPos.y) {
                          $box.css('top', currentPos.y + 'px');
                      } else {
                          $box.css('top', startPos.y + 'px');
                      }
              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 38..42

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

              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_wavpack has 35 lines of code (exceeds 25 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

                Function getLowestCountItem has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            $scope.getLowestCountItem = function (containingObject) {
                                console.log('called $scope.getLowestCountItem', containingObject);
                                // find minimum
                                var minCount = null;
                                angular.forEach(containingObject, function (value, key) {
                Severity: Minor
                Found in app/assets/javascripts/angular/controllers/experiments.js - About 1 hr to fix

                  Function SiteCtrl has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function SiteCtrl($scope, $resource, $routeParams, Project, Site, AudioRecording, AudioEvent) {
                      var siteResource = Site;
                      var routeArgs = {siteId: $routeParams.siteId};
                  
                      $scope.downloadAnnotationLink = AudioEvent.csvLink({siteId: $routeParams.siteId});
                  Severity: Minor
                  Found in app/assets/javascripts/angular/controllers/sites.js - About 1 hr to fix

                    Function Annotation has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        baw.Annotation = function Annotation(localIdOrResource, audioRecordingId) {
                    
                            var localId = typeof(localIdOrResource) === "number" ? localIdOrResource : undefined;
                            var resource;
                            if (localIdOrResource instanceof Object && localIdOrResource.constructor.name == "Resource") {
                    Severity: Minor
                    Found in app/assets/javascripts/angular/models/annotation.js - About 1 hr to fix

                      Function PhotoCtrl has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function PhotoCtrl($scope, $resource, $routeParams, Photo) {
                      
                          var photoResource = Photo;
                          var routeArgs = {photoId: $routeParams.photoId};
                      
                      Severity: Minor
                      Found in app/assets/javascripts/angular/controllers/photos.js - About 1 hr to fix

                        Function calculateFlashes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    function calculateFlashes() {
                        
                                        // work out the scale of flash cards that need to be shown
                                        var adjustedPPS = PPS * $scope.stepResults.compression,
                                            segmentDuration = $scope.SPECTROGRAM_WIDTH / adjustedPPS;
                        Severity: Minor
                        Found in app/assets/javascripts/angular/controllers/experiments.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language