koraktor/gallerist

View on GitHub

Showing 19 of 604 total issues

File hammer.js has 1509 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! Hammer.JS - v2.0.7 - 2016-04-22
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2016 Jorik Tangelder;
 * Licensed under the MIT license */
Severity: Major
Found in assets/javascript/hammer.js - About 4 days to fix

    Function getTouches has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getTouches(ev, type) {
        var allTouches = toArray(ev.touches);
        var targetIds = this.targetIds;
    
        // when there is only one touch, the process can be simplified
    Severity: Minor
    Found in assets/javascript/hammer.js - About 1 hr to fix

      Function process has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          process: function(input) {
              var options = this.options;
      
              var validPointers = input.pointers.length === options.pointers;
              var validMovement = input.distance < options.threshold;
      Severity: Minor
      Found in assets/javascript/hammer.js - About 1 hr to fix

        Function computeInputData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function computeInputData(manager, input) {
            var session = manager.session;
            var pointers = input.pointers;
            var pointersLength = pointers.length;
        
        
        Severity: Minor
        Found in assets/javascript/hammer.js - About 1 hr to fix

          Method setup_library has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def setup_library
              library = Gallerist::Library.new settings.library_path
              settings.set :library, library
          
              logger.info "Loading library from \"#{library.path}\""
          Severity: Minor
          Found in lib/gallerist/app/utilities.rb - About 1 hr to fix

            Method registered has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.registered(_)
                configure do
                  set :logging, ENV['VERBOSE'] ? ::Logger::WARN : ::Logger::INFO
            
                  tempdir = Dir.mktmpdir('gallerist')
            Severity: Minor
            Found in lib/gallerist/app/configuration.rb - About 1 hr to fix

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

                  handler: function PEhandler(ev) {
                      var store = this.store;
                      var removePointer = false;
              
                      var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
              Severity: Minor
              Found in assets/javascript/hammer.js - About 1 hr to fix

                Function preventDefaults has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    preventDefaults: function(input) {
                        var srcEvent = input.srcEvent;
                        var direction = input.offsetDirection;
                
                        // if the touch action did prevented once this session
                Severity: Minor
                Found in assets/javascript/hammer.js - About 1 hr to fix

                  Function recognize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      recognize: function(inputData) {
                          var session = this.session;
                          if (session.stopped) {
                              return;
                          }
                  Severity: Minor
                  Found in assets/javascript/hammer.js - About 1 hr to fix

                    Method setup_library has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def setup_library
                        library = Gallerist::Library.new settings.library_path
                        settings.set :library, library
                    
                        logger.info "Loading library from \"#{library.path}\""
                    Severity: Minor
                    Found in lib/gallerist/app/utilities.rb - About 55 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 link_to has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def link_to(obj, classes = nil, link = nil)
                        classes = [ classes ].compact
                        link = obj.respond_to?(:name) ? obj.name : obj.id if link.nil?
                    
                        classes = classes.empty? ? '' : ' class="%s"' % [ classes.join(' ') ]
                    Severity: Minor
                    Found in lib/gallerist/app/helpers.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

                    Avoid deeply nested control flow statements.
                    Open

                                        if (source.hasOwnProperty(nextKey)) {
                                            output[nextKey] = source[nextKey];
                                        }
                    Severity: Major
                    Found in assets/javascript/hammer.js - About 45 mins to fix

                      Method call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def call(env)
                          @app.call env
                        rescue Exception => error
                          if env['rack.warmup']
                            if defined?(SQLite3::BusyException) && error.is_a?(SQLite3::BusyException)
                      Severity: Minor
                      Found in lib/gallerist/middleware/raise_warmup_exceptions.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 widget_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def widget_for(obj)
                          classes = %w{label label-primary}
                      
                          case obj
                          when Gallerist::Person
                      Severity: Minor
                      Found in lib/gallerist/app/helpers.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

                      Avoid too many return statements within this function.
                      Open

                          return TOUCH_ACTION_AUTO;
                      Severity: Major
                      Found in assets/javascript/hammer.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return '';
                        Severity: Major
                        Found in assets/javascript/hammer.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return '';
                          Severity: Major
                          Found in assets/javascript/hammer.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return STATE_FAILED;
                            Severity: Major
                            Found in assets/javascript/hammer.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return STATE_FAILED;
                              Severity: Major
                              Found in assets/javascript/hammer.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language