EGI-FCTF/oneacct_export

View on GitHub

Showing 29 of 29 total issues

Method process_vm has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def process_vm(vm, user_map, image_map, cluster_map, benchmark_map)
Severity: Minor
Found in lib/one_worker.rb - About 35 mins to fix

    Avoid too many return statements within this method.
    Open

          return false if groups[:exclude] && groups[:exclude].include?(vm['GNAME'])
    Severity: Major
    Found in lib/one_data_accessor.rb - About 30 mins to fix

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

        def initialize(data, file_number, log = Logger.new(STDOUT))
          fail ArgumentError, 'Data and file number cannot be nil' if data.nil? || file_number.nil?
      
          output_type = Settings.output['output_type']
          @template = OneWriter.template_filename(output_type) if Settings['output']
      Severity: Minor
      Found in lib/one_writer.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 set_defaults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.set_defaults(options)
          options.blocking = BLOCKING_DEFAULT unless options.blocking
          options.timeout = TIMEOUT_DEFAULT if options.blocking unless options.timeout
          options.compatibility = COMPATIBILITY_DEFAULT unless options.compatibility
        end
      Severity: Minor
      Found in lib/oneacct_opts.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 mapping has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def mapping(pool_class, xpath)
          @log.debug("Generating mapping for class: #{pool_class} and xpath: '#{xpath}'.")
          pool = pool_class.new(@client)
          # call info_all method instead of info on pools that support it
          if pool.respond_to? 'info_all'
      Severity: Minor
      Found in lib/one_data_accessor.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 initialize_client has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def initialize_client
          secret = Settings['xml_rpc'] ? Settings.xml_rpc['secret'] : nil
          endpoint = Settings['xml_rpc'] ? Settings.xml_rpc['endpoint'] : nil
          fail ArgumentError, "#{endpoint} is not a valid URL." if endpoint && !uri?(endpoint)
      
      
      Severity: Minor
      Found in lib/one_data_accessor.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 benchmark_map has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def benchmark_map
          map = Hash.new({})
          host_pool = OpenNebula::HostPool.new(@client)
          rc = host_pool.info
          check_retval(rc, Errors::ResourceRetrievalError)
      Severity: Minor
      Found in lib/one_data_accessor.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 check_settings_restrictions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.check_settings_restrictions
          # make sure all mandatory parameters are set
          unless Settings['output'] && Settings.output['output_dir'] && Settings.output['output_type']
            fail ArgumentError, 'Missing some mandatory parameters. Check your configuration file.'
          end
      Severity: Minor
      Found in lib/oneacct_opts.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def initialize(compatibility, log = nil)
          @log = log ? log : Logger.new(STDOUT)
          @compatibility = compatibility
      
          @batch_size = Settings.output['num_of_vms_per_file'] ? Settings.output['num_of_vms_per_file'] : 500
      Severity: Minor
      Found in lib/one_data_accessor.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