QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 184 of 184 total issues

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

    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

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

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

            $scope.reset = function() {
                if($scope.isEditing){
                    $scope.project = angular.copy($scope.original);
                }
            };
        Severity: Minor
        Found in app/assets/javascripts/angular/controllers/projects.js and 1 other location - About 45 mins to fix
        app/assets/javascripts/angular/controllers/photos.js on lines 44..48

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

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

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

            $scope.reset = function() {
                if($scope.editing){
                    $scope.project = angular.copy($scope.original);
                }
            };
        Severity: Minor
        Found in app/assets/javascripts/angular/controllers/photos.js and 1 other location - About 45 mins to fix
        app/assets/javascripts/angular/controllers/projects.js on lines 128..132

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

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

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

            def create
              @analysis_item = AnalysisItem.new(params[:analysis_item])
          
              respond_to do |format|
                if @analysis_item.save
          Severity: Major
          Found in app/controllers/analysis_items_controller.rb and 13 other locations - About 35 mins to fix
          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
          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_script = AnalysisScript.new(params[:analysis_script])
          
              respond_to do |format|
                if @analysis_script.save
          Severity: Major
          Found in app/controllers/analysis_scripts_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/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
              @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
              @project = Project.new(params[:project])
          
              respond_to do |format|
                if @project.save
          Severity: Major
          Found in app/controllers/projects_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/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

          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

          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

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

            def create
              @progress = Progress.new(params[:progress])
          
              respond_to do |format|
                if @progress.save
          Severity: Major
          Found in app/controllers/progresses_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/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

          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
              @site = Site.new(params[:site])
          
              respond_to do |format|
                if @site.save
          Severity: Major
          Found in app/controllers/sites_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/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
              @tag = Tag.new(params[:tag])
          
              respond_to do |format|
                if @tag.save
          Severity: Major
          Found in app/controllers/tags_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/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
              @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

          Severity
          Category
          Status
          Source
          Language