Fullscreen/bh

View on GitHub

Showing 7 of 13 total issues

Class Base has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Base
      def initialize(app = nil, *args, &block)
        @app = app
        @concat = block_given? &&  @app.respond_to?(:concat_content)
        @options = extract_options_from(*args, &block).dup
Severity: Minor
Found in lib/bh/classes/base.rb - About 2 hrs to fix

    Method static_control_string has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def static_control_string(text, options = {})
            content_tag :div, class: 'form-group' do
              if inline_form?
                  label = content_tag :label, options[:label], class: 'sr-only' if options[:label]
                  field = content_tag :p, text, class: 'form-control-static'
    Severity: Minor
    Found in lib/bh/core_ext/rails/form/static_control_helper.rb - About 2 hrs 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 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def link_to(*args, &block)
          link_to = Bh::LinkTo.new self, *args, &block
    
          link_to.append_class! :'alert-link' if Bh::Stack.find(Bh::AlertBox)
          link_to.append_class! :'navbar-brand' if Bh::Stack.find(Bh::Vertical)
    Severity: Minor
    Found in lib/bh/helpers/link_to_helper.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 button_to has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def button_to(*args, &block)
          button_to = Bh::ButtonTo.new self, *args, &block
    
          if button_to.extract! :context, :size, :layout
            button_to.append_button_class! :btn
    Severity: Minor
    Found in lib/bh/helpers/button_to_helper.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

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

          def select(method, choices = nil, options = {}, html_options = {}, &block)
    Severity: Minor
    Found in lib/bh/core_ext/rails/form/select_helper.rb - About 35 mins to fix

      Method label_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def label_options(errors = {})
              klass = []
              klass << 'sr-only' if inline_form?
              klass << 'col-sm-3' if horizontal_form?
              klass << 'control-label' if horizontal_form?
      Severity: Minor
      Found in lib/bh/core_ext/rails/form/base_helper.rb - About 25 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 fields_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def fields_for(record_name, record_object = nil, fields_options = {}, &block)
              if record_object.is_a?(Hash) && record_object.extractable_options?
                record_object, fields_options = nil, record_object
              end
      
      
      Severity: Minor
      Found in lib/bh/core_ext/rails/form/fields_for_helper.rb - About 25 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