MissionCriticalCloud/vagrant-cloudstack

View on GitHub

Showing 46 of 50 total issues

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

        def create_firewall_rule(rule)
          acl_name = ''
          firewall_rule = nil
          @env[:ui].info(I18n.t('vagrant_cloudstack.creating_firewall_rule'))

Severity: Minor
Found in lib/vagrant-cloudstack/action/run_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

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

        def wait_for_instance_ready
          @env[:metrics]['instance_ready_time'] = Util::Timer.time do
            tries = @domain_config.instance_ready_timeout / 2

            @env[:ui].info(I18n.t('vagrant_cloudstack.waiting_for_ready'))
Severity: Minor
Found in lib/vagrant-cloudstack/action/run_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

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

        def generate_and_apply_port_forwarding_rules_for_communicators
          communicators_port_names = [Hash[:public_port => 'pf_public_port', :private_port => 'pf_private_port']]
          communicators_port_names << Hash[:public_port => 'pf_public_rdp_port', :private_port => 'pf_private_rdp_port'] if is_windows_guest

          communicators_port_names.each do |communicator_port_names|
Severity: Minor
Found in lib/vagrant-cloudstack/action/run_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

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

        def resolve_network(cs_zone)
          if cs_zone.network_type.downcase == 'basic'
            # No network specification in basic zone
            @env[:ui].warn(I18n.t('vagrant_cloudstack.basic_network', :zone_name => @zone.name)) if !@networks.empty? && (@networks[0].id || @networks[0].name)
            @networks = [CloudstackResource.new(nil, nil, 'network')]
Severity: Minor
Found in lib/vagrant-cloudstack/action/run_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

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

        def evaluate_pf_private_port
          return unless @domain_config.pf_private_port.nil?

          communicator_short_name = get_communicator_short_name(@env[:machine].communicate)
          communicator_config = @env[:machine].config.send(communicator_short_name)
Severity: Minor
Found in lib/vagrant-cloudstack/action/run_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

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

Severity
Category
Status
Source
Language