app/models/gsa18f/procurement.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Class Procurement has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Procurement < ActiveRecord::Base
    URGENCY = {
      10 => "I need it yesterday",
      20 => "I'm patient but would like w/in a week",
      30 => "Whenever",
Severity: Minor
Found in app/models/gsa18f/procurement.rb - About 3 hrs to fix

    Models should subclass ApplicationRecord.
    Open

      class Procurement < ActiveRecord::Base
    Severity: Minor
    Found in app/models/gsa18f/procurement.rb by rubocop

    This cop checks that models subclass ApplicationRecord with Rails 5.0.

    Example:

    # good class Rails5Model < ApplicationRecord # ... end

    # bad class Rails4Model < ActiveRecord::Base # ... end

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

          obj[:value].strftime("%b %d, %Y")
    Severity: Minor
    Found in app/models/gsa18f/procurement.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>

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

        'gsa18f_'
    Severity: Minor
    Found in app/models/gsa18f/procurement.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 %w or %W for an array of words.
    Open

        RECURRENCE = ["Daily", "Monthly", "Yearly"]
    Severity: Minor
    Found in app/models/gsa18f/procurement.rb by rubocop

    This cop can check for array literals made up of word-like strings, that are not using the %w() syntax.

    Alternatively, it can check for uses of the %w() syntax, in projects which do not want to include that syntax.

    Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of 3 will not enforce a style on an array of 2 or fewer elements.

    Example: EnforcedStyle: percent (default)

    # good
    %w[foo bar baz]
    
    # bad
    ['foo', 'bar', 'baz']

    Example: EnforcedStyle: brackets

    # good
    ['foo', 'bar', 'baz']
    
    # bad
    %w[foo bar baz]

    Freeze mutable objects assigned to constants.
    Open

        RECURRENCE = ["Daily", "Monthly", "Yearly"]
    Severity: Minor
    Found in app/models/gsa18f/procurement.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 annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
    Open

          obj[:value].strftime("%b %d, %Y")
    Severity: Minor
    Found in app/models/gsa18f/procurement.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>

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

          obj[:value].strftime("%b %d, %Y")
    Severity: Minor
    Found in app/models/gsa18f/procurement.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>

    Freeze mutable objects assigned to constants.
    Open

        URGENCY = {
          10 => "I need it yesterday",
          20 => "I'm patient but would like w/in a week",
          30 => "Whenever",
        }
    Severity: Minor
    Found in app/models/gsa18f/procurement.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

    Freeze mutable objects assigned to constants.
    Open

        OFFICES = [
          "DC",
          "Chicago",
          "Dayton",
          "New York",
    Severity: Minor
    Found in app/models/gsa18f/procurement.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

    Avoid comma after the last item of an array.
    Open

          "Me! (Remote Worker)",
    Severity: Minor
    Found in app/models/gsa18f/procurement.rb by rubocop

    This cop checks for trailing comma in array and hash literals.

    Example: EnforcedStyleForMultiline: consistent_comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1, 2,
      3,
    ]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: no_comma (default)

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2
    ]

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

          obj[:value].strftime("%b %d, %Y")
    Severity: Minor
    Found in app/models/gsa18f/procurement.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>

    %w-literals should be delimited by [ and ].
    Open

          %w( recurring_interval recurring_length total_price
              type_of_event urgency is_tock_billable date_requested
              recurring client_billed end_date start_date
              purchase_type office)
    Severity: Minor
    Found in app/models/gsa18f/procurement.rb by rubocop

    This cop enforces the consistent usage of %-literal delimiters.

    Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

    Example:

    # Style/PercentLiteralDelimiters:
    #   PreferredDelimiters:
    #     default: '[]'
    #     '%i':    '()'
    
    # good
    %w[alpha beta] + %i(gamma delta)
    
    # bad
    %W(alpha #{beta})
    
    # bad
    %I(alpha beta)

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

          obj[:value].strftime("%b %d, %Y")
    Severity: Minor
    Found in app/models/gsa18f/procurement.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>

    Avoid comma after the last item of a hash.
    Open

          30 => "Whenever",
    Severity: Minor
    Found in app/models/gsa18f/procurement.rb by rubocop

    This cop checks for trailing comma in array and hash literals.

    Example: EnforcedStyleForMultiline: consistent_comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1, 2,
      3,
    ]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: no_comma (default)

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2
    ]

    Avoid comma after the last item of a hash.
    Open

          "Other" => 4,
    Severity: Minor
    Found in app/models/gsa18f/procurement.rb by rubocop

    This cop checks for trailing comma in array and hash literals.

    Example: EnforcedStyleForMultiline: consistent_comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1, 2,
      3,
    ]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: no_comma (default)

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2
    ]

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

          obj[:value].strftime("%b %d, %Y")
    Severity: Minor
    Found in app/models/gsa18f/procurement.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>

    There are no issues that match your filters.

    Category
    Status