QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 184 of 184 total issues

Function popUpWindow has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    baw.popUpWindow = function popUpWindow(provider_url, width, height, callback) {
        var screenX = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,
            screenY = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,
            outerWidth = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.body.clientWidth,
            outerHeight = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.body.clientHeight - 22),
Severity: Minor
Found in lib/assets/javascripts/functions.js - About 1 hr to fix

    Function secondsToDurationFormat has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        baw.secondsToDurationFormat = function secondsToDurationFormat(seconds) {
            if (typeof seconds != 'number') {
                seconds = parseFloat(seconds);
            }
    
    
    Severity: Minor
    Found in lib/assets/javascripts/functions.js - About 1 hr to fix

      Function ProjectCtrl has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function ProjectCtrl($scope, $location, $resource, $routeParams, Project, Site, Photo, AudioEvent) {
      Severity: Major
      Found in app/assets/javascripts/angular/controllers/projects.js - About 1 hr to fix

        Method browser_id has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def browser_id
            # https://developer.mozilla.org/en-US/docs/Persona/Remote_Verification_API
            # this callback will have an assertion included. The assertion should be POST'ed with the
            # audience to the remote verification API
        
        Severity: Minor
        Found in app/controllers/api/callbacks_controller.rb - About 55 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

        Method qualified_const_get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def qualified_const_get(str)
            path = str.to_s.split('::')
            from_root = path[0].empty?
            if from_root
              from_root = []
        Severity: Minor
        Found in lib/modules/qualified_const_get.rb - About 55 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

            respond_to do |format|
              format.json { render :json => window_data.as_json, :status => :unauthorized }
              format.js { render :json => window_data.as_json, :status => :unauthorized }
              format.xml { render :xml => window_data.to_xml, :status => :unauthorized }
              format.any { render :text => window_content(displayed_data, window_data), :status => :unauthorized }
        Severity: Minor
        Found in app/controllers/api/callbacks_controller.rb and 1 other location - About 55 mins to fix
        app/controllers/api/callbacks_controller.rb on lines 69..73

        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

            respond_to do |format|
              format.json { render :json => content.as_json, :status => :ok }
              format.js { render :json => content.as_json, :status => :ok }
              format.xml { render :xml => content.to_xml, :status => :ok }
              format.any { render :text => window_content(displayed_data, content), :status => :ok }
        Severity: Minor
        Found in app/controllers/api/callbacks_controller.rb and 1 other location - About 55 mins to fix
        app/controllers/api/callbacks_controller.rb on lines 46..50

        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

        Function SiteCtrl has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function SiteCtrl($scope, $resource, $routeParams, Project, Site, AudioRecording, AudioEvent) {
        Severity: Major
        Found in app/assets/javascripts/angular/controllers/sites.js - About 50 mins to fix

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

                              "boxResized": function (element, box) {
                                  console.log("boxResized");
                                  resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
                              },
          Severity: Major
          Found in app/assets/javascripts/angular/directives/directives.js and 3 other locations - About 50 mins to fix
          app/assets/javascripts/angular/directives/directives.js on lines 358..362
          app/assets/javascripts/angular/directives/directives.js on lines 367..370
          app/assets/javascripts/angular/directives/directives.js on lines 371..374

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

          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

                              "boxMoving": function (element, box) {
                                  console.log("boxMoving");
                                  resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
                              },
          Severity: Major
          Found in app/assets/javascripts/angular/directives/directives.js and 3 other locations - About 50 mins to fix
          app/assets/javascripts/angular/directives/directives.js on lines 358..362
          app/assets/javascripts/angular/directives/directives.js on lines 363..366
          app/assets/javascripts/angular/directives/directives.js on lines 371..374

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

          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

                              "boxMoved": function (element, box) {
                                  console.log("boxMoved");
                                  resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
                              },
          Severity: Major
          Found in app/assets/javascripts/angular/directives/directives.js and 3 other locations - About 50 mins to fix
          app/assets/javascripts/angular/directives/directives.js on lines 358..362
          app/assets/javascripts/angular/directives/directives.js on lines 363..366
          app/assets/javascripts/angular/directives/directives.js on lines 367..370

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

          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

                              "boxResizing": function (element, box) {
                                  console.log("boxResizing");
                                  resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
          
                              },
          Severity: Major
          Found in app/assets/javascripts/angular/directives/directives.js and 3 other locations - About 50 mins to fix
          app/assets/javascripts/angular/directives/directives.js on lines 363..366
          app/assets/javascripts/angular/directives/directives.js on lines 367..370
          app/assets/javascripts/angular/directives/directives.js on lines 371..374

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

          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 self.body_params.time_start && self.body_params.time_end
                  recordings_search = recordings_search.recording_within_time(self.body_params.time_start, self.body_params.time_end)
                elsif self.body_params.time_start
                  recordings_search = recordings_search.recording_within_time(self.body_params.time_start, self.body_params.time_start)
                elsif self.body_params.time_end
          Severity: Minor
          Found in app/models/saved_search/saved_search_store.rb and 1 other location - About 50 mins to fix
          app/models/saved_search/saved_search_store.rb on lines 63..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 43.

          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  self.body_params.date_start && self.body_params.date_end
                  recordings_search = recordings_search.recording_within_date(self.body_params.date_start, self.body_params.date_end)
                elsif self.body_params.date_start
                  recordings_search = recordings_search.recording_within_date(self.body_params.date_start, self.body_params.date_start)
                elsif self.body_params.date_end
          Severity: Minor
          Found in app/models/saved_search/saved_search_store.rb and 1 other location - About 50 mins to fix
          app/models/saved_search/saved_search_store.rb on lines 71..77

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

          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 ensureMapDisplayedCorrectlyNoTimeout has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                      $scope.ensureMapDisplayedCorrectlyNoTimeout = function (map, latLng, zoom, marker, markerContent, markerTitle) {
          Severity: Minor
          Found in app/assets/javascripts/angular/controllers/experiments.js - About 45 mins to fix

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

                            infoWindow.open = function open(a1, a2, a3, a4, a5, a6) {
            Severity: Minor
            Found in app/assets/javascripts/angular/directives/directives.js - About 45 mins to fix

              Method run_once has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def run_once(script_name, script_version, script_content, script_file, script_settings, audio_full_paths)
              Severity: Minor
              Found in lib/external/analysis_runner.rb - About 45 mins to fix

                Method download has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def download
                
                    project_id = nil
                    if params[:project_id]
                      project_id = Integer(params[:project_id].to_s, 10)
                Severity: Minor
                Found in app/controllers/audio_events_controller.rb - 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 LoginCtrl has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function LoginCtrl($scope, $http, $location, authService, AuthenticationProviders, Authenticator) {
                Severity: Minor
                Found in app/assets/javascripts/angular/controllers/login.js - About 45 mins to fix

                  Method create_audio_segment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.create_audio_segment(modify_parameters = {})
                      # first check if a cached audio file matches the request
                      target_file = Cache::cached_audio_file modify_parameters
                      target_existing_paths = Cache::existing_paths(Cache::cached_audio_storage_paths,target_file)
                  
                  Severity: Minor
                  Found in lib/modules/file_cacher.rb - 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

                  Severity
                  Category
                  Status
                  Source
                  Language