kalkov/rails4_client_side_validations

View on GitHub
lib/rails4_client_side_validations/action_view/form_helper.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method client_side_form_settings has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def client_side_form_settings(object, options, builder)
      if options[:validate]
        if options[:id]
          var_name = options[:id]
        else
Severity: Minor
Found in lib/rails4_client_side_validations/action_view/form_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 form_for has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def form_for(record, *args, &block)
      raise ArgumentError, "Missing block" unless block_given?
      options = args.extract_options!
      if options[:validate]

Severity: Minor
Found in lib/rails4_client_side_validations/action_view/form_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 form_for has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def form_for(record, *args, &block)
      raise ArgumentError, "Missing block" unless block_given?
      options = args.extract_options!
      if options[:validate]

Severity: Minor
Found in lib/rails4_client_side_validations/action_view/form_helper.rb - About 1 hr to fix

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

        def construct_validators
          @validators.inject({}) do |validator_hash, object_opts|
            option_hash = object_opts[1].inject({}) do |option_hash, attr|
              option_hash.merge!(attr[0] => attr[1][:options])
            end
    Severity: Minor
    Found in lib/rails4_client_side_validations/action_view/form_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

    There are no issues that match your filters.

    Category
    Status