padrino/padrino-framework

View on GitHub
padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method link_to has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def link_to(*args, &block)
        options = args.last.is_a?(Hash) ? args.pop : {}
        name = block_given? ? '' : args.shift
        href = args.first
        options = { :href => href ? escape_link(href) : '#' }.update(options)
Severity: Minor
Found in padrino-helpers/lib/padrino-helpers/asset_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 asset_timestamp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def asset_timestamp(file_path)
        return nil if file_path =~ /\?/ || (self.class.respond_to?(:asset_stamp) && !self.class.asset_stamp)
        public_path = self.class.public_folder if self.class.respond_to?(:public_folder)
        public_path ||= Padrino.root("public") if Padrino.respond_to?(:root)
        public_file_path = File.join(public_path, file_path) if public_path
Severity: Minor
Found in padrino-helpers/lib/padrino-helpers/asset_tag_helpers.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 parse_conditions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_conditions(url, options)
        if options.has_key?(:if)
          condition = options.delete(:if)
          condition == :current ? url == request.path_info : condition
        elsif condition = options.delete(:unless)
Severity: Minor
Found in padrino-helpers/lib/padrino-helpers/asset_tag_helpers.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 flash_tag has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def flash_tag(*args)
        options = args.last.is_a?(Hash) ? args.pop : {}
        bootstrap = options.delete(:bootstrap) if options[:bootstrap]
        args.inject(SafeBuffer.new) do |html,kind|
          next html unless flash[kind]
Severity: Minor
Found in padrino-helpers/lib/padrino-helpers/asset_tag_helpers.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

There are no issues that match your filters.

Category
Status