armandofox/audience1st

View on GitHub
app/models/vouchertype.rb

Summary

Maintainability
B
5 hrs
Test Coverage
B
83%

Class Vouchertype has 42 methods (exceeds 20 allowed). Consider refactoring.
Open

class Vouchertype < ActiveRecord::Base
  
  belongs_to :account_code
  validates_associated :account_code

Severity: Minor
Found in app/models/vouchertype.rb - About 5 hrs to fix

    BUG found
    Open

      # BUG: this duplicates functionality 
    Severity: Minor
    Found in app/models/vouchertype.rb by fixme

    BUG found
    Open

      # BUG clean up this method
    Severity: Minor
    Found in app/models/vouchertype.rb by fixme

    Useless assignment to variable - s. Use _ or _s as a variable name to indicate that it won't be used.
    Open

        s,e = Time.season_boundaries(Time.this_season)
    Severity: Minor
    Found in app/models/vouchertype.rb by rubocop

    This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

    assigned but unused variable - foo

    Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

    Example:

    # bad
    
    def some_method
      some_var = 1
      do_something
    end

    Example:

    # good
    
    def some_method
      some_var = 1
      do_something(some_var)
    end

    Useless assignment to variable - e. Use _ or _e as a variable name to indicate that it won't be used.
    Open

        s,e = Time.season_boundaries(Time.this_season)
    Severity: Minor
    Found in app/models/vouchertype.rb by rubocop

    This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

    assigned but unused variable - foo

    Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

    Example:

    # bad
    
    def some_method
      some_var = 1
      do_something
    end

    Example:

    # good
    
    def some_method
      some_var = 1
      do_something(some_var)
    end

    Unused block argument - id. If it's necessary, use _ or _id as an argument name to indicate that it won't be used.
    Open

          included_vouchers.delete_if { |id,qty| qty.to_i.zero? }
    Severity: Minor
    Found in app/models/vouchertype.rb by rubocop

    This cop checks for unused block arguments.

    Example:

    # bad
    
    do_something do |used, unused|
      puts used
    end
    
    do_something do |bar|
      puts :foo
    end
    
    define_method(:foo) do |bar|
      puts :baz
    end

    Example:

    #good
    
    do_something do |used, _unused|
      puts used
    end
    
    do_something do
      puts :foo
    end
    
    define_method(:foo) do |_bar|
      puts :baz
    end

    There are no issues that match your filters.

    Category
    Status