MissionCriticalCloud/vagrant-cloudstack

View on GitHub
lib/vagrant-cloudstack/action/terminate_instance.rb

Summary

Maintainability
C
1 day
Test Coverage

Method remove_volumes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def remove_volumes(env)
          volumes_file = env[:machine].data_dir.join('volumes')
          if volumes_file.file?
            env[:ui].info(I18n.t('vagrant_cloudstack.deleting_volumes'))
            File.read(volumes_file).each_line do |line|
Severity: Minor
Found in lib/vagrant-cloudstack/action/terminate_instance.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 remove_firewall_rules has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def remove_firewall_rules(env)
          env[:ui].info(I18n.t('vagrant_cloudstack.deleting_firewall_rule'))
          firewall_file = env[:machine].data_dir.join('firewall')
          if firewall_file.file?
            File.read(firewall_file).each_line do |line|
Severity: Minor
Found in lib/vagrant-cloudstack/action/terminate_instance.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 remove_firewall_rules has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def remove_firewall_rules(env)
          env[:ui].info(I18n.t('vagrant_cloudstack.deleting_firewall_rule'))
          firewall_file = env[:machine].data_dir.join('firewall')
          if firewall_file.file?
            File.read(firewall_file).each_line do |line|
Severity: Minor
Found in lib/vagrant-cloudstack/action/terminate_instance.rb - About 1 hr to fix

    Method remove_portforwarding has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

            def remove_portforwarding(env)
              env[:ui].info(I18n.t('vagrant_cloudstack.deleting_port_forwarding_rule'))
              port_forwarding_file = env[:machine].data_dir.join('port_forwarding')
              if port_forwarding_file.file?
                File.read(port_forwarding_file).each_line do |line|
    Severity: Minor
    Found in lib/vagrant-cloudstack/action/terminate_instance.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 remove_security_groups has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def remove_security_groups(env)
              security_groups_file = env[:machine].data_dir.join('security_groups')
              if security_groups_file.file?
                File.read(security_groups_file).each_line do |line|
                  security_group_id = line.strip
    Severity: Minor
    Found in lib/vagrant-cloudstack/action/terminate_instance.rb - About 1 hr to fix

      Method remove_security_groups has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def remove_security_groups(env)
                security_groups_file = env[:machine].data_dir.join('security_groups')
                if security_groups_file.file?
                  File.read(security_groups_file).each_line do |line|
                    security_group_id = line.strip
      Severity: Minor
      Found in lib/vagrant-cloudstack/action/terminate_instance.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 wait_for_job_ready has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def wait_for_job_ready(env, job_id, message=nil)
                while true
                  response = env[:cloudstack_compute].query_async_job_result({:jobid => job_id})
                  if response['queryasyncjobresultresponse']['jobstatus'] != 0
                    break
      Severity: Minor
      Found in lib/vagrant-cloudstack/action/terminate_instance.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 remove_generated_ssh_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def remove_generated_ssh_key(env)
                sshkeyname_file = env[:machine].data_dir.join('sshkeyname')
                if sshkeyname_file.file?
                  env[:ui].info(I18n.t('vagrant_cloudstack.ssh_key_pair_removing'))
                  sshkeyname = ''
      Severity: Minor
      Found in lib/vagrant-cloudstack/action/terminate_instance.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