bundler/bundler-api

View on GitHub

Showing 11 of 11 total issues

Method run has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    return if @db_helper.exists?(@payload) && !@fix_deps
    return if !@db_helper.exists?(@payload) && @fix_deps
    log "Adding: #{@payload.full_name}\n"

Severity: Minor
Found in lib/bundler_api/update/job.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 deps_for has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def deps_for(gem_name)
    dataset = @conn[<<-SQL, gem_name]
      SELECT rv.name, rv.number, rv.platform, rv.required_ruby_version, rv.checksum,
             rv.rubygems_version, d.requirements, rv.created_at, for_dep_name.name dep_name
      FROM
Severity: Minor
Found in lib/bundler_api/gem_info.rb - About 1 hr to fix

    Method find_or_insert_version has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def find_or_insert_version(spec, rubygem_id, platform = 'ruby', checksum = nil, indexed = nil)
        insert     = nil
        version_id = nil
        version    = @db[:versions].filter(
          rubygem_id: rubygem_id,
    Severity: Minor
    Found in lib/bundler_api/update/gem_db_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 find_or_insert_version has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def find_or_insert_version(spec, rubygem_id, platform = 'ruby', checksum = nil, indexed = nil)
        insert     = nil
        version_id = nil
        version    = @db[:versions].filter(
          rubygem_id: rubygem_id,
    Severity: Minor
    Found in lib/bundler_api/update/gem_db_helper.rb - About 1 hr to fix

      Method versions has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def versions(date,include_yanks = false)
          dataset = if include_yanks
            @conn[<<-SQL, date,date]
                  (SELECT r.name, v.created_at as date, v.info_checksum, v.number, v.platform
                  FROM rubygems AS r, versions AS v
      Severity: Minor
      Found in lib/bundler_api/gem_info.rb - About 1 hr to fix

        Method insert_dependencies has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def insert_dependencies(spec, version_id)
            deps_added = []
        
            spec.dependencies.each do |dep|
              rubygem_name = nil
        Severity: Minor
        Found in lib/bundler_api/update/gem_db_helper.rb - About 1 hr to fix

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

            def insert_dependencies(spec, version_id)
              deps_added = []
          
              spec.dependencies.each do |dep|
                rubygem_name = nil
          Severity: Minor
          Found in lib/bundler_api/update/gem_db_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 fetch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def fetch(url, redirects = 0, tries = [])
              raise BundlerApi::HTTPError, "Too many redirects #{url}" if redirects >= REDIRECT_LIMIT
              raise BundlerApi::HTTPError, "Could not download #{url} (#{tries.join(", ")})" if tries.size >= TRY_LIMIT
          
              uri = URI.parse(url)
          Severity: Minor
          Found in lib/bundler_api/gem_helper.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize(user, token, worker_index = nil)
                return unless user && token
          
                opts = {
                  on_error: error_handler,
          Severity: Minor
          Found in lib/bundler_api/metriks.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 find_or_insert_version has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def find_or_insert_version(spec, rubygem_id, platform = 'ruby', checksum = nil, indexed = nil)
          Severity: Minor
          Found in lib/bundler_api/update/gem_db_helper.rb - About 35 mins to fix

            Method get_payload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def get_payload
                params = JSON.parse(request.body.read)
                log "webhook request: #{params.inspect}"
            
                if @rubygems_token && (params["rubygems_token"] != @rubygems_token)
            Severity: Minor
            Found in lib/bundler_api/web.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

            Severity
            Category
            Status
            Source
            Language