MiraitSystems/enju_trunk

View on GitHub
app/helpers/system_configurations_helper.rb

Summary

Maintainability
F
4 days
Test Coverage

Method make_form_boolean has a Cognitive Complexity of 126 (exceeds 5 allowed). Consider refactoring.
Open

 def make_form_boolean(string, system_configuration)
   ['true', 'false'].each do |state|
     string << "<input type=radio
                       name=system_configurations[#{ system_configuration.id }]
                       value=#{state} "
Severity: Minor
Found in app/helpers/system_configurations_helper.rb - About 2 days 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 make_form_selector has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

 def make_form_selector(string, system_configuration)
   string << "<select name=system_configurations[#{ system_configuration.id }]>"
   case system_configuration.keyname
   when 'header.disp_date'
     3.times do |i|
Severity: Minor
Found in app/helpers/system_configurations_helper.rb - About 6 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 make_form_boolean has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

 def make_form_boolean(string, system_configuration)
   ['true', 'false'].each do |state|
     string << "<input type=radio
                       name=system_configurations[#{ system_configuration.id }]
                       value=#{state} "
Severity: Major
Found in app/helpers/system_configurations_helper.rb - About 4 hrs to fix

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

      def make_form(system_configuration, errors = nil)
        #TODO:
        error = nil
        if errors
          errors.each do |e|
    Severity: Minor
    Found in app/helpers/system_configurations_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 make_form_selector has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

     def make_form_selector(string, system_configuration)
       string << "<select name=system_configurations[#{ system_configuration.id }]>"
       case system_configuration.keyname
       when 'header.disp_date'
         3.times do |i|
    Severity: Minor
    Found in app/helpers/system_configurations_helper.rb - About 2 hrs to fix

      Method make_form has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def make_form(system_configuration, errors = nil)
          #TODO:
          error = nil
          if errors
            errors.each do |e|
      Severity: Minor
      Found in app/helpers/system_configurations_helper.rb - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status