audiolize/vagrant-softlayer

View on GitHub

Showing 21 of 31 total issues

Method finalize! has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

      def finalize!
        # Try to get username and api key from environment variables.
        # They will default to nil if the environment variables are not present.
        @api_key  = ENV["SL_API_KEY"] if @api_key == UNSET_VALUE
        @username = ENV["SL_USERNAME"] if @username == UNSET_VALUE
Severity: Minor
Found in lib/vagrant-softlayer/config.rb - About 3 hrs 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 action_up has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

      def self.action_up
        Vagrant::Action::Builder.new.tap do |b|
          if defined?(HandleBox)
            b.use HandleBox
          else
Severity: Minor
Found in lib/vagrant-softlayer/action.rb - About 3 hrs 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 call has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

        def call(env)
          @app.call(env)

          ssh_info = env[:machine].ssh_info

Severity: Minor
Found in lib/vagrant-softlayer/action/sync_folders.rb - About 2 hrs 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 action_rebuild has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def self.action_rebuild
        Vagrant::Action::Builder.new.tap do |b|
          b.use Call, Confirm, I18n.t("vagrant_softlayer.vm.rebuild_confirmation"), :force_rebuild do |env, b2|
            if env[:result]
              b2.use ConfigValidate
Severity: Minor
Found in lib/vagrant-softlayer/action.rb - About 2 hrs 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 validate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def validate(machine)
        errors = []

        errors << I18n.t("vagrant_softlayer.config.api_key_required") if !@api_key
        errors << I18n.t("vagrant_softlayer.config.username_required") if !@username
Severity: Minor
Found in lib/vagrant-softlayer/config.rb - About 2 hrs 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 call has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def call(env)
          @app.call(env)

          ssh_info = env[:machine].ssh_info

Severity: Major
Found in lib/vagrant-softlayer/action/sync_folders.rb - About 2 hrs to fix

    Method sl_warden has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

            def sl_warden(rescue_proc = nil, retry_interval = 0, &block)
              begin
                yield
              rescue ::OpenSSL::SSL::SSLError
                raise Errors::SLCertificateError
    Severity: Minor
    Found in lib/vagrant-softlayer/util/warden.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 action_up has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.action_up
            Vagrant::Action::Builder.new.tap do |b|
              if defined?(HandleBox)
                b.use HandleBox
              else
    Severity: Minor
    Found in lib/vagrant-softlayer/action.rb - About 1 hr to fix

      Method initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def initialize
              @api_key      = UNSET_VALUE
              @api_timeout  = UNSET_VALUE
              @endpoint_url = UNSET_VALUE
              @username     = UNSET_VALUE
      Severity: Minor
      Found in lib/vagrant-softlayer/config.rb - About 1 hr to fix

        Method get_vlan_id has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def get_vlan_id(vlan_name, vlan_space)
                  return vlan_name unless vlan_name.kind_of?(String)
        
                  routers = @env[:sl_client]["SoftLayer_Account"].object_mask("mask[routers,routers.datacenter,routers.networkVlans,routers.networkVlans.networkSpace,routers.networkVlans.type]").getObject["routers"]
        
        
        Severity: Minor
        Found in lib/vagrant-softlayer/action/create_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 action_destroy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.action_destroy
                Vagrant::Action::Builder.new.tap do |b|
                  b.use Call, DestroyConfirm do |env, b2|
                    if env[:result]
                      b2.use ConfigValidate
        Severity: Minor
        Found in lib/vagrant-softlayer/action.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 finalize! has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def finalize!
                # Try to get username and api key from environment variables.
                # They will default to nil if the environment variables are not present.
                @api_key  = ENV["SL_API_KEY"] if @api_key == UNSET_VALUE
                @username = ENV["SL_USERNAME"] if @username == UNSET_VALUE
        Severity: Minor
        Found in lib/vagrant-softlayer/config.rb - About 1 hr to fix

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

                  def call(env)
                    env[:ui].info I18n.t("vagrant_softlayer.vm.wait_for_provision")
          
                    env[:sl_machine] = env[:sl_client]["SoftLayer_Virtual_Guest"].object_with_id(env[:machine].id.to_i)
                    
          Severity: Minor
          Found in lib/vagrant-softlayer/action/wait_for_provision.rb - About 55 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 call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                  def call(env)
                    env[:ui].info I18n.t("vagrant_softlayer.vm.wait_for_rebuild")
          
                    #Rechecks every 10 sec
                    virtual_server = ::SoftLayer::VirtualServer.server_with_id(env[:machine].id.to_i, :client => env[:sl_client])
          Severity: Minor
          Found in lib/vagrant-softlayer/action/wait_for_rebuild.rb - About 55 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 action_provision has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.action_provision
                  Vagrant::Action::Builder.new.tap do |b|
                    b.use ConfigValidate
                    b.use Call, Is, :running do |env, b2|
                      if !env[:result]
          Severity: Minor
          Found in lib/vagrant-softlayer/action.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 update_dns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def update_dns
                    unless @env[:machine].provider_config.manage_dns
                      @logger.debug("Not managing DNS. Going ahead.")
                      return
                    end
          Severity: Minor
          Found in lib/vagrant-softlayer/action/update_dns.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 order_template has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def order_template
                    template = {
                      "dedicatedAccountHostOnlyFlag" => @env[:machine].provider_config.dedicated,
                      "domain"                       => @env[:machine].provider_config.domain,
                      "hostname"                     => get_hostname,
          Severity: Minor
          Found in lib/vagrant-softlayer/action/create_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 ssh_keys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def ssh_keys(env, ids_only = false)
                    account  = env[:sl_client]["SoftLayer_Account"]
                    acc_keys = sl_warden { account.object_mask("mask[id,label]").getSshKeys }
                    key_ids  = []
                    Array(env[:machine].provider_config.ssh_key).each do |key|
          Severity: Minor
          Found in lib/vagrant-softlayer/util/network.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 rebalance! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def rebalance!
                    read_load_balancers
                    
                    @load_balancers.each do |load_balancer|
                      next if load_balancer["virtualServers"].empty?
          Severity: Minor
          Found in lib/vagrant-softlayer/util/load_balancer.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 read_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def read_state(env)
                    return :not_created unless env[:sl_machine]
          
                    wipe_id = lambda do
                      @logger.info("Machine not found, assuming it got destroyed.")
          Severity: Minor
          Found in lib/vagrant-softlayer/action/read_state.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