thooams/ui_bibz

View on GitHub
lib/ui_bibz/ui/core/notifications/components/toast_header.rb

Summary

Maintainability
A
0 mins
Test Coverage
C
72%

Method pre_render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def pre_render
      content_tag :div, html_options do
        concat UiBibz::Ui::Core::Icons::Glyph.new(options[:glyph], class: 'me-2').render unless options[:glyph].nil?
        concat image unless options[:image].nil?
        concat content_tag(:strong, content, class: 'me-auto')
Severity: Minor
Found in lib/ui_bibz/ui/core/notifications/components/toast_header.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 image has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def image
      if options[:image].is_a?(String)
        image_tag(options[:image], class: 'rounded me-2', alt: sanitize_text(options[:image])) unless options[:image].nil?
      else
        options[:image][:class] = UiBibz::Builders::HtmlClassesBuilder.join_classes(options[:image][:class], 'rounded me-2')
Severity: Minor
Found in lib/ui_bibz/ui/core/notifications/components/toast_header.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

There are no issues that match your filters.

Category
Status