moebooru/moebooru

View on GitHub
app/models/tag/parse_methods.rb

Summary

Maintainability
D
3 days
Test Coverage

Assignment Branch Condition size for parse_query is too high. [245.5/15]
Open

    def parse_query(query, options = {})
      q = Hash.new { |h, k| h[k] = [] }

      scan_query(query).each do |token|
        if token =~ /^([qse])$/
Severity: Minor
Found in app/models/tag/parse_methods.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 parse_query has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_query(query, options = {})
      q = Hash.new { |h, k| h[k] = [] }

      scan_query(query).each do |token|
        if token =~ /^([qse])$/
Severity: Minor
Found in app/models/tag/parse_methods.rb - About 1 day 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. [113/10]
Open

    def parse_query(query, options = {})
      q = Hash.new { |h, k| h[k] = [] }

      scan_query(query).each do |token|
        if token =~ /^([qse])$/
Severity: Minor
Found in app/models/tag/parse_methods.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.

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

  module ClassMethods
    def scan_query(query)
      query.to_s.to_valid_utf8.downcase.split.uniq
    end

Severity: Minor
Found in app/models/tag/parse_methods.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.

Perceived complexity for parse_query is too high. [62/7]
Open

    def parse_query(query, options = {})
      q = Hash.new { |h, k| h[k] = [] }

      scan_query(query).each do |token|
        if token =~ /^([qse])$/
Severity: Minor
Found in app/models/tag/parse_methods.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

Cyclomatic complexity for parse_query is too high. [56/6]
Open

    def parse_query(query, options = {})
      q = Hash.new { |h, k| h[k] = [] }

      scan_query(query).each do |token|
        if token =~ /^([qse])$/
Severity: Minor
Found in app/models/tag/parse_methods.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.

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

      scan_query(query).each do |token|
        if token =~ /^([qse])$/
          q[:rating] = Regexp.last_match[1]
          next
        end
Severity: Minor
Found in app/models/tag/parse_methods.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 parse_query has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def parse_query(query, options = {})
      q = Hash.new { |h, k| h[k] = [] }

      scan_query(query).each do |token|
        if token =~ /^([qse])$/
Severity: Major
Found in app/models/tag/parse_methods.rb - About 4 hrs to fix

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

        def parse_helper(range, type = :integer)
          # "1", "0.5", "5.", ".5":
          # (-?(\d+(\.\d*)?|\d*\.\d+))
          case range
          when /^(.+?)\.\.(.+)/
    Severity: Minor
    Found in app/models/tag/parse_methods.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 parse_helper is too high. [22.83/15]
    Open

        def parse_helper(range, type = :integer)
          # "1", "0.5", "5.", ".5":
          # (-?(\d+(\.\d*)?|\d*\.\d+))
          case range
          when /^(.+?)\.\.(.+)/
    Severity: Minor
    Found in app/models/tag/parse_methods.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. [11/10]
    Open

        def parse_cast(x, type)
          if type == :integer
            x.to_i
          elsif type == :float
            x.to_f
    Severity: Minor
    Found in app/models/tag/parse_methods.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.

    Cyclomatic complexity for parse_helper is too high. [7/6]
    Open

        def parse_helper(range, type = :integer)
          # "1", "0.5", "5.", ".5":
          # (-?(\d+(\.\d*)?|\d*\.\d+))
          case range
          when /^(.+?)\.\.(.+)/
    Severity: Minor
    Found in app/models/tag/parse_methods.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.

    Avoid deeply nested control flow statements.
    Open

                if q[:pool] =~ /^(\d+)$/
                  q[:pool] = q[:pool].to_i
                end
    Severity: Major
    Found in app/models/tag/parse_methods.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                elsif Regexp.last_match[1] == "-pool"
                  pool = Regexp.last_match[2]
                  if pool =~ /^(\d+)$/
                    pool = pool.to_i
                  end
      Severity: Major
      Found in app/models/tag/parse_methods.rb - About 45 mins to fix

        Avoid too many return statements within this method.
        Open

                return [:gt, parse_cast(Regexp.last_match[1], type)]
        Severity: Major
        Found in app/models/tag/parse_methods.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return [:eq, parse_cast(range, type)]
          Severity: Major
          Found in app/models/tag/parse_methods.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return [:in, items]
            Severity: Major
            Found in app/models/tag/parse_methods.rb - About 30 mins to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          if Regexp.last_match[2] == "true" || Regexp.last_match[2] == "only"
                            q[:show_holds] = :only
                          elsif Regexp.last_match[2] == "all"
                            q[:show_holds] = :yes # all posts, held or not
                          elsif Regexp.last_match[2] == "false"
              Severity: Minor
              Found in app/models/tag/parse_methods.rb and 1 other location - About 45 mins to fix
              app/models/tag/parse_methods.rb on lines 152..158

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 40.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          if Regexp.last_match[2] == "true" || Regexp.last_match[2] == "only"
                            q[:show_pending] = :only
                          elsif Regexp.last_match[2] == "all"
                            q[:show_pending] = :yes # all posts, pending or not
                          elsif Regexp.last_match[2] == "false"
              Severity: Minor
              Found in app/models/tag/parse_methods.rb and 1 other location - About 45 mins to fix
              app/models/tag/parse_methods.rb on lines 144..150

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 40.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                        elsif Regexp.last_match[1] == "ext"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                      items = range.split(",").map do |val|
              Severity: Minor
              Found in app/models/tag/parse_methods.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"

              Redundant return detected.
              Open

                      return [:eq, parse_cast(range, type)]
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks for redundant return expressions.

              Example:

              def test
                return something
              end
              
              def test
                one
                two
                three
                return something
              end

              It should be extended to handle methods whose body is if/else or a case expression with a default branch.

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

                    tags.to_s.gsub(/[%,]/, "").downcase.scan(/\S+/).uniq
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "width"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          if Regexp.last_match[2] == "rating"
              Severity: Minor
              Found in app/models/tag/parse_methods.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. [193/80]
              Open

                      if token =~ /^(unlocked|deleted|ext|user|sub|vote|-vote|fav|md5|-rating|rating|width|height|mpixels|score|source|id|date|pool|-pool|parent|order|change|holds|pending|shown|limit):(.+)$/
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              Line is too long. [84/80]
              Open

                          q[:vote_negated] = User.find_by_name(Regexp.last_match[2]).id rescue nil
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
              Open

                          q[:error] = "no user named %s" % user if q[:vote_negated].nil?
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              Use a consistent style for named format string tokens.

              Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

              Example: EnforcedStyle: annotated (default)

              # bad
              format('%{greeting}', greeting: 'Hello')
              format('%s', 'Hello')
              
              # good
              format('%<greeting>s', greeting: 'Hello')</greeting>

              Example: EnforcedStyle: template

              # bad
              format('%<greeting>s', greeting: 'Hello')
              format('%s', 'Hello')
              
              # good
              format('%{greeting}', greeting: 'Hello')</greeting>

              Example: EnforcedStyle: unannotated

              # bad
              format('%<greeting>s', greeting: 'Hello')
              format('%{greeting}', 'Hello')
              
              # good
              format('%s', 'Hello')</greeting>

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

                          if pool =~ /^(\d+)$/
              Severity: Minor
              Found in app/models/tag/parse_methods.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?

              Redundant return detected.
              Open

                      return [:lt, parse_cast(Regexp.last_match[1], type)]
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks for redundant return expressions.

              Example:

              def test
                return something
              end
              
              def test
                one
                two
                three
                return something
              end

              It should be extended to handle methods whose body is if/else or a case expression with a default branch.

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

                        elsif Regexp.last_match[1] == "fav"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "id"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

              module Tag::ParseMethods
              Severity: Minor
              Found in app/models/tag/parse_methods.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

              Avoid using rescue in its modifier form.
              Open

                          user_id = User.find_by_name(user).id rescue nil
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks for uses of rescue in its modifier form.

              Example:

              # bad
              some_method rescue handle_error
              
              # good
              begin
                some_method
              rescue
                handle_error
              end

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

                        elsif Regexp.last_match[1] == "sub"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "rating"
              Severity: Minor
              Found in app/models/tag/parse_methods.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"

              Use the return of the conditional for variable assignment and comparison.
              Open

                          if Regexp.last_match[2] == "none"
                            q[:parent_id] = false
                          else
                            q[:parent_id] = Regexp.last_match[2].to_i
                          end
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

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

                        elsif Regexp.last_match[1] == "md5"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "height"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "deleted"
              Severity: Minor
              Found in app/models/tag/parse_methods.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"

              Use nested module/class definitions instead of compact style.
              Open

              module Tag::ParseMethods
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

              Example: EnforcedStyle: nested (default)

              # good
              # have each child on its own line
              class Foo
                class Bar
                end
              end

              Example: EnforcedStyle: compact

              # good
              # combine definitions as much as possible
              class Foo::Bar
              end

              The compact style is only forced for classes/modules with one child.

              Redundant return detected.
              Open

                      return [:between, parse_cast(Regexp.last_match[1], type), parse_cast(Regexp.last_match[2], type)]
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks for redundant return expressions.

              Example:

              def test
                return something
              end
              
              def test
                one
                two
                three
                return something
              end

              It should be extended to handle methods whose body is if/else or a case expression with a default branch.

              Redundant return detected.
              Open

                      return [:gt, parse_cast(Regexp.last_match[1], type)]
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks for redundant return expressions.

              Example:

              def test
                return something
              end
              
              def test
                one
                two
                three
                return something
              end

              It should be extended to handle methods whose body is if/else or a case expression with a default branch.

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

                          q[:source] = Regexp.last_match[2].to_escaped_for_sql_like + "%"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "unlocked"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "pending"
              Severity: Minor
              Found in app/models/tag/parse_methods.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. [101/80]
              Open

                          # This naming is slightly odd, to retain API compatibility with Danbooru's "deleted:true"
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              Avoid rescuing without specifying an error class.
              Open

                      rescue
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

              Example: EnforcedStyle: implicit

              # `implicit` will enforce using `rescue` instead of
              # `rescue StandardError`.
              
              # bad
              begin
                foo
              rescue StandardError
                bar
              end
              
              # good
              begin
                foo
              rescue
                bar
              end
              
              # good
              begin
                foo
              rescue OtherError
                bar
              end
              
              # good
              begin
                foo
              rescue StandardError, SecurityError
                bar
              end

              Example: EnforcedStyle: explicit (default)

              # `explicit` will enforce using `rescue StandardError`
              # instead of `rescue`.
              
              # bad
              begin
                foo
              rescue
                bar
              end
              
              # good
              begin
                foo
              rescue StandardError
                bar
              end
              
              # good
              begin
                foo
              rescue OtherError
                bar
              end
              
              # good
              begin
                foo
              rescue StandardError, SecurityError
                bar
              end

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

                        elsif Regexp.last_match[1] == "date"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          if Regexp.last_match[2] == "true" || Regexp.last_match[2] == "only"
              Severity: Minor
              Found in app/models/tag/parse_methods.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. [149/80]
              Open

                        matches = where("name LIKE ?", token.to_escaped_for_sql_like).select(:name, :post_count).limit(25).order(:post_count => :desc).pluck(:name)
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              Favor format over String#%.
              Open

                          q[:error] = "no user named %s" % user if q[:vote_negated].nil?
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop enforces the use of a single string formatting utility. Valid options include Kernel#format, Kernel#sprintf and String#%.

              The detection of String#% cannot be implemented in a reliable manner for all cases, so only two scenarios are considered - if the first argument is a string literal and if the second argument is an array literal.

              Example: EnforcedStyle: format(default)

              # bad
              puts sprintf('%10s', 'hoge')
              puts '%10s' % 'hoge'
              
              # good
              puts format('%10s', 'hoge')

              Example: EnforcedStyle: sprintf

              # bad
              puts format('%10s', 'hoge')
              puts '%10s' % 'hoge'
              
              # good
              puts sprintf('%10s', 'hoge')

              Example: EnforcedStyle: percent

              # bad
              puts format('%10s', 'hoge')
              puts sprintf('%10s', 'hoge')
              
              # good
              puts '%10s' % 'hoge'

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

                        elsif Regexp.last_match[1] == "-pool"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "shown"
              Severity: Minor
              Found in app/models/tag/parse_methods.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. [105/80]
              Open

                      return [:between, parse_cast(Regexp.last_match[1], type), parse_cast(Regexp.last_match[2], type)]
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

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

                        if Regexp.last_match[1] == "user"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "parent"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          if Regexp.last_match[2] == "true" || Regexp.last_match[2] == "only"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          elsif Regexp.last_match[2] == "all"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          if q[:pool] =~ /^(\d+)$/
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "score"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "source"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          if Regexp.last_match[2] == "true"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "change"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                module ClassMethods
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "mpixels"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          if Regexp.last_match[2] == "true" || Regexp.last_match[2] == "only"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          elsif Regexp.last_match[2] == "false"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          if Regexp.last_match[2] == "true" || Regexp.last_match[2] == "only"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          if Regexp.last_match[2] == "rating"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "vote"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "-rating"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "pool"
              Severity: Minor
              Found in app/models/tag/parse_methods.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"

              Odd else layout detected. Did you mean to use elsif?
              Open

                          else Regexp.last_match[2] == "all"
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks for odd else block layout - like having an expression on the same line as the else keyword, which is usually a mistake.

              Example:

              # bad
              
              if something
                # ...
              else do_this
                do_that
              end

              Example:

              # good
              
              if something
                # ...
              else
                do_this
                do_that
              end

              Redundant return detected.
              Open

                      return [:in, items]
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks for redundant return expressions.

              Example:

              def test
                return something
              end
              
              def test
                one
                two
                three
                return something
              end

              It should be extended to handle methods whose body is if/else or a case expression with a default branch.

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

                          vote, user = Regexp.last_match[2].split(":", 2)
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          q[:error] = "no user named %s" % user if q[:vote_negated].nil?
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          if Regexp.last_match[2] == "none"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "holds"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "-vote"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          else Regexp.last_match[2] == "all"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          q[:shown_in_index] = (Regexp.last_match[2] == "true")
              Severity: Minor
              Found in app/models/tag/parse_methods.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"

              Operator == used in void context.
              Open

                          else Regexp.last_match[2] == "all"
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks for operators, variables and literals used in void context.

              Example:

              # bad
              
              def some_method
                some_num * 10
                do_something
              end

              Example:

              # bad
              
              def some_method(some_var)
                some_var
                do_something
              end

              Example:

              # good
              
              def some_method
                do_something
                some_num * 10
              end

              Example:

              # good
              
              def some_method(some_var)
                do_something
                some_var
              end

              Use the new Ruby 1.9 hash syntax.
              Open

                        matches = where("name LIKE ?", token.to_escaped_for_sql_like).select(:name, :post_count).limit(25).order(:post_count => :desc).pluck(:name)
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks hash literal syntax.

              It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

              A separate offense is registered for each problematic pair.

              The supported styles are:

              • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
              • hash_rockets - forces use of hash rockets for all hashes
              • nomixedkeys - simply checks for hashes with mixed syntaxes
              • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

              Example: EnforcedStyle: ruby19 (default)

              # bad
              {:a => 2}
              {b: 1, :c => 2}
              
              # good
              {a: 2, b: 1}
              {:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
              {d: 1, 'e' => 2} # technically not forbidden

              Example: EnforcedStyle: hash_rockets

              # bad
              {a: 1, b: 2}
              {c: 1, 'd' => 5}
              
              # good
              {:a => 1, :b => 2}

              Example: EnforcedStyle: nomixedkeys

              # bad
              {:a => 1, b: 2}
              {c: 1, 'd' => 2}
              
              # good
              {:a => 1, :b => 2}
              {c: 1, d: 2}

              Example: EnforcedStyle: ruby19nomixed_keys

              # bad
              {:a => 1, :b => 2}
              {c: 2, 'd' => 3} # should just use hash rockets
              
              # good
              {a: 1, b: 2}
              {:c => 3, 'd' => 4}

              Avoid using rescue in its modifier form.
              Open

                          q[:vote_negated] = User.find_by_name(Regexp.last_match[2]).id rescue nil
              Severity: Minor
              Found in app/models/tag/parse_methods.rb by rubocop

              This cop checks for uses of rescue in its modifier form.

              Example:

              # bad
              some_method rescue handle_error
              
              # good
              begin
                some_method
              rescue
                handle_error
              end

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

                        elsif Regexp.last_match[1] == "order"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        matches = where("name LIKE ?", token.to_escaped_for_sql_like).select(:name, :post_count).limit(25).order(:post_count => :desc).pluck(:name)
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          elsif Regexp.last_match[2] == "all"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                          elsif Regexp.last_match[2] == "false"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                      elsif token.include?("*")
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        matches = ["~no_matches~"] if matches.empty?
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                      elsif token[0] == "~" && token.size > 1
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                        elsif Regexp.last_match[1] == "limit"
              Severity: Minor
              Found in app/models/tag/parse_methods.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

                      elsif token[0] == "-" && token.size > 1
              Severity: Minor
              Found in app/models/tag/parse_methods.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