QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 184 of 184 total issues

Method tags_are_strings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def tags_are_strings
    if self.tags.is_a?(Array)
      unless self.tags.blank?
        self.tags.each do |tag|
          unless tag.is_a?(String)
Severity: Minor
Found in app/models/saved_search/saved_search_store_body.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 copy_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def copy_file(source_path,full_move_paths)
      unless source_path.nil? || full_move_paths.size < 1
        success = []
        fail = []
Severity: Minor
Found in lib/external/audio_harvester.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 facebook_info has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def facebook_info(raw)

    facebook_name = raw.info.include?(:name) ? raw.info.name : ''
    facebook_nickname = raw.info.include?(:nickname) ? raw.info.nickname : ''
    facebook_any_name = facebook_name.blank? ? (facebook_nickname.blank? ? '' : facebook_nickname) : facebook_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 params_are_hashes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def params_are_hashes
    self.pre_params = SavedSearchStorePre.new(self.pre_params) if self.pre_params.is_a?(Hash)
    self.body_params = SavedSearchStoreBody.new(self.body_params) if self.body_params.is_a?(Hash)
    self.post_params = SavedSearchStorePost.new(self.post_params) if self.post_params.is_a?(Hash)

Severity: Minor
Found in app/models/saved_search/saved_search_store.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

    $scope.delete = function() {
        var doit = confirm("Are you sure you want to delete this project (id {0})?".format(this.project.id));
        if (doit) {
            projectResource.remove();
        }
Severity: Major
Found in app/assets/javascripts/angular/controllers/projects.js and 1 other location - About 1 hr to fix
app/assets/javascripts/angular/controllers/photos.js on lines 37..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 60.

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.delete = function() {
        var doit = confirm("Are you sure you want to delete this photo (id {0})?".format(this.project.id));
        if (doit) {
            photoResource.remove();
        }
Severity: Major
Found in app/assets/javascripts/angular/controllers/photos.js and 1 other location - About 1 hr to fix
app/assets/javascripts/angular/controllers/projects.js on lines 101..106

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

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 user.blank? &&
        canonical_data[:authorization].include?(:name) && !canonical_data[:authorization][:name].blank? &&
        canonical_data[:authorization].include?(:provider) && !canonical_data[:authorization][:provider].blank?
      authorization = Authorization.where(name: canonical_data[:authorization][:name], provider: canonical_data[:authorization][:provider]).first
      unless authorization.blank?
Severity: Major
Found in app/controllers/api/callbacks_controller.rb and 1 other location - About 1 hr to fix
app/controllers/api/callbacks_controller.rb on lines 353..360

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

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 user.blank? &&
        canonical_data[:authorization].include?(:uid) && !canonical_data[:authorization][:uid].blank? &&
        canonical_data[:authorization].include?(:provider) && !canonical_data[:authorization][:provider].blank?
      authorization = Authorization.where(uid: canonical_data[:authorization][:uid], provider: canonical_data[:authorization][:provider]).first
      unless authorization.blank?
Severity: Major
Found in app/controllers/api/callbacks_controller.rb and 1 other location - About 1 hr to fix
app/controllers/api/callbacks_controller.rb on lines 363..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 55.

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

    var mousemove = function (e) {

        var $thisMouseMove = $(this);
        var dataMouseMove = $thisMouseMove.data('drawboxes');

Severity: Minor
Found in lib/assets/javascripts/jquery.drawabox.js - About 1 hr to fix

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

        $scope.projects = [ {name: "demo", id: 6}, {name: "dddemo", id: 7}, {name: "ddaademo", id: 1}, {name: "desssdmo", id: 12}];
    Severity: Major
    Found in app/assets/javascripts/angular/controllers/search.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/angular/controllers/search.js on lines 18..18

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

    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.endOffsetChunk = function () {
                        if (!$scope.model.media) {
                            return undefined;
                        }
                        return baw.secondsToDurationFormat($scope.model.media.endOffset);
    Severity: Major
    Found in app/assets/javascripts/angular/controllers/listen.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/angular/controllers/listen.js on lines 117..123

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

    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.startOffsetChunk = function () {
                        if (!$scope.model.media) {
                            return undefined;
                        }
    
    
    Severity: Major
    Found in app/assets/javascripts/angular/controllers/listen.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/angular/controllers/listen.js on lines 124..129

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

    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.sites = [ {name: "fffff", id: 425}, {name: "ddddd", id: 587}, {name: "ssss", id: 374}, {name: "aaaaa", id: 175}];
    Severity: Major
    Found in app/assets/javascripts/angular/controllers/search.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/angular/controllers/search.js on lines 15..15

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

    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

                    var dataSet = angular.copy(
                        $scope.bigScope.spec.experimentSteps.filter(function (value) {
                            return value.id === dsId;
                        })[0]
                    );
    Severity: Major
    Found in app/assets/javascripts/angular/controllers/experiments.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/angular/controllers/experiments.js on lines 322..326

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

    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

                    var speed = angular.copy(
                        $scope.bigScope.spec.speeds.filter(function (value) {
                            return value.speed === sId;
                        })[0]
                    );
    Severity: Major
    Found in app/assets/javascripts/angular/controllers/experiments.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/angular/controllers/experiments.js on lines 314..318

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

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

        def initialize(host, port, config_file_name, login_email, login_password, endpoint_create, endpoint_login, endpoint_record_move, base_dir)
    Severity: Major
    Found in lib/external/audio_harvester.rb - About 1 hr to fix

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

        Function Angular has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            baw.angularCopies = new (function Angular() {
                this.fixedEncodeURIComponent = function fixedEncodeURIComponent(str) {
                    str = str || "";
                    return encodeURIComponent(str)
                        .replace(/!/g, '%21')
        Severity: Minor
        Found in lib/assets/javascripts/functions.js - About 1 hr to fix

          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
            Severity
            Category
            Status
            Source
            Language