comfy/comfy-bootstrap-form

View on GitHub

Showing 22 of 22 total issues

File form_builder.rb has 415 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative "bootstrap_options"

module ComfyBootstrapForm
  class FormBuilder < ActionView::Helpers::FormBuilder

Severity: Minor
Found in lib/comfy_bootstrap_form/form_builder.rb - About 5 hrs to fix

    Method draw_choices has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        def draw_choices(bootstrap, type, method, collection, value_method, text_method, _options, html_options)
          draw_form_group_fieldset(bootstrap, method) do
            if bootstrap.custom_control
              label_css_class = "custom-control-label"
    
    
    Severity: Minor
    Found in lib/comfy_bootstrap_form/form_builder.rb - About 5 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 check_box has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
          bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))
          return super if bootstrap.disabled
    
          help_text = draw_help(bootstrap)
    Severity: Minor
    Found in lib/comfy_bootstrap_form/form_builder.rb - About 4 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 radio_button has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def radio_button(method, tag_value, options = {})
          bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))
          return super if bootstrap.disabled
    
          help_text = draw_help(bootstrap)
    Severity: Minor
    Found in lib/comfy_bootstrap_form/form_builder.rb - About 4 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

    Class FormBuilder has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class FormBuilder < ActionView::Helpers::FormBuilder
    
        FIELD_HELPERS = %w[
          color_field date_field datetime_field email_field month_field
          password_field phone_field range_field search_field text_area
    Severity: Minor
    Found in lib/comfy_bootstrap_form/form_builder.rb - About 2 hrs to fix

      Function exports has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(api) {
        var validEnv = ['development', 'test', 'production']
        var currentEnv = api.env()
        var isDevelopmentEnv = api.env('development')
        var isProductionEnv = api.env('production')
      Severity: Major
      Found in demo/babel.config.js - About 2 hrs to fix

        Method draw_input_group has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def draw_input_group(bootstrap, errors, &block)
              prepend_html  = draw_input_group_content(bootstrap, :prepend)
              append_html   = draw_input_group_content(bootstrap, :append)
        
              help_text = draw_help(bootstrap)
        Severity: Minor
        Found in lib/comfy_bootstrap_form/form_builder.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 draw_choices has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def draw_choices(bootstrap, type, method, collection, value_method, text_method, _options, html_options)
              draw_form_group_fieldset(bootstrap, method) do
                if bootstrap.custom_control
                  label_css_class = "custom-control-label"
        
        
        Severity: Minor
        Found in lib/comfy_bootstrap_form/form_builder.rb - About 1 hr to fix

          Method check_box has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
                bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))
                return super if bootstrap.disabled
          
                help_text = draw_help(bootstrap)
          Severity: Minor
          Found in lib/comfy_bootstrap_form/form_builder.rb - About 1 hr to fix

            Method radio_button has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def radio_button(method, tag_value, options = {})
                  bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))
                  return super if bootstrap.disabled
            
                  help_text = draw_help(bootstrap)
            Severity: Minor
            Found in lib/comfy_bootstrap_form/form_builder.rb - About 1 hr to fix

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

                  def draw_form_group_fieldset(bootstrap, method)
                    options = {}
              
                    unless bootstrap.label[:hide]
                      label_text = bootstrap.label[:text]
              Severity: Minor
              Found in lib/comfy_bootstrap_form/form_builder.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 draw_form_group_fieldset has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def draw_form_group_fieldset(bootstrap, method)
                    options = {}
              
                    unless bootstrap.label[:hide]
                      label_text = bootstrap.label[:text]
              Severity: Minor
              Found in lib/comfy_bootstrap_form/form_builder.rb - About 1 hr to fix

                Method draw_choices has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def draw_choices(bootstrap, type, method, collection, value_method, text_method, _options, html_options)
                Severity: Major
                Found in lib/comfy_bootstrap_form/form_builder.rb - About 1 hr to fix

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

                      def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {})
                  Severity: Minor
                  Found in lib/comfy_bootstrap_form/form_builder.rb - About 45 mins to fix

                    Method file_field has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def file_field(method, options = {})
                          bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))
                          return super if bootstrap.disabled
                    
                          draw_form_group(bootstrap, method, options) do
                    Severity: Minor
                    Found in lib/comfy_bootstrap_form/form_builder.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 collection_select has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
                    Severity: Minor
                    Found in lib/comfy_bootstrap_form/form_builder.rb - About 45 mins to fix

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

                          def collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {})
                      Severity: Minor
                      Found in lib/comfy_bootstrap_form/form_builder.rb - About 45 mins to fix

                        Method form_group has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def form_group(options = {})
                              bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))
                        
                              label_options = bootstrap.label.clone
                              label_text = label_options.delete(:text)
                        Severity: Minor
                        Found in lib/comfy_bootstrap_form/form_builder.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/comfy_bootstrap_form/form_builder.rb - About 35 mins to fix

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

                              def draw_errors(bootstrap, method)
                                errors = []
                          
                                if bootstrap.error.present?
                                  errors = [bootstrap.error]
                          Severity: Minor
                          Found in lib/comfy_bootstrap_form/form_builder.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