geminabox/geminabox

View on GitHub

Showing 5 of 5 total issues

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

  class Server < Sinatra::Base
    enable :static, :methodoverride
    set :public_folder, Geminabox.public_folder
    set :views, Geminabox.views

Severity: Minor
Found in lib/geminabox/server.rb - About 4 hrs to fix

    File server.rb has 311 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'reentrant_flock'
    require 'rubygems/util'
    
    module Geminabox
    
    
    Severity: Minor
    Found in lib/geminabox/server.rb - About 3 hrs to fix

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

            def reindex(force_rebuild = false)
              fixup_bundler_rubygems!
              force_rebuild = true unless Geminabox.incremental_updates
              if force_rebuild
                indexer.generate_index
      Severity: Minor
      Found in lib/geminabox/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 <=> has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def <=>(other)
            sort = other.name <=> name
            sort = version <=>  other.version       if sort.zero?
            sort = (other.ruby? && !ruby?) ? 1 : -1 if sort.zero? && ruby? != other.ruby?
            sort = other.platform <=> platform      if sort.zero?
      Severity: Minor
      Found in lib/geminabox/gem_version.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 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(gem_data, root_path = Geminabox.data)
            unless gem_data.respond_to? :read
              raise ArgumentError, "Expected an instance of IO"
            end
      
      
      Severity: Minor
      Found in lib/geminabox/incoming_gem.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