FreedomBen/dory

View on GitHub

Showing 8 of 25 total issues

Class Dnsmasq has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Dnsmasq
    extend Dory::DockerService

    #
    # I really hate these globals.  It would be great to refactor these out
Severity: Minor
Found in lib/dory/dnsmasq.rb - About 3 hrs to fix

    Method run_preconditions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.run_preconditions
          puts "[DEBUG] dnsmasq service running preconditions" if Dory::Config.debug?
    
          # we don't want to hassle the user with checking the port unless necessary
          if first_attempt_failed?
    Severity: Minor
    Found in lib/dory/dnsmasq.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 upgrade has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.upgrade(old_hash)
          newsettings = old_hash.dup
    
          # If there's a single domain and address, upgrade to the array format
          if newsettings[:dory][:dnsmasq][:domain]
    Severity: Minor
    Found in lib/dory/config.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 down_systemd_services has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.down_systemd_services
          puts "[DEBUG] Putting systemd services down" if Dory::Config.debug?
    
          conf = if ask_about_killing?
                   puts "You have some systemd services running that will race against us \n" \
    Severity: Minor
    Found in lib/dory/dnsmasq.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 handle_error has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.handle_error(_command_output)
          puts "[DEBUG] handling dnsmasq start error" if Dory::Config.debug?
          # If we've already tried to handle failure, prevent infinite recursion
          if first_attempt_failed?
            puts "[DEBUG] Attempt to kill conflicting service failed" if Dory::Config.debug?
    Severity: Minor
    Found in lib/dory/dnsmasq.rb - About 35 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 up_systemd_services has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.up_systemd_services
          if self.systemd_services?
            puts "[DEBUG] Putting systemd services back up: #{self.systemd_services.join(', ')}" if Dory::Config.debug?
            if self.systemd_services.reverse.all? { |service|
              Dory::Systemd.set_systemd_service(service: service, up: true)
    Severity: Minor
    Found in lib/dory/dnsmasq.rb - About 35 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 offer_to_kill has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.offer_to_kill(listener_list, answer: nil)
          listener_list.each do |process|
            puts "Process '#{process.command}' with PID '#{process.pid}' is listening on #{process.node} port #{self.port}.".yellow
          end
          pids = listener_list.uniq(&:pid).map(&:pid)
    Severity: Minor
    Found in lib/dory/dnsmasq.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 resolv_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.resolv_file
            if Os.ubuntu?
              return self.ubuntu_resolv_file if Os.ubuntu?
            elsif Os.fedora? || Os.arch? || File.exist?(self.common_resolv_file)
              return self.common_resolv_file
    Severity: Minor
    Found in lib/dory/resolv/linux.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

    Severity
    Category
    Status
    Source
    Language