QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 184 of 184 total issues

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

                for (var exampleAnnotationIndex = 0; exampleAnnotationIndex < annotations.length; exampleAnnotationIndex++) {
                    $scope.currentStepResults.annotationExampleOrder.push({
                        'index': exampleAnnotationIndex,
                        'step': $scope.step,
                        'annotationId': annotations[exampleAnnotationIndex].id,
Severity: Major
Found in app/assets/javascripts/angular/controllers/experiments.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/angular/controllers/experiments.js on lines 921..929

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

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

  def item
    # controller action for an individual media file

    # construct a hash of information to be returned and used for modify_parameters
    @file_info = params
Severity: Minor
Found in app/controllers/media_controller.rb - About 3 hrs 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

File audio_harvester.rb has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'yaml'
require 'net/http'
require 'json'
require 'digest'
require 'logger'
Severity: Minor
Found in lib/external/audio_harvester.rb - About 3 hrs to fix

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

            siteResource.update(routeArgs, p,  function() {
                $scope.original = angular.copy($scope.site);
                var msg = "Site details updated successfully.";
                console.log(msg); alert(msg);
            }, function() {
    Severity: Major
    Found in app/assets/javascripts/angular/controllers/sites.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/angular/controllers/projects.js on lines 139..146

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

    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

                projectResource.update(routeArgs, p,  function() {
                    $scope.original = angular.copy($scope.project);
                    var msg = "Project details updated successfully.";
                    console.log(msg); alert(msg);
                }, function() {
    Severity: Major
    Found in app/assets/javascripts/angular/controllers/projects.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/angular/controllers/sites.js on lines 61..68

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

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

                link: function (scope, elements, attributes, controller) {
                    var element = elements[0];
                    if (element.nodeName !== "AUDIO") {
                        throw 'Cannot put ngAudio element on an element that is not a <audio />';
                    }
    Severity: Major
    Found in app/assets/javascripts/angular/directives/directives.js - About 2 hrs to fix

      Function ProjectCtrl has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      function ProjectCtrl($scope, $location, $resource, $routeParams, Project, Site, Photo, AudioEvent) {
      
          var self = this;
      
          var projectResource = Project; //$resource('/projects/:projectId', {projectId: $routeParams.projectId});
      Severity: Minor
      Found in app/assets/javascripts/angular/controllers/projects.js - About 2 hrs 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 modify_ffmpeg has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.modify_ffmpeg(source, target, modify_parameters = {})
          # ffmpeg is the catch-all, so it will do anything specified in modify_parameters.
      
          raise ArgumentError, "Source is a wavpack file, use wavpack to convert to .wav first instead: #{File.basename(source)}" if source.match(/\.wv$/)
      
      
      Severity: Major
      Found in lib/modules/audio_ffmpeg.rb - About 2 hrs to fix

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

        function PhotosCtrl($scope, $resource, Photo) {
            $scope.photosResource = $resource('/photos', {});
            $scope.photos = $scope.photosResource.query();
        
            $scope.links = function(key) {
        Severity: Major
        Found in app/assets/javascripts/angular/controllers/photos.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/angular/controllers/sites.js on lines 3..10

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

        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

        function SitesCtrl($scope, $resource, Site) {
            $scope.sitesResource = $resource('/sites', {});
            $scope.sites = $scope.sitesResource.query();
        
            $scope.links = function(key) {
        Severity: Major
        Found in app/assets/javascripts/angular/controllers/sites.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/angular/controllers/photos.js on lines 3..10

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

        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

                    baw.popUpWindow(popPath, 700, 500, function (data) {
                        data = data || {};
        
                        railsFieldRenamingInterceptor().core(data);
        
        
        Severity: Major
        Found in app/assets/javascripts/angular/services/services.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/angular/services/services.js on lines 294..305

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

        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

                    baw.popUpWindow(popPath, 700, 500, function (data) {
                        data = data || {};
        
                        railsFieldRenamingInterceptor().core(data);
        
        
        Severity: Major
        Found in app/assets/javascripts/angular/services/services.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/angular/services/services.js on lines 278..289

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

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

          def item
            # controller action for an individual media file
        
            # construct a hash of information to be returned and used for modify_parameters
            @file_info = params
        Severity: Major
        Found in app/controllers/media_controller.rb - About 2 hrs to fix

          File services.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          (function () {
              /**
               * Helper method for adding a put request onto the standard angular resource service
               * @param $resource - the stub resource
               * @param {string} path - the web server path
          Severity: Minor
          Found in app/assets/javascripts/angular/services/services.js - About 2 hrs to fix

            Method initialize has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

              def initialize(user)
            
                # The can method is used to define permissions and requires two arguments.
                # The first one is the action you're setting the permission for, the second one
                # is the class of object you're setting it on.
            Severity: Minor
            Found in app/models/ability.rb - About 2 hrs 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 init has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                methods.init = function (options) {
            
                    if (options && !(options instanceof Object)) {
                        throw new Error("If defined, eventMap should be an object");
                    }
            Severity: Major
            Found in lib/assets/javascripts/jquery.drawabox.js - About 2 hrs to fix

              Class CallbacksController has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Api::CallbacksController < Devise::OmniauthCallbacksController
                # this may be needed, but haven't needed it yet.
                #skip_before_filter :verify_authenticity_token, :only => [:open_id]
              
                # NOTES
              Severity: Minor
              Found in app/controllers/api/callbacks_controller.rb - About 2 hrs to fix

                Function LoginCtrl has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function LoginCtrl($scope, $http, $location, authService, AuthenticationProviders, Authenticator) {
                
                    // WARNING: Cookies required for this to work
                    function checkLogin() {
                        Authenticator.checkLogin();
                Severity: Major
                Found in app/assets/javascripts/angular/controllers/login.js - About 2 hrs to fix

                  Function link has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              link: function (scope, $element, attributes, controller) {
                  
                                  // assign a unique id to scope
                                  scope.id = Number.Unique();
                  
                  
                  Severity: Major
                  Found in app/assets/javascripts/angular/directives/directives.js - About 2 hrs to fix

                    Method modify_sox has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def self.modify_sox(source, target, modify_parameters = {})
                        raise ArgumentError, "Source is not a mp3 or wav file: #{File.basename(source)}" unless source.match(/\.mp3|\.wav$/)
                        raise ArgumentError, "Target is not a mp3 or wav file: : #{File.basename(target)}" unless target.match(/\.mp3|\.wav$/)
                        raise ArgumentError, "Source does not exist: #{File.basename(source)}" unless File.exists? source
                        raise ArgumentError, "Target exists: #{File.basename(target)}" unless !File.exists? target
                    Severity: Minor
                    Found in lib/modules/audio_sox.rb - About 2 hrs 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