DavyJonesLocker/client_side_validations

View on GitHub
lib/client_side_validations/action_view/form_builder.rb

Summary

Maintainability
A
45 mins
Test Coverage

Method grouped_collection_select has 8 arguments (exceeds 4 allowed). Consider refactoring.
Invalid

        def grouped_collection_select(method, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {})
Severity: Major
Found in lib/client_side_validations/action_view/form_builder.rb - About 1 hr to fix

    Method collection_select has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Invalid

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

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

              def build_validation_options(method, options = {})
                return unless @options[:validate]
      
                index       = @default_options[:index].present? ? "[#{@default_options[:index]}]" : ''
                child_index = @options[:child_index] ? "(\\d+|#{Regexp.escape(@options[:child_index].to_s)})" : '\\d+'
      Severity: Minor
      Found in lib/client_side_validations/action_view/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.
      Invalid

              def select(method, choices = nil, options = {}, html_options = {}, &block)
      Severity: Minor
      Found in lib/client_side_validations/action_view/form_builder.rb - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status