cvengros/salesforce_bulk_query

View on GitHub

Showing 14 of 14 total issues

Method query has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def query(sobject, soql, options={})
      @logger.info "Running query: #{soql}. Gem version salesforce_bulk_query: #{SalesforceBulkQuery::VERSION}" if @logger
      check_interval = options[:check_interval] || CHECK_INTERVAL
      time_limit = options[:time_limit] # in seconds

Severity: Minor
Found in lib/salesforce_bulk_query.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 get_available_results has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def get_available_results(options={})

      unfinished_subqueries = []
      jobs_in_progress = []
      jobs_restarted = []
Severity: Minor
Found in lib/salesforce_bulk_query/query.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 get_available_results has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def get_available_results(options={})

      unfinished_subqueries = []
      jobs_in_progress = []
      jobs_restarted = []
Severity: Major
Found in lib/salesforce_bulk_query/query.rb - About 2 hrs to fix

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

        def get_available_results(options={})
          downloaded_filenames = []
          unfinished_batches = []
          verification_fail_batches = []
          failed_batches = []
    Severity: Minor
    Found in lib/salesforce_bulk_query/job.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 get_available_results has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def get_available_results(options={})
          downloaded_filenames = []
          unfinished_batches = []
          verification_fail_batches = []
          failed_batches = []
    Severity: Minor
    Found in lib/salesforce_bulk_query/job.rb - About 1 hr to fix

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

          def with_retries
            i = 0
            begin
              yield
            rescue => e
      Severity: Minor
      Found in lib/salesforce_bulk_query/connection.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 has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def start(options={})
            # order by and where not allowed
            if (!@single_batch) && (@soql =~ / WHERE /i || @soql =~ /ORDER BY/i)
              raise "You can't have WHERE or ORDER BY in your soql. If you want to download just specific date range use date_from / date_to"
            end
      Severity: Minor
      Found in lib/salesforce_bulk_query/query.rb - About 1 hr to fix

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

            def check_status
              succeeded = nil
              failed = nil
        
              # get the status of the batch
        Severity: Minor
        Found in lib/salesforce_bulk_query/batch.rb - About 1 hr to fix

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

              def get_to_file(path, filename)
                path = "#{@@PATH_PREFIX}#{path}"
                uri = URI.parse( @client.options[:instance_url])
                # open a file
                http = Net::HTTP.new(uri.host, uri.port)
          Severity: Minor
          Found in lib/salesforce_bulk_query/connection.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 query has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def query(sobject, soql, options={})
                @logger.info "Running query: #{soql}. Gem version salesforce_bulk_query: #{SalesforceBulkQuery::VERSION}" if @logger
                check_interval = options[:check_interval] || CHECK_INTERVAL
                time_limit = options[:time_limit] # in seconds
          
          
          Severity: Minor
          Found in lib/salesforce_bulk_query.rb - About 1 hr to fix

            Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def initialize(client, api_version, logger=nil, filename_prefix=nil, ssl_version = nil, force_encoding = false)
            Severity: Minor
            Found in lib/salesforce_bulk_query/connection.rb - About 45 mins to fix

              Method start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def start(options={})
                    # order by and where not allowed
                    if (!@single_batch) && (@soql =~ / WHERE /i || @soql =~ /ORDER BY/i)
                      raise "You can't have WHERE or ORDER BY in your soql. If you want to download just specific date range use date_from / date_to"
                    end
              Severity: Minor
              Found in lib/salesforce_bulk_query/query.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 post_xml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def post_xml(path, xml, options={})
                    path = "#{@@PATH_PREFIX}#{path}"
                    headers = options[:csv_content_type] ? CSV_REQUEST_HEADER : XML_REQUEST_HEADER
              
                    response = nil
              Severity: Minor
              Found in lib/salesforce_bulk_query/connection.rb - About 35 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 get_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_result(options={})
                    # if it was already downloaded, no one should ask about it
                    if @filename
                      raise "This batch was already downloaded once: #{@filename}, #{@batch_id}"
                    end
              Severity: Minor
              Found in lib/salesforce_bulk_query/batch.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