padrino/padrino-framework

View on GitHub

Showing 170 of 214 total issues

Function applyPlacement has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tooltip.prototype.applyPlacement = function (offset, placement) {
    var replace
    var $tip   = this.tip()
    var width  = $tip[0].offsetWidth
    var height = $tip[0].offsetHeight

    Method setup_components has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def setup_components
            self.destination_root = options[:root]
            if in_app_root?
              @_components = options.class.new options.select{ |key,_| self.class.component_types.include?(key.to_sym) }
              @app_name = (options[:app] || "App").gsub(/\W/, '_').camelize
    Severity: Minor
    Found in padrino-gen/lib/padrino-gen/generators/component.rb - About 1 hr to fix

      Method setup_orm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def setup_orm
        ar = MR
        db = @project_name.underscore
      
        begin

        Method params_for has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def params_for(pattern, others)
                data = match(pattern)
                params = indifferent_hash
                if data.names.empty?
                  params.merge!(:captures => data.captures) unless data.captures.empty?
        Severity: Minor
        Found in padrino-core/lib/padrino-core/path_router/matcher.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 tag_attributes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def tag_attributes(options)
                return '' unless options
                options.inject('') do |all,(key,value)|
                  next all unless value
                  all << ' ' if all.empty?
        Severity: Minor
        Found in padrino-helpers/lib/padrino-helpers/tag_helpers.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 object_sources has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def object_sources(target)
              sources = Set.new
              target.methods.each do |method_name|
                next unless method_name.kind_of?(Symbol)
                method_object = target.method(method_name)
        Severity: Minor
        Found in padrino-core/lib/padrino-core/reloader.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 named_routes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def named_routes
              return [] unless app_obj.respond_to?(:routes)
        
              app_obj.routes.map { |route|
                request_method = route.request_methods.first
        Severity: Minor
        Found in padrino-core/lib/padrino-core/mounter.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 setup_orm has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def setup_orm
          sequel = SEQUEL
          db = @project_name.underscore
          require_dependencies 'sequel'
        
        
        Severity: Minor
        Found in padrino-gen/lib/padrino-gen/generators/components/orms/sequel.rb - About 1 hr to fix

          Method setup_orm has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def setup_orm
            ar = AR
            db = @project_name.underscore
          
            begin

            Method create_app has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def create_app
                    self.destination_root = options[:root]
                    underscore_name = name.gsub(/\W/, '_')
                    @app_folder = underscore_name.underscore
                    @app_name   = underscore_name.camelize
            Severity: Minor
            Found in padrino-gen/lib/padrino-gen/generators/app.rb - About 1 hr to fix

              Method setup_project has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def setup_project
                      valid_constant? name
                      app = (options[:app] || "App")
              
                      @project_name = name.gsub(/\W/, '_').underscore.camelize
              Severity: Minor
              Found in padrino-gen/lib/padrino-gen/generators/project.rb - About 1 hr to fix

                Method number_to_human_size has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def number_to_human_size(number, *args)
                        return nil if number.nil?
                
                        options = args.last.is_a?(Hash) ? Utils.symbolize_keys(args.pop) : {}
                
                
                Severity: Minor
                Found in padrino-helpers/lib/padrino-helpers/number_helpers.rb - About 1 hr to fix

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

                      def initialize(options={})
                        @buffer           = []
                        @auto_flush       = options.has_key?(:auto_flush) ? options[:auto_flush] : true
                        @level            = options[:log_level] ? Padrino::Logger::Levels[options[:log_level]] : Padrino::Logger::Levels[:debug]
                        @log              = options[:stream]  || $stdout
                  Severity: Minor
                  Found in padrino-core/lib/padrino-core/logger.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 construct_filter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def construct_filter(*args, &block)
                          options = args.last.is_a?(Hash) ? args.pop : {}
                          if except = options.delete(:except)
                            fail "You cannot use :except with other options specified" unless args.empty? && options.empty?
                            except = Array(except)
                  Severity: Minor
                  Found in padrino-core/lib/padrino-core/application/routing.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 cache has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def cache(key, opts = {}, &block)
                            if settings.caching?
                              began_at = Time.now
                              if settings.cache.key?(key.to_s)
                                value = settings.cache[key.to_s]
                  Severity: Minor
                  Found in padrino-cache/lib/padrino-cache/helpers/fragment.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 padrino_route_added has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def self.padrino_route_added(route, verb, *)
                            return unless route.cache && CACHED_VERBS[verb]
                  
                            route.before_filters do
                              next unless settings.caching?
                  Severity: Minor
                  Found in padrino-cache/lib/padrino-cache/helpers/page.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 initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def initialize(name, options={})
                        @name      = name.to_s
                        @app_class = options[:app_class] || Inflections.camelize(@name)
                        @gem       = options[:gem]       || Inflections.underscore(@app_class.split("::").first)
                        @app_file  = options[:app_file]  || locate_app_file
                  Severity: Minor
                  Found in padrino-core/lib/padrino-core/mounter.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 cache_object has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def cache_object(key, opts = {})
                            if settings.caching?
                              began_at = Time.now
                              if settings.cache.key?(key.to_s)
                                value = settings.cache[key.to_s]
                  Severity: Minor
                  Found in padrino-cache/lib/padrino-cache/helpers/cache_object.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 show has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Modal.prototype.show = function (_relatedTarget) {
                      var that = this
                      var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
                  
                      this.$element.trigger(e)

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

                          def create_controller
                            validate_namespace name
                            self.destination_root = options[:root]
                            if in_app_root?
                              app = options[:app]
                    Severity: Minor
                    Found in padrino-gen/lib/padrino-gen/generators/controller.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language