fog/fog-proxmox

View on GitHub

Showing 60 of 60 total issues

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

      class Server < Fog::Compute::Server
        identity  :vmid
        attribute :type
        attribute :node_id
        attribute :config
Severity: Minor
Found in lib/fog/proxmox/compute/models/server.rb - About 3 hrs to fix

    Method list_servers has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def list_servers(_options = {})
              if options[:type] == 'qemu'
                [
                  {
                    'vmid' => '100',
    Severity: Major
    Found in lib/fog/proxmox/compute/requests/list_servers.rb - About 2 hrs to fix

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

            def self.flatten(disk)
              id = disk[:id]
              value = ''
              if disk[:volid]
                value += disk[:volid]
      Severity: Minor
      Found in lib/fog/proxmox/helpers/disk_helper.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 request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def request(params)
              retried = false
              begin
                authenticate! if expired?
                request_options = params.merge(path: "#{@path}/#{params[:path]}",
      Severity: Minor
      Found in lib/fog/proxmox/core.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 start_console has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

              def start_console(options = {})
                unless ready?
                  raise ::Fog::Proxmox::Errors::ServiceError,
                        'Unable to start console because server not running.'
                end
      Severity: Minor
      Found in lib/fog/proxmox/compute/models/server.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 start_console has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def start_console(options = {})
                unless ready?
                  raise ::Fog::Proxmox::Errors::ServiceError,
                        'Unable to start console because server not running.'
                end
      Severity: Minor
      Found in lib/fog/proxmox/compute/models/server.rb - About 1 hr to fix

        Method request has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def request(params)
                retried = false
                begin
                  authenticate! if expired?
                  request_options = params.merge(path: "#{@path}/#{params[:path]}",
        Severity: Minor
        Found in lib/fog/proxmox/core.rb - About 1 hr to fix

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

                def self.extract_storage_volid_size(disk_value)
                  # volid definition: <VOLUME_ID>:=<STORAGE_ID>:<storage type dependent volume name>
                  values_a = disk_value.scan(%r{^(([\w-]+):{0,1}([\w/.-]+))})
                  no_cdrom = !disk_value.match(CDROM_REGEXP)
                  creation = disk_value.split(',')[0].match(/^(([\w-]+):{1}(\d+))$/)
          Severity: Minor
          Found in lib/fog/proxmox/helpers/disk_helper.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 setup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def setup(options)
                  if options.respond_to?(:config_service?) && options.config_service?
                    configure(options)
                    return
                  end
          Severity: Minor
          Found in lib/fog/proxmox/core.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 flatten has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.flatten(cpu_h)
                  return '' unless cpu_h['cpu_type']
          
                  cpu_type = "cputype=#{cpu_h['cpu_type']}"
                  num_flags = 0
          Severity: Minor
          Found in lib/fog/proxmox/helpers/cpu_helper.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

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

            module Proxmox
              class Compute
                # class Real template_server request
                class Real
                  def template_server(path_params, body_params)
          Severity: Major
          Found in lib/fog/proxmox/compute/requests/template_server.rb and 5 other locations - About 50 mins to fix
          lib/fog/proxmox/compute/requests/clone_server.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_spice.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_term.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_vnc.rb on lines 21..40
          lib/fog/proxmox/compute/requests/migrate_server.rb on lines 21..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 43.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

            module Proxmox
              class Compute
                # class Real clone_server request
                class Real
                  def clone_server(path_params, body_params)
          Severity: Major
          Found in lib/fog/proxmox/compute/requests/clone_server.rb and 5 other locations - About 50 mins to fix
          lib/fog/proxmox/compute/requests/create_spice.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_term.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_vnc.rb on lines 21..40
          lib/fog/proxmox/compute/requests/migrate_server.rb on lines 21..40
          lib/fog/proxmox/compute/requests/template_server.rb on lines 21..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 43.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                class Real
                  def action_server(path_params, body_params)
                    node = path_params[:node]
                    type = path_params[:type]
                    action = path_params[:action]
          Severity: Minor
          Found in lib/fog/proxmox/compute/requests/action_server.rb and 1 other location - About 50 mins to fix
          lib/fog/proxmox/compute/requests/delete_snapshot.rb on lines 24..35

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 43.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

            module Proxmox
              class Compute
                # class Real create_vnc request
                class Real
                  def create_vnc(path_params, body_params)
          Severity: Major
          Found in lib/fog/proxmox/compute/requests/create_vnc.rb and 5 other locations - About 50 mins to fix
          lib/fog/proxmox/compute/requests/clone_server.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_spice.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_term.rb on lines 21..40
          lib/fog/proxmox/compute/requests/migrate_server.rb on lines 21..40
          lib/fog/proxmox/compute/requests/template_server.rb on lines 21..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 43.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                class Real
                  def delete_snapshot(path_params, query_params)
                    node = path_params[:node]
                    type = path_params[:type]
                    vmid = path_params[:vmid]
          Severity: Minor
          Found in lib/fog/proxmox/compute/requests/delete_snapshot.rb and 1 other location - About 50 mins to fix
          lib/fog/proxmox/compute/requests/action_server.rb on lines 24..35

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 43.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

            module Proxmox
              class Compute
                # class Real migrate_server request
                class Real
                  def migrate_server(path_params, body_params)
          Severity: Major
          Found in lib/fog/proxmox/compute/requests/migrate_server.rb and 5 other locations - About 50 mins to fix
          lib/fog/proxmox/compute/requests/clone_server.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_spice.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_term.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_vnc.rb on lines 21..40
          lib/fog/proxmox/compute/requests/template_server.rb on lines 21..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 43.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

            module Proxmox
              class Compute
                # class Real create_term request
                class Real
                  def create_term(path_params, body_params)
          Severity: Major
          Found in lib/fog/proxmox/compute/requests/create_term.rb and 5 other locations - About 50 mins to fix
          lib/fog/proxmox/compute/requests/clone_server.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_spice.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_vnc.rb on lines 21..40
          lib/fog/proxmox/compute/requests/migrate_server.rb on lines 21..40
          lib/fog/proxmox/compute/requests/template_server.rb on lines 21..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 43.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

            module Proxmox
              class Compute
                # class Real create_spice request
                class Real
                  def create_spice(path_params, body_params)
          Severity: Major
          Found in lib/fog/proxmox/compute/requests/create_spice.rb and 5 other locations - About 50 mins to fix
          lib/fog/proxmox/compute/requests/clone_server.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_term.rb on lines 21..40
          lib/fog/proxmox/compute/requests/create_vnc.rb on lines 21..40
          lib/fog/proxmox/compute/requests/migrate_server.rb on lines 21..40
          lib/fog/proxmox/compute/requests/template_server.rb on lines 21..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 43.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                class Mock
                  attr_reader :config
          
                  def initialize(options = {})
                    @proxmox_uri = URI.parse(options[:proxmox_url])
          Severity: Major
          Found in lib/fog/proxmox/identity.rb and 2 other locations - About 50 mins to fix
          lib/fog/proxmox/compute.rb on lines 99..111
          lib/fog/proxmox/network.rb on lines 48..60

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 42.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                class Mock
                  attr_reader :config
          
                  def initialize(options = {})
                    @proxmox_uri = URI.parse(options[:proxmox_url])
          Severity: Major
          Found in lib/fog/proxmox/network.rb and 2 other locations - About 50 mins to fix
          lib/fog/proxmox/compute.rb on lines 99..111
          lib/fog/proxmox/identity.rb on lines 102..114

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 42.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language