theforeman/foreman

View on GitHub
app/controllers/concerns/foreman/controller/puppet/hosts_controller_extensions.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method update_multiple_proxy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update_multiple_proxy(proxy_type, host_update_method)
    proxy_id = params[:proxy][:proxy_id]
    if proxy_id
      proxy = SmartProxy.find_by_id(proxy_id)
    else

    Method update_multiple_proxy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def update_multiple_proxy(proxy_type, host_update_method)
        proxy_id = params[:proxy][:proxy_id]
        if proxy_id
          proxy = SmartProxy.find_by_id(proxy_id)
        else

    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 update_multiple_environment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def update_multiple_environment
        # simple validations
        if params[:environment].nil? || (id = params["environment"]["id"]).nil?
          error _('No environment selected!')
          redirect_to(select_multiple_environment_hosts_path)

    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