QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 93 of 184 total issues

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

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

          Method modify_ffmpeg has a Cognitive Complexity of 17 (exceeds 5 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: Minor
          Found in lib/modules/audio_ffmpeg.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

          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

          Function createBox has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function createBox($parent, contextData, width, height, top, left) {
          
                  if (contextData === undefined) {
                      throw "Context data must be given";
                  }
          Severity: Major
          Found in lib/assets/javascripts/jquery.drawabox.js - About 2 hrs to fix

            Function LoginCtrl has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function LoginCtrl($scope, $http, $location, authService, AuthenticationProviders, Authenticator) {
            
                // WARNING: Cookies required for this to work
                function checkLogin() {
                    Authenticator.checkLogin();
            Severity: Minor
            Found in app/assets/javascripts/angular/controllers/login.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 open_id_info has a Cognitive Complexity of 16 (exceeds 5 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 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 create has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create
                success = nil
            
                post_data = request.raw_post
            
            
            Severity: Major
            Found in app/controllers/experiments_controller.rb - About 2 hrs to fix

              Method twitter_info has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                def twitter_info(raw)
              
                  twitter_name = raw['info'].include?('name') ? raw['info']['name'] : ''
                  twitter_nickname = raw['info'].include?('nickname') ? raw['info']['nickname'] : ''
                  twitter_any_name = twitter_name.blank? ? (twitter_nickname.blank? ? '' : twitter_nickname) : twitter_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 modify has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.modify(source, target, modify_parameters)
                  raise ArgumentError, "Source does not exist: #{File.basename(source)}" unless File.exists? source
                  raise ArgumentError, "Target exists: #{File.basename(target)}" unless !File.exists? target
                  raise ArgumentError "Source and Target are the same file: #{File.basename(target)}" unless source != target
              
              Severity: Minor
              Found in lib/modules/audio.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 create_or_update_user has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def create_or_update_user(canonical_data, user=nil)
                  authorization = nil
              
                  #uid = canonical_data[:canonical][:uid] # very likely to be present
                  #name = canonical_data[:canonical][:name] # might be present
              Severity: Minor
              Found in app/controllers/api/callbacks_controller.rb - About 1 hr to fix

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

                            link: function (scope, element, attrs) {
                                var $control = element,
                                    $player = $control.children('div'),
                                    cls = 'pause';
                
                
                Severity: Minor
                Found in app/assets/javascripts/angular/directives/directives.js - About 1 hr to fix

                  Method modify_wavpack has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.modify_wavpack(source, target, modify_parameters = {})
                      raise ArgumentError, "Source is not a wavpack file: #{File.basename(source)}" unless source.match(/\.wv$/)
                      raise ArgumentError, "Target is not a wav file: : #{File.basename(target)}" unless target.match(/\.wav$/)
                      raise ArgumentError "Source and Target are the same file: #{File.basename(target)}" unless source != target
                  
                  Severity: Minor
                  Found in lib/modules/audio_wavpack.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

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

                              link: function (scope, elem, attrs) {
                                  //once Angular is started, remove class:
                                  elem.removeClass('waiting-for-angular');
                  
                                  var login = elem.find('#login-holder');
                  Severity: Minor
                  Found in app/assets/javascripts/angular/directives/auth.js - About 1 hr to fix

                    Method modify_mp3splt has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def self.modify_mp3splt(source, target, modify_parameters = {})
                        raise ArgumentError, "Source is not a mp3 file: #{File.basename(source)}" unless source.match(/\.mp3$/)
                        raise ArgumentError, "Target is not a mp3 file: : #{File.basename(target)}" unless target.match(/\.mp3$/)
                        raise ArgumentError, "Source does not exist: #{File.basename(source)}" unless File.exists? source
                        raise ArgumentError, "Target exists: #{File.basename(target)}" if File.exists? target
                    Severity: Minor
                    Found in lib/modules/audio_mp3splt.rb - About 1 hr to fix

                      Function filter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          Array.prototype.filter = function (fun /*, thisp */) {
                              "use strict";
                      
                              if (this == null)
                                  throw new TypeError();
                      Severity: Minor
                      Found in lib/assets/javascripts/functions.js - 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

                      Severity
                      Category
                      Status
                      Source
                      Language