the-oneacct-export-project/oneacct-export

View on GitHub

Showing 29 of 29 total issues

Method validate_data has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_data(data = nil)
      unless data
        fail Errors::ValidationError, 'Skipping a malformed record. '\
          'No data available to validate'
      end
Severity: Minor
Found in lib/data_validators/logstash_data_validator.rb - About 6 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_data has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_data(data = nil)
      unless data
        fail Errors::ValidationError, 'Skipping a malformed record. '\
          'No data available to validate'
      end
Severity: Minor
Found in lib/data_validators/pbs_data_validator.rb - About 4 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_data has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_data(data = nil)
      unless data
        fail Errors::ValidationError, 'Skipping a malformed record. '\
          'No data available to validate'
      end
Severity: Minor
Found in lib/data_validators/apel_data_validator.rb - About 4 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 parse has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.parse(args)
    options = OpenStruct.new

    opt_parser = OptionParser.new do |opts|
      opts.banner = 'Usage oneacct-export [options]'
Severity: Major
Found in lib/oneacct_opts.rb - About 2 hrs to fix

    Method perform has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def perform(vms, file_number)
        OneacctExporter::Log.setup_log_level(logger)
    
        vms = vms.split('|')
    
    
    Severity: Minor
    Found in lib/one_worker.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 want? has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def want?(vm, range, groups)
        if vm.nil?
          @log.warn('Obtained nil vm from vm pool.')
          return false
        end
    Severity: Minor
    Found in lib/one_data_accessor.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 default has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def default(value, condition_method, default_value)
          return string?(value) ? value : default_value if condition_method == :string
          return number?(value) ? value : default_value if condition_method == :number
          return decimal?(value) ? value : default_value if condition_method == :decimal
          return non_zero_number?(value) ? value : default_value if condition_method == :nzn
    Severity: Minor
    Found in lib/data_validators/data_validator_helper.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_data has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def validate_data(data = nil)
          unless data
            fail Errors::ValidationError, 'Skipping a malformed record. '\
              'No data available to validate'
          end
    Severity: Major
    Found in lib/data_validators/logstash_data_validator.rb - About 2 hrs to fix

      Method validate_data has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def validate_data(data = nil)
            unless data
              fail Errors::ValidationError, 'Skipping a malformed record. '\
                'No data available to validate'
            end
      Severity: Minor
      Found in lib/data_validators/apel_data_validator.rb - About 1 hr to fix

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

            def sum_rstime(history_records, completed, vm_id)
              return nil unless history_records
        
              rstime = 0
        
        
        Severity: Minor
        Found in lib/data_validators/data_compute.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 check_output_type_specific_settings has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.check_output_type_specific_settings
            if APEL_OT.include?(Settings.output['output_type'])
              unless Settings.output['apel'] && Settings.output.apel['site_name'] &&
                  Settings.output.apel['cloud_type'] && Settings.output.apel['endpoint']
                fail ArgumentError, 'Missing some mandatory parameters for APEL output type. Check your configuration file.'
        Severity: Minor
        Found in lib/oneacct_opts.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 load_vm_pool has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def load_vm_pool
            @log.debug("Loading vm pool from id: #{start_vm_id}.")
            from = @start_vm_id
            how_many = @batch_size
            to = from + how_many - 1
        Severity: Minor
        Found in lib/one_data_accessor.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 validate_data has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def validate_data(data = nil)
              unless data
                fail Errors::ValidationError, 'Skipping a malformed record. '\
                  'No data available to validate'
              end
        Severity: Minor
        Found in lib/data_validators/pbs_data_validator.rb - About 1 hr to fix

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

            def self.check_options_restrictions(options)
              # make sure only one time option is used
              if (options.records_from || options.records_to) && options.records_for
                fail ArgumentError, 'Cannot use both time period and time range options.'
              end
          Severity: Minor
          Found in lib/oneacct_opts.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 process_vm has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def process_vm(vm, user_map, image_map, cluster_map, benchmark_map)
              data = common_data
              data.merge! output_type_specific_data
          
              data['vm_uuid'] = vm['ID']
          Severity: Minor
          Found in lib/one_worker.rb - About 1 hr to fix

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

              def perform(vms, file_number)
                OneacctExporter::Log.setup_log_level(logger)
            
                vms = vms.split('|')
            
            
            Severity: Minor
            Found in lib/one_worker.rb - About 1 hr to fix

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

                def vms(range, groups)
                  vms = []
                  # load specific batch
                  vm_pool = load_vm_pool
                  return nil if vm_pool.count == 0
              Severity: Minor
              Found in lib/one_data_accessor.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 options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.options
                  options = {}
                  if Settings['redis']
                    options[:namespace] = Settings.redis['namespace']
                    options[:url] = Settings.redis['url']
              Severity: Minor
              Found in lib/redis_conf.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 export has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def export
                  @log.debug('Starting export...')
              
                  clean_output_dir
              
              
              Severity: Minor
              Found in lib/oneacct_exporter.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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.parse(args)
                  options = OpenStruct.new
              
                  opt_parser = OptionParser.new do |opts|
                    opts.banner = 'Usage oneacct-export [options]'
              Severity: Minor
              Found in lib/oneacct_opts.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

              Severity
              Category
              Status
              Source
              Language