QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 93 of 184 total issues

Method get_parameter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_parameter(parameter, modify_parameters, include_separator = true, format = :string)
    # need to cater for the situation where modify_parameters contains strings (we want symbols)
    modify_parameters.keys.each do |key|
      modify_parameters[(key.to_sym rescue key) || key] = modify_parameters.delete(key)
    end
Severity: Minor
Found in lib/modules/cache.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 open_id_info has 27 lines of code (exceeds 25 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 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 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 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 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

          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

          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

            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 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 generate_spectrogram has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.generate_spectrogram(modify_parameters = {})
                
                    # first check if a cached spectrogram matches the request
                
                    target_file = Cache::cached_spectrogram_file modify_parameters
                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

                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

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

                    function createBox($parent, contextData, width, height, top, left) {
                Severity: Minor
                Found in lib/assets/javascripts/jquery.drawabox.js - About 45 mins to fix

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

                              $scope.ensureMapDisplayedCorrectly = 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

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

                          methods.setBox = function setBox(id, top, left, height, width, selected) {
                      Severity: Minor
                      Found in lib/assets/javascripts/jquery.drawabox.js - 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

                        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 create_new_audiorecording has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def create_new_audiorecording(post_params)
                                Net::HTTP.start(@host, @port) do |http|
                          
                                  auth_token = request_login(http)
                          
                          Severity: Minor
                          Found in lib/external/audio_harvester.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 whenDefaults has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              function whenDefaults(resourceName, singularResourceName, id, controllerMany, controllerOne) {
                          Severity: Minor
                          Found in app/assets/javascripts/app.js - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language