geminabox/geminabox

View on GitHub

Showing 71 of 104 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

      Also, please note that this hook blocks `POST /upload` and `POST /api/v1/gems` APIs processing.
      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.

      Pass array contents as separate arguments.
      Open

          public_folder:                  File.join(File.dirname(__FILE__), *%w[.. public]),
      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

      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

      Multiple top level headers in the same document
      Confirmed

      # 1.4.2 - 1.5.0
      Severity: Info
      Found in CHANGELOG.md by markdownlint

      MD025 - Multiple top level headers in the same document

      Tags: headers

      Aliases: single-h1

      Parameters: level (number; default 1)

      This rule is triggered when a top level header is in use (the first line of the file is a h1 header), and more than one h1 header is in use in the document:

      # Top level header
      
      # Another top level header

      To fix, structure your document so that there is a single h1 header that is the title for the document, and all later headers are h2 or lower level headers:

      # Title
      
      ## Header
      
      ## Another header

      Rationale: A top level header is a h1 on the first line of the file, and serves as the title for the document. If this convention is in use, then there can not be more than one title for the document, and the entire document should be contained within this header.

      Note: The level parameter can be used to change the top level (ex: to h2) in cases where an h1 is added externally.

      Bare URL used
      Confirmed

      - https://github.com/geminabox/geminabox/releases/tag/v1.3.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`

      Bare URL used
      Confirmed

      - https://github.com/geminabox/geminabox/releases/tag/v1.3.0
      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

      Use RubyGems the latest version (at least 2.5.2) for as an end-user full features like [`gem yank --host`](https://github.com/rubygems/rubygems/pull/1361).
      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.

      1 trailing blank lines detected.
      Open

      Use text.start_with?('http://', 'https://') instead of text.start_with?('http://') || text.start_with?('https://').
      Open

              if text && (text.start_with?('http://') || text.start_with?('https://'))
      Severity: Minor
      Found in lib/geminabox/server.rb by rubocop

      This cop checks for double #start_with? or #end_with? calls separated by ||. In some cases such calls can be replaced with an single #start_with?/#end_with? call.

      Example:

      # bad
      str.start_with?("a") || str.start_with?(Some::CONST)
      str.start_with?("a", "b") || str.start_with?("c")
      str.end_with?(var1) || str.end_with?(var2)
      
      # good
      str.start_with?("a", Some::CONST)
      str.start_with?("a", "b", "c")
      str.end_with?(var1, var2)

      Use flat_map instead of map...flatten.
      Open

            query_gems.map{|query_gem| gem_dependencies(query_gem) }.flatten(1)
      Severity: Minor
      Found in lib/geminabox/server.rb by rubocop

      This cop is used to identify usages of

      Example:

      # bad
      [1, 2, 3, 4].map { |e| [e, e] }.flatten(1)
      [1, 2, 3, 4].collect { |e| [e, e] }.flatten(1)
      
      # good
      [1, 2, 3, 4].flat_map { |e| [e, e] }
      [1, 2, 3, 4].map { |e| [e, e] }.flatten
      [1, 2, 3, 4].collect { |e| [e, e] }.flatten

      unexpected token tRPAREN
      Open

          def self.merge(local_gem_list, remote_gem_list, strategy:)
      Severity: Minor
      Found in lib/geminabox/gem_list_merge.rb by rubymotion

      Lists should be surrounded by blank lines
      Confirmed

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

      MD032 - Lists should be surrounded by blank lines

      Tags: bullet, ul, ol, blank_lines

      Aliases: blanks-around-lists

      This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

      Some text
      * Some
      * List
      
      1. Some
      2. List
      Some text

      To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):

      Some text
      
      * Some
      * List
      
      1. Some
      2. List
      
      Some text

      Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.

      Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

      * This is
      not okay
      
      * This is
        okay

      Bare URL used
      Confirmed

      - https://github.com/geminabox/geminabox/releases/tag/v1.4.3
      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`

      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`

      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`

      Code block style
      Confirmed

          require "rubygems"
      Severity: Info
      Found in README.md by markdownlint
      Severity
      Category
      Status
      Source
      Language