mohsen-alizadeh/rails-pdate

View on GitHub

Showing 82 of 82 total issues

Method gregorian_to_persian has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def gregorian_to_persian(year, month, day) # :nodoc:
    jj=0
    gy = year - 1600
    gm = month - 1
    gd = day - 1
Severity: Minor
Found in lib/rails_pdate/pconvertor.rb - About 45 mins 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 RailsPdate::BaseDateTime#== is defined at both lib/rails_pdate/base_date_time.rb:26 and lib/rails_pdate/base_date_time.rb:81.
Open

    def ==(other)
Severity: Minor
Found in lib/rails_pdate/base_date_time.rb by rubocop

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end
Severity
Category
Status
Source
Language