yast/yast-yast2

View on GitHub
library/systemd/src/lib/yast2/system_service.rb

Summary

Maintainability
C
1 day
Test Coverage

Class SystemService has 46 methods (exceeds 20 allowed). Consider refactoring.
Open

  class SystemService
    extend Forwardable

    # Error when a service is not found
    class NotFoundError < RuntimeError; end
Severity: Minor
Found in library/systemd/src/lib/yast2/system_service.rb - About 6 hrs to fix

    Method save_start_mode has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def save_start_mode
          return unless changed?(:start_mode)
    
          result =
            case changes[:start_mode]
    Severity: Minor
    Found in library/systemd/src/lib/yast2/system_service.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 perform_reload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def perform_reload
          return perform_restart unless support_reload?
    
          result = true
    
    
    Severity: Minor
    Found in library/systemd/src/lib/yast2/system_service.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

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

        def start_modes
          @start_modes = [:on_boot, :manual, :on_demand] unless found?
          return @start_modes if @start_modes
    
          @start_modes = [:manual]
    Severity: Minor
    Found in library/systemd/src/lib/yast2/system_service.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

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

        def perform_action
          return true unless action
    
          result = send("perform_#{action}")
          register_error(:active) if result == false
    Severity: Minor
    Found in library/systemd/src/lib/yast2/system_service.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