padrino/padrino-framework

View on GitHub

Showing 170 of 214 total issues

Method padrino_route_added has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def padrino_route_added(route, verb, path, args, options, block)
Severity: Minor
Found in padrino-cache/lib/padrino-cache.rb - About 45 mins to fix

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

            this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
    padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/tooltip.js on lines 57..57

    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

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

            this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
    padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/tooltip.js on lines 58..58

    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

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

        title = $e.attr('data-original-title')
          || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
    padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/popover.js on lines 66..69

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

    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

        return $e.attr('data-content')
          || (typeof o.content == 'function' ?
                o.content.call($e[0]) :
                o.content)
    padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/tooltip.js on lines 326..327

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

    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

            $(this).addClass('active')
              .siblings('.list-menu-popover-delete-selected').first().show()
              .find('.cancel').on('click', function() {
              
                // Hide the popover on cancel
    padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/application.js on lines 38..44

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

    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

            $(this).addClass('list-row-action-wrapper-link-active')
              .siblings('.list-row-action-popover-delete-one').first().show()
              .find('.cancel').on('click', function() {
    
                $(this).parents('.list-row-action-popover-delete-one').hide()
    padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/application.js on lines 89..98

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

    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 render has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def render(engine=nil, data=nil, options={}, locals={}, &block)
    Severity: Minor
    Found in padrino-mailer/lib/padrino-mailer/ext.rb - About 35 mins to fix

      Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(mode, scoped_controller, options, args, &block)
      Severity: Minor
      Found in padrino-core/lib/padrino-core/filter.rb - About 35 mins to fix

        Method render has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def render(engine, data=nil, options={}, locals={}, &block)
        Severity: Minor
        Found in padrino-helpers/lib/padrino/rendering.rb - About 35 mins to fix

          Method bench has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def bench(action, began_at, message, level=:debug, color=:yellow)
          Severity: Minor
          Found in padrino-core/lib/padrino-core/logger.rb - About 35 mins to fix

            Method render_like_sinatra has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def render_like_sinatra(engine, data, options={}, locals={}, &block)
            Severity: Minor
            Found in padrino-helpers/lib/padrino/rendering.rb - About 35 mins to fix

              Method drop_db has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def self.drop_db(adapter, user, password, host, database)
              Severity: Minor
              Found in padrino-gen/lib/padrino-gen/padrino-tasks/sql-helpers.rb - About 35 mins to fix

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

                      def registered(app)
                        app.helpers Padrino::Cache::Helpers::ObjectCache
                        app.helpers Padrino::Cache::Helpers::CacheStore
                        app.helpers Padrino::Cache::Helpers::Fragment
                        app.helpers Padrino::Cache::Helpers::Page
                Severity: Minor
                Found in padrino-cache/lib/padrino-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 load_boot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def load_boot
                        begin
                          ENV['PADRINO_LOG_LEVEL'] ||= 'test'
                          ENV['BUNDLE_GEMFILE'] = File.join(options[:root], 'Gemfile') if options[:root]
                          boot = options[:root] ? File.join(options[:root], 'config/boot.rb') : 'config/boot.rb'
                Severity: Minor
                Found in padrino-gen/lib/padrino-gen/generators/cli.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 allowed? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                        def allowed?(account=nil, path=nil)
                          path = "/" if path.nil? || path.empty?
                          role = account.role.to_sym rescue nil
                          authorizations = @authorizations.find_all { |auth| auth.roles.include?(:any) }
                          allowed_paths  = authorizations.map(&:allowed).flatten.uniq
                Severity: Minor
                Found in padrino-admin/lib/padrino-admin/access_control.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 migrate_as has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def migrate_as(type)
                    version = env_migration_version
                    fail "MIGRATION_VERSION is required" unless version
                
                    if less_than_active_record_5_2?
                Severity: Minor
                Found in padrino-gen/lib/padrino-gen/padrino-tasks/activerecord.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 error_html_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                        def error_html_attributes(options)
                          [:id, :class, :style].each_with_object({}) do |key,all|
                            if options.include?(key)
                              value = options[key]
                              all[key] = value if value
                Severity: Minor
                Found in padrino-helpers/lib/padrino-helpers/form_helpers/errors.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 rebase_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def rebase_url(url)
                        if url.start_with?('/')
                          new_url = ''
                          new_url << conform_uri(ENV['RACK_BASE_URI']) if ENV['RACK_BASE_URI']
                          new_url << conform_uri(uri_root) if defined?(uri_root)
                Severity: Minor
                Found in padrino-core/lib/padrino-core/application/routing.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 execute_runner has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def execute_runner(kind, template_file)
                        # Determine resolved template path
                        template_file = template_file.to_s
                        template_path = case
                          when template_file =~ %r{^https?://} && template_file !~ /gist/
                Severity: Minor
                Found in padrino-gen/lib/padrino-gen/generators/runner.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

                Severity
                Category
                Status
                Source
                Language