moebooru/moebooru

View on GitHub
lib/danbooru.rb

Summary

Maintainability
D
1 day
Test Coverage

Module has too many lines. [110/100]
Open

Severity: Minor
Found in lib/danbooru.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method http_get_streaming has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

Severity: Minor
Found in lib/danbooru.rb - About 7 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 has too many lines. [60/10]
Open

Severity: Minor
Found in lib/danbooru.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for http_get_streaming is too high. [61.91/15]
Open

Severity: Minor
Found in lib/danbooru.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for diff is too high. [56.04/15]
Open

Severity: Minor
Found in lib/danbooru.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [37/10]
Open

Severity: Minor
Found in lib/danbooru.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method diff has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

Severity: Minor
Found in lib/danbooru.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

Cyclomatic complexity for http_get_streaming is too high. [19/6]
Open

Severity: Minor
Found in lib/danbooru.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Perceived complexity for http_get_streaming is too high. [18/7]
Open

Severity: Minor
Found in lib/danbooru.rb by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Block has too many lines. [51/25]
Open

Severity: Minor
Found in lib/danbooru.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Method http_get_streaming has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Severity: Major
Found in lib/danbooru.rb - About 2 hrs to fix

    Cyclomatic complexity for diff is too high. [10/6]
    Open

    Severity: Minor
    Found in lib/danbooru.rb by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Perceived complexity for diff is too high. [10/7]
    Open

    Severity: Minor
    Found in lib/danbooru.rb by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Method diff has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Severity: Minor
    Found in lib/danbooru.rb - About 1 hr to fix

      Block has too many lines. [32/25]
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

      Block has too many lines. [26/25]
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

      Use =~ in places where the MatchData returned by #match will not be used.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop identifies the use of Regexp#match or String#match, which returns #<MatchData>/nil. The return value of =~ is an integral index/nil and is more performant.

      Example:

      # bad
      do_something if str.match(/regex/)
      while regex.match('str')
        do_something
      end
      
      # good
      method(str =~ /regex/)
      return value unless regex =~ 'str'

      Use min_by(&:old_position) instead of min { |a, b| a.old_position <=> b.old_position }.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop identifies places where sort { |a, b| a.foo <=> b.foo } can be replaced by sort_by(&:foo). This cop also checks max and min methods.

      Example:

      # bad
      array.sort { |a, b| a.foo <=> b.foo }
      array.max { |a, b| a.foo <=> b.foo }
      array.min { |a, b| a.foo <=> b.foo }
      array.sort { |a, b| a[:foo] <=> b[:foo] }
      
      # good
      array.sort_by(&:foo)
      array.sort_by { |v| v.foo }
      array.sort_by do |var|
        var.foo
      end
      array.max_by(&:foo)
      array.min_by(&:foo)
      array.sort_by { |a| a[:foo] }

      Use =~ in places where the MatchData returned by #match will not be used.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop identifies the use of Regexp#match or String#match, which returns #<MatchData>/nil. The return value of =~ is an integral index/nil and is more performant.

      Example:

      # bad
      do_something if str.match(/regex/)
      while regex.match('str')
        do_something
      end
      
      # good
      method(str =~ /regex/)
      return value unless regex =~ 'str'

      Use max_by(&:old_position) instead of max { |a, b| a.old_position <=> b.old_position }.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop identifies places where sort { |a, b| a.foo <=> b.foo } can be replaced by sort_by(&:foo). This cop also checks max and min methods.

      Example:

      # bad
      array.sort { |a, b| a.foo <=> b.foo }
      array.max { |a, b| a.foo <=> b.foo }
      array.min { |a, b| a.foo <=> b.foo }
      array.sort { |a, b| a[:foo] <=> b[:foo] }
      
      # good
      array.sort_by(&:foo)
      array.sort_by { |v| v.foo }
      array.sort_by do |var|
        var.foo
      end
      array.max_by(&:foo)
      array.min_by(&:foo)
      array.sort_by { |a| a[:foo] }

      Use =~ in places where the MatchData returned by #match will not be used.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop identifies the use of Regexp#match or String#match, which returns #<MatchData>/nil. The return value of =~ is an integral index/nil and is more performant.

      Example:

      # bad
      do_something if str.match(/regex/)
      while regex.match('str')
        do_something
      end
      
      # good
      method(str =~ /regex/)
      return value unless regex =~ 'str'

      Line is too long. [84/80]
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Ambiguous regexp literal. Parenthesize the method arguments if it's surely a regexp literal, or add a whitespace to the right of the / if it should be a division.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks for ambiguous regexp literals in the first argument of a method invocation without parentheses.

      Example:

      # bad
      
      # This is interpreted as a method invocation with a regexp literal,
      # but it could possibly be `/` method invocations.
      # (i.e. `do_something./(pattern)./(i)`)
      do_something /pattern/i

      Example:

      # good
      
      # With parentheses, there's no ambiguity.
      do_something(/pattern/i)

      Line is too long. [125/80]
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Freeze mutable objects assigned to constants.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

      Example:

      # bad
      CONST = [1, 2, 3]
      
      # good
      CONST = [1, 2, 3].freeze

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer to_s over string interpolation.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks for strings that are just an interpolated expression.

      Example:

      # bad
      "#{@var}"
      
      # good
      @var.to_s
      
      # good if @var is already a String
      @var

      Freeze mutable objects assigned to constants.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

      Example:

      # bad
      CONST = [1, 2, 3]
      
      # good
      CONST = [1, 2, 3].freeze

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Freeze mutable objects assigned to constants.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

      Example:

      # bad
      CONST = [1, 2, 3]
      
      # good
      CONST = [1, 2, 3].freeze

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings inside interpolations.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks that quotes inside the string interpolation match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      result = "Tests #{success ? "PASS" : "FAIL"}"
      
      # good
      result = "Tests #{success ? 'PASS' : 'FAIL'}"

      Example: EnforcedStyle: double_quotes

      # bad
      result = "Tests #{success ? 'PASS' : 'FAIL'}"
      
      # good
      result = "Tests #{success ? "PASS" : "FAIL"}"

      Omit parentheses for ternary conditions.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks for the presence of parentheses around ternary conditions. It is configurable to enforce inclusion or omission of parentheses using EnforcedStyle. Omission is only enforced when removing the parentheses won't cause a different behavior.

      Example: EnforcedStyle: requirenoparentheses (default)

      # bad
      foo = (bar?) ? a : b
      foo = (bar.baz?) ? a : b
      foo = (bar && baz) ? a : b
      
      # good
      foo = bar? ? a : b
      foo = bar.baz? ? a : b
      foo = bar && baz ? a : b

      Example: EnforcedStyle: require_parentheses

      # bad
      foo = bar? ? a : b
      foo = bar.baz? ? a : b
      foo = bar && baz ? a : b
      
      # good
      foo = (bar?) ? a : b
      foo = (bar.baz?) ? a : b
      foo = (bar && baz) ? a : b

      Example: EnforcedStyle: requireparentheseswhen_complex

      # bad
      foo = (bar?) ? a : b
      foo = (bar.baz?) ? a : b
      foo = bar && baz ? a : b
      
      # good
      foo = bar? ? a : b
      foo = bar.baz? ? a : b
      foo = (bar && baz) ? a : b

      Line is too long. [97/80]
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Freeze mutable objects assigned to constants.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

      Example:

      # bad
      CONST = [1, 2, 3]
      
      # good
      CONST = [1, 2, 3].freeze

      Use %r around regular expression.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop enforces using // or %r around regular expressions.

      Example: EnforcedStyle: slashes (default)

      # bad
      snake_case = %r{^[\dA-Z_]+$}
      
      # bad
      regex = %r{
        foo
        (bar)
        (baz)
      }x
      
      # good
      snake_case = /^[\dA-Z_]+$/
      
      # good
      regex = /
        foo
        (bar)
        (baz)
      /x

      Example: EnforcedStyle: percent_r

      # bad
      snake_case = /^[\dA-Z_]+$/
      
      # bad
      regex = /
        foo
        (bar)
        (baz)
      /x
      
      # good
      snake_case = %r{^[\dA-Z_]+$}
      
      # good
      regex = %r{
        foo
        (bar)
        (baz)
      }x

      Example: EnforcedStyle: mixed

      # bad
      snake_case = %r{^[\dA-Z_]+$}
      
      # bad
      regex = /
        foo
        (bar)
        (baz)
      /x
      
      # good
      snake_case = /^[\dA-Z_]+$/
      
      # good
      regex = %r{
        foo
        (bar)
        (baz)
      }x

      Example: AllowInnerSlashes: false (default)

      # If `false`, the cop will always recommend using `%r` if one or more
      # slashes are found in the regexp string.
      
      # bad
      x =~ /home\//
      
      # good
      x =~ %r{home/}

      Example: AllowInnerSlashes: true

      # good
      x =~ /home\//

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Missing top-level module documentation comment.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

      The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

      Example:

      # bad
      class Person
        # ...
      end
      
      # good
      # Description/Explanation of Person class
      class Person
        # ...
      end

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Freeze mutable objects assigned to constants.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

      Example:

      # bad
      CONST = [1, 2, 3]
      
      # good
      CONST = [1, 2, 3].freeze

      Use limit.zero? instead of limit == 0.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

      The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

      The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Interger polymorphic.

      Example: EnforcedStyle: predicate (default)

      # bad
      
      foo == 0
      0 > foo
      bar.baz > 0
      
      # good
      
      foo.zero?
      foo.negative?
      bar.baz.positive?

      Example: EnforcedStyle: comparison

      # bad
      
      foo.zero?
      foo.negative?
      bar.baz.positive?
      
      # good
      
      foo == 0
      0 > foo
      bar.baz > 0

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Freeze mutable objects assigned to constants.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

      Example:

      # bad
      CONST = [1, 2, 3]
      
      # good
      CONST = [1, 2, 3].freeze

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Line is too long. [113/80]
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Use max_size.zero? instead of max_size == 0.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

      The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

      The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Interger polymorphic.

      Example: EnforcedStyle: predicate (default)

      # bad
      
      foo == 0
      0 > foo
      bar.baz > 0
      
      # good
      
      foo.zero?
      foo.negative?
      bar.baz.positive?

      Example: EnforcedStyle: comparison

      # bad
      
      foo.zero?
      foo.negative?
      bar.baz.positive?
      
      # good
      
      foo == 0
      0 > foo
      bar.baz > 0

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Line is too long. [92/80]
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Line is too long. [83/80]
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Use the -> { ... } lambda literal syntax for single line lambdas.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

      Example: EnforcedStyle: linecountdependent (default)

      # bad
      f = lambda { |x| x }
      f = ->(x) do
            x
          end
      
      # good
      f = ->(x) { x }
      f = lambda do |x|
            x
          end

      Example: EnforcedStyle: lambda

      # bad
      f = ->(x) { x }
      f = ->(x) do
            x
          end
      
      # good
      f = lambda { |x| x }
      f = lambda do |x|
            x
          end

      Example: EnforcedStyle: literal

      # bad
      f = lambda { |x| x }
      f = lambda do |x|
            x
          end
      
      # good
      f = ->(x) { x }
      f = ->(x) do
            x
          end

      Prefer single-quoted strings inside interpolations.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      This cop checks that quotes inside the string interpolation match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      result = "Tests #{success ? "PASS" : "FAIL"}"
      
      # good
      result = "Tests #{success ? 'PASS' : 'FAIL'}"

      Example: EnforcedStyle: double_quotes

      # bad
      result = "Tests #{success ? 'PASS' : 'FAIL'}"
      
      # good
      result = "Tests #{success ? "PASS" : "FAIL"}"

      Line is too long. [86/80]
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Line is too long. [93/80]
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

      Severity: Minor
      Found in lib/danbooru.rb by rubocop

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      There are no issues that match your filters.

      Category
      Status