MaxLap/activerecord_where_assoc

View on GitHub
examples/examples.rb

Summary

Maintainability
A
0 mins
Test Coverage

Method puts_doc has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

  def puts_doc
    puts <<-HEADER.strip_heredoc
      Here are some example usages of the gem, along with the generated SQL.

      Each of those methods can be chained with scoping methods, so they can be used on `Post`, `my_user.posts`, `Post.where('hello')` or inside a scope. Note that for the `*_sql` variants, those should preferably be used on classes only, because otherwise, it could be confusing for a reader.
Severity: Major
Found in examples/examples.rb - About 4 hrs to fix

    Use caller_locations(1..1).first instead of caller_locations[0].
    Open

        initial_line_no = caller_locations[0].lineno + description.count("\n") + 2
    Severity: Minor
    Found in examples/examples.rb by rubocop

    This cop identifies places where caller[n] can be replaced by caller(n..n).first.

    Example:

    # bad
    caller[1]
    caller.first
    caller_locations[1]
    caller_locations.first
    
    # good
    caller(2..2).first
    caller(1..1).first
    caller_locations(2..2).first
    caller_locations(1..1).first

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

      new_new_line_keywords = NEW_LINE_KEYWORDS.sub('FROM|', '')
    Severity: Minor
    Found in examples/examples.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 double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

      new_new_line_keywords = NEW_LINE_KEYWORDS.sub('FROM|', '')
    Severity: Minor
    Found in examples/examples.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 double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

        sql = sql.gsub(/^  /, '')
    Severity: Minor
    Found in examples/examples.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

      KEYWORDS = "(#{NEW_LINE_KEYWORDS}|#{INLINE_KEYWORDS})#{AFTER_KEYWORD_SPACE}"
    Severity: Minor
    Found in examples/examples.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

    There are no issues that match your filters.

    Category
    Status