geminabox/geminabox

View on GitHub

Showing 71 of 105 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 310 lines of code (exceeds 250 allowed). Consider refactoring.
    Confirmed

    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.
      Confirmed

          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

      Line length
      Open

          # Use Rack::Protection to prevent XSS and CSRF vulnerability if your geminabox server is open public.
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Code block style
      Confirmed

          Usage: gem inabox GEM [options]
      Severity: Info
      Found in README.md by markdownlint

      Final newline missing.
      Open

      end
      Severity: Minor
      Found in lib/geminabox/http_adapter.rb by rubocop

      Unordered list indentation
      Confirmed

         - `git clone https://github.com/geminabox/geminabox.git` or
      Severity: Info
      Found in CONTRIBUTING.md by markdownlint

      MD007 - Unordered list indentation

      Tags: bullet, ul, indentation

      Aliases: ul-indent

      Parameters: indent (number; default 2)

      This rule is triggered when list items are not indented by the configured number of spaces (default: 2).

      Example:

      * List item
         * Nested list item indented by 3 spaces

      Corrected Example:

      * List item
        * Nested list item indented by 2 spaces

      Rationale (2 space indent): indenting by 2 spaces allows the content of a nested list to be in line with the start of the content of the parent list when a single space is used after the list marker.

      Rationale (4 space indent): Same indent as code blocks, simpler for editors to implement. See http://www.cirosantilli.com/markdown-styleguide/#indented-lists for more information.

      In addition, this is a compatibility issue with multi-markdown parsers, which require a 4 space indents. See http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting for a description of the problem.

      Code block style
      Confirmed

          Geminabox.rubygems_proxy = true
      Severity: Info
      Found in README.md by markdownlint

      Pass array contents as separate arguments.
      Open

          data:                           File.join(File.dirname(__FILE__), *%w[.. data]),
      Severity: Minor
      Found in lib/geminabox.rb by rubocop

      This cop checks for unneeded usages of splat expansion

      Example:

      # bad
      
      a = *[1, 2, 3]
      a = *'a'
      a = *1
      
      begin
        foo
      rescue *[StandardError, ApplicationError]
        bar
      end
      
      case foo
      when *[1, 2, 3]
        bar
      else
        baz
      end

      Example:

      # good
      
      c = [1, 2, 3]
      a = *c
      a, b = *c
      a, *b = *c
      a = *1..10
      a = ['a']
      
      begin
        foo
      rescue StandardError, ApplicationError
        bar
      end
      
      case foo
      when *[1, 2, 3]
        bar
      else
        baz
      end

      Bare URL used
      Confirmed

      - https://github.com/geminabox/geminabox/releases/tag/v1.0.1
      Severity: Info
      Found in CHANGELOG.md by markdownlint

      MD034 - Bare URL used

      Tags: links, url

      Aliases: no-bare-urls

      This rule is triggered whenever a URL is given that isn't surrounded by angle brackets:

      For more information, see http://www.example.com/.

      To fix this, add angle brackets around the URL:

      For more information, see <http:></http:>.

      Rationale: Without angle brackets, the URL isn't converted into a link in many markdown parsers.

      Note: if you do want a bare URL without it being converted into a link, enclose it in a code block, otherwise in some markdown parsers it will be converted:

      `http://www.example.com`

      Pass array contents as separate arguments.
      Open

          views:                          File.join(File.dirname(__FILE__), *%w[.. views]),
      Severity: Minor
      Found in lib/geminabox.rb by rubocop

      This cop checks for unneeded usages of splat expansion

      Example:

      # bad
      
      a = *[1, 2, 3]
      a = *'a'
      a = *1
      
      begin
        foo
      rescue *[StandardError, ApplicationError]
        bar
      end
      
      case foo
      when *[1, 2, 3]
        bar
      else
        baz
      end

      Example:

      # good
      
      c = [1, 2, 3]
      a = *c
      a, b = *c
      a, *b = *c
      a = *1..10
      a = ['a']
      
      begin
        foo
      rescue StandardError, ApplicationError
        bar
      end
      
      case foo
      when *[1, 2, 3]
        bar
      else
        baz
      end

      Line length
      Open

      Using Gem in a Box is really simple with the Dockerfile.  Move this Dockerfile into a directory that you want to use for your server.
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Code block style
      Confirmed

          gem inabox -g HOST
      Severity: Info
      Found in README.md by markdownlint

      Do not suppress exceptions.
      Open

            rescue Gem::SystemExitException
      Severity: Minor
      Found in lib/geminabox/server.rb by rubocop

      This cop checks for rescue blocks with no body.

      Example:

      # bad
      
      def some_method
        do_something
      rescue
        # do nothing
      end

      Example:

      # bad
      
      begin
        do_something
      rescue
        # do nothing
      end

      Example:

      # good
      
      def some_method
        do_something
      rescue
        handle_exception
      end

      Example:

      # good
      
      begin
        do_something
      rescue
        handle_exception
      end

      Redundant curly braces around a hash parameter.
      Open

          response = http_client.post(url_for(:upload), { 'file' => File.open(gemfile, "rb"), 'overwrite' => !!options[:overwrite] }, { 'Accept' => 'text/plain' })
      Severity: Minor
      Found in lib/geminabox_client.rb by rubocop

      This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

      Example: EnforcedStyle: braces

      # The `braces` style enforces braces around all method
      # parameters that are hashes.
      
      # bad
      some_method(x, y, a: 1, b: 2)
      
      # good
      some_method(x, y, {a: 1, b: 2})

      Example: EnforcedStyle: no_braces (default)

      # The `no_braces` style checks that the last parameter doesn't
      # have braces around it.
      
      # bad
      some_method(x, y, {a: 1, b: 2})
      
      # good
      some_method(x, y, a: 1, b: 2)

      Example: EnforcedStyle: context_dependent

      # The `context_dependent` style checks that the last parameter
      # doesn't have braces around it, but requires braces if the
      # second to last parameter is also a hash literal.
      
      # bad
      some_method(x, y, {a: 1, b: 2})
      some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
      
      # good
      some_method(x, y, a: 1, b: 2)
      some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

      module definition in method body
      Open

          module CombineLocalAndRemoteGemVersions
      Severity: Minor
      Found in lib/geminabox/gem_list_merge.rb by rubymotion

      Bare URL used
      Confirmed

      - https://github.com/geminabox/geminabox/releases/tag/v1.1.1
      Severity: Info
      Found in CHANGELOG.md by markdownlint

      MD034 - Bare URL used

      Tags: links, url

      Aliases: no-bare-urls

      This rule is triggered whenever a URL is given that isn't surrounded by angle brackets:

      For more information, see http://www.example.com/.

      To fix this, add angle brackets around the URL:

      For more information, see <http:></http:>.

      Rationale: Without angle brackets, the URL isn't converted into a link in many markdown parsers.

      Note: if you do want a bare URL without it being converted into a link, enclose it in a code block, otherwise in some markdown parsers it will be converted:

      `http://www.example.com`

      Line length
      Open

          # Rack::Protection requires a session middleware, choose your favorite one such as Rack::Session::Memcache.
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Line length
      Open

      Start your gem server with 'rackup' to run WEBrick or hook up the config.ru as you normally would ([passenger](https://www.phusionpassenger.com/), [thin](http://code.macournoyer.com/thin/), [unicorn](https://bogomips.org/unicorn/), whatever floats your boat).
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Severity
      Category
      Status
      Source
      Language