QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 93 of 184 total issues

Method bird_tour_annotation_counts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def bird_tour_annotation_counts(steps)
    # open file
    filename                                   = File.join(EXPERIMENTS_ASSETS_DIRECTORY, ANNOTATION_RESPONSE_COUNTS)
    file_contents                              = File.open(filename, 'r') { |file| file.read }

Severity: Minor
Found in app/controllers/experiments_controller.rb - About 35 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 record_file_move has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def record_file_move(create_result_params)
      Net::HTTP.start(@host, @port) do |http|

        auth_token = request_login(http)
Severity: Minor
Found in lib/external/audio_harvester.rb - About 35 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 build_parameters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.build_parameters(parameter_names = [], modify_parameters = {})

    file_name = ''
    
    parameter_names.each do |param| 
Severity: Minor
Found in lib/modules/cache.rb - About 35 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 too many return statements within this function.
Open

        if (proto && typeof proto.toString == 'function') return proto.toString;
Severity: Major
Found in lib/assets/javascripts/100-String.format.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return stringFromAny(params[num], format); //convert the input replacement to a proper string
    Severity: Major
    Found in lib/assets/javascripts/100-String.format.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return String.prototype.toString;
      Severity: Major
      Found in lib/assets/javascripts/100-String.format.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return ""; //no formatter, use empty string, this should *NEVER* happen.
        Severity: Major
        Found in lib/assets/javascripts/100-String.format.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return String(source);
          Severity: Major
          Found in lib/assets/javascripts/100-String.format.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return formatter.call(obj,format);
            Severity: Major
            Found in lib/assets/javascripts/100-String.format.js - About 30 mins to fix

              Method check_invalid_combinations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def check_invalid_combinations
                  # any logged in user can be an owner? No
                  if self.logged_in && self.owner? && self.user.blank?
                    errors.add(:user_id, "Owner permissions must be specified with a user id.")
                  end
              Severity: Minor
              Found in app/models/permission.rb - 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

              Method check_file_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.check_file_hash(file_path, audio_recording)
                  # ensure this audio recording needs to be checked
                  return if audio_recording.status != :to_check
              
                  # type of hash is at start of hash_to_compare, split using two colons
              Severity: Minor
              Found in lib/modules/file_cacher.rb - 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

              Function PhotoCtrl has a Cognitive Complexity of 6 (exceeds 5 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 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

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

                  Array.prototype.indexOf = function (what, i) {
                      i = i || 0;
                      var L = this.length;
                      while (i < L) {
                          if (this[i] === what) return i;
              Severity: Minor
              Found in lib/assets/javascripts/functions.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

              Severity
              Category
              Status
              Source
              Language