QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 184 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

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

  def create
    @audio_recording = AudioRecording.new(params[:audio_recording])

    respond_to do |format|
      if @audio_recording.save
Severity: Major
Found in app/controllers/audio_recordings_controller.rb and 13 other locations - About 35 mins to fix
app/controllers/analysis_items_controller.rb on lines 39..46
app/controllers/analysis_jobs_controller.rb on lines 39..46
app/controllers/analysis_scripts_controller.rb on lines 39..46
app/controllers/audio_events_controller.rb on lines 39..46
app/controllers/bookmarks_controller.rb on lines 39..46
app/controllers/permissions_controller.rb on lines 39..46
app/controllers/photos_controller.rb on lines 42..49
app/controllers/progresses_controller.rb on lines 39..46
app/controllers/projects_controller.rb on lines 36..43
app/controllers/saved_searches_controller.rb on lines 39..46
app/controllers/sites_controller.rb on lines 39..46
app/controllers/tags_controller.rb on lines 34..41
app/controllers/users_controller.rb on lines 39..46

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

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 14 locations. Consider refactoring.
Open

  def create
    @analysis_job = AnalysisJob.new(params[:analysis_job])

    respond_to do |format|
      if @analysis_job.save
Severity: Major
Found in app/controllers/analysis_jobs_controller.rb and 13 other locations - About 35 mins to fix
app/controllers/analysis_items_controller.rb on lines 39..46
app/controllers/analysis_scripts_controller.rb on lines 39..46
app/controllers/audio_events_controller.rb on lines 39..46
app/controllers/audio_recordings_controller.rb on lines 50..57
app/controllers/bookmarks_controller.rb on lines 39..46
app/controllers/permissions_controller.rb on lines 39..46
app/controllers/photos_controller.rb on lines 42..49
app/controllers/progresses_controller.rb on lines 39..46
app/controllers/projects_controller.rb on lines 36..43
app/controllers/saved_searches_controller.rb on lines 39..46
app/controllers/sites_controller.rb on lines 39..46
app/controllers/tags_controller.rb on lines 34..41
app/controllers/users_controller.rb on lines 39..46

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

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 14 locations. Consider refactoring.
Open

  def create
    @permission = Permission.new(params[:permission])

    respond_to do |format|
      if @permission.save
Severity: Major
Found in app/controllers/permissions_controller.rb and 13 other locations - About 35 mins to fix
app/controllers/analysis_items_controller.rb on lines 39..46
app/controllers/analysis_jobs_controller.rb on lines 39..46
app/controllers/analysis_scripts_controller.rb on lines 39..46
app/controllers/audio_events_controller.rb on lines 39..46
app/controllers/audio_recordings_controller.rb on lines 50..57
app/controllers/bookmarks_controller.rb on lines 39..46
app/controllers/photos_controller.rb on lines 42..49
app/controllers/progresses_controller.rb on lines 39..46
app/controllers/projects_controller.rb on lines 36..43
app/controllers/saved_searches_controller.rb on lines 39..46
app/controllers/sites_controller.rb on lines 39..46
app/controllers/tags_controller.rb on lines 34..41
app/controllers/users_controller.rb on lines 39..46

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

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 14 locations. Consider refactoring.
Open

  def create
    @user = User.new(params[:user])

    respond_to do |format|
      if @user.save
Severity: Major
Found in app/controllers/users_controller.rb and 13 other locations - About 35 mins to fix
app/controllers/analysis_items_controller.rb on lines 39..46
app/controllers/analysis_jobs_controller.rb on lines 39..46
app/controllers/analysis_scripts_controller.rb on lines 39..46
app/controllers/audio_events_controller.rb on lines 39..46
app/controllers/audio_recordings_controller.rb on lines 50..57
app/controllers/bookmarks_controller.rb on lines 39..46
app/controllers/permissions_controller.rb on lines 39..46
app/controllers/photos_controller.rb on lines 42..49
app/controllers/progresses_controller.rb on lines 39..46
app/controllers/projects_controller.rb on lines 36..43
app/controllers/saved_searches_controller.rb on lines 39..46
app/controllers/sites_controller.rb on lines 39..46
app/controllers/tags_controller.rb on lines 34..41

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

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 ($scope.results.email
                    && $scope.results.email.length > 0
                    && $scope.detailsForm.email.$valid
                    ) {

Severity: Minor
Found in app/assets/javascripts/angular/controllers/experiments.js and 1 other location - About 35 mins to fix
app/assets/javascripts/angular/controllers/experiments.js on lines 135..143

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

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

            return encodeURIComponent(val).
                replace(/%40/gi, '@').
                replace(/%3A/gi, ':').
                replace(/%24/g, '$').
                replace(/%2C/gi, ',').
Severity: Minor
Found in lib/assets/javascripts/functions.js and 1 other location - About 35 mins to fix
lib/assets/javascripts/functions.js on lines 279..284

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

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

            return encodeURIComponent(str)
                .replace(/!/g, '%21')
                .replace(/'/g, '%27')
                .replace(/\(/g, '%28')
                .replace(/\)/g, '%29')
Severity: Minor
Found in lib/assets/javascripts/functions.js and 1 other location - About 35 mins to fix
lib/assets/javascripts/functions.js on lines 296..301

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

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 ($scope.results.name
                    && $scope.results.name.length > 0
                    && $scope.detailsForm.fullName.$valid
                    ) {

Severity: Minor
Found in app/assets/javascripts/angular/controllers/experiments.js and 1 other location - About 35 mins to fix
app/assets/javascripts/angular/controllers/experiments.js on lines 145..153

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

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

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

            angular.forEach($scope.bigScope.spec.additionalResources.experimentCombinationCounts, function (value, key) {
                var c = value.count;
                if (minCount === null || c < minCount) {
                    minCount = c;
                }
Severity: Minor
Found in app/assets/javascripts/angular/controllers/experiments.js and 1 other location - About 30 mins to fix
app/assets/javascripts/angular/controllers/experiments.js on lines 839..844

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

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 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 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 ""; //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 formatter.call(obj,format);
          Severity: Major
          Found in lib/assets/javascripts/100-String.format.js - About 30 mins to fix

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

                            angular.forEach(containingObject, function (value, key) {
                                var c = value.count;
                                if (minCount === null || c < minCount) {
                                    minCount = c;
                                }
            Severity: Minor
            Found in app/assets/javascripts/angular/controllers/experiments.js and 1 other location - About 30 mins to fix
            app/assets/javascripts/angular/controllers/experiments.js on lines 264..269

            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

            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

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

                def update
                  @analysis_job = AnalysisJob.find(params[:id])
              
                  respond_to do |format|
                    if @analysis_job.update_attributes(params[:analysis_job])
              Severity: Major
              Found in app/controllers/analysis_jobs_controller.rb and 13 other locations - About 30 mins to fix
              app/controllers/analysis_items_controller.rb on lines 53..60
              app/controllers/analysis_scripts_controller.rb on lines 53..60
              app/controllers/audio_events_controller.rb on lines 53..60
              app/controllers/audio_recordings_controller.rb on lines 64..71
              app/controllers/bookmarks_controller.rb on lines 53..60
              app/controllers/permissions_controller.rb on lines 53..60
              app/controllers/photos_controller.rb on lines 56..63
              app/controllers/progresses_controller.rb on lines 53..60
              app/controllers/projects_controller.rb on lines 53..60
              app/controllers/saved_searches_controller.rb on lines 53..60
              app/controllers/sites_controller.rb on lines 53..60
              app/controllers/tags_controller.rb on lines 48..55
              app/controllers/users_controller.rb on lines 53..60

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

              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 14 locations. Consider refactoring.
              Open

                def update
                  @progress = Progress.find(params[:id])
              
                  respond_to do |format|
                    if @progress.update_attributes(params[:progress])
              Severity: Major
              Found in app/controllers/progresses_controller.rb and 13 other locations - About 30 mins to fix
              app/controllers/analysis_items_controller.rb on lines 53..60
              app/controllers/analysis_jobs_controller.rb on lines 53..60
              app/controllers/analysis_scripts_controller.rb on lines 53..60
              app/controllers/audio_events_controller.rb on lines 53..60
              app/controllers/audio_recordings_controller.rb on lines 64..71
              app/controllers/bookmarks_controller.rb on lines 53..60
              app/controllers/permissions_controller.rb on lines 53..60
              app/controllers/photos_controller.rb on lines 56..63
              app/controllers/projects_controller.rb on lines 53..60
              app/controllers/saved_searches_controller.rb on lines 53..60
              app/controllers/sites_controller.rb on lines 53..60
              app/controllers/tags_controller.rb on lines 48..55
              app/controllers/users_controller.rb on lines 53..60

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

              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 14 locations. Consider refactoring.
              Open

                def update
                  @analysis_item = AnalysisItem.find(params[:id])
              
                  respond_to do |format|
                    if @analysis_item.update_attributes(params[:analysis_item])
              Severity: Major
              Found in app/controllers/analysis_items_controller.rb and 13 other locations - About 30 mins to fix
              app/controllers/analysis_jobs_controller.rb on lines 53..60
              app/controllers/analysis_scripts_controller.rb on lines 53..60
              app/controllers/audio_events_controller.rb on lines 53..60
              app/controllers/audio_recordings_controller.rb on lines 64..71
              app/controllers/bookmarks_controller.rb on lines 53..60
              app/controllers/permissions_controller.rb on lines 53..60
              app/controllers/photos_controller.rb on lines 56..63
              app/controllers/progresses_controller.rb on lines 53..60
              app/controllers/projects_controller.rb on lines 53..60
              app/controllers/saved_searches_controller.rb on lines 53..60
              app/controllers/sites_controller.rb on lines 53..60
              app/controllers/tags_controller.rb on lines 48..55
              app/controllers/users_controller.rb on lines 53..60

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

              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

              Severity
              Category
              Status
              Source
              Language