LabPLC/verificalo

View on GitHub

Showing 26 of 30 total issues

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

  def verificaciones_all
    return false unless self.verificaciones?
    self.verificaciones.collect { |v|
      r = OpenStruct.new
      r.date = I18n.localize(Date.parse(v['fecha_verificacion']), :format => :default)
Severity: Minor
Found in lib/vehicle_cdmx.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 weekend has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def weekend (user, vehicle, saturday)
    return unless 
      # nunca ha verificado
      (user.no_circula_weekend && !vehicle.verificaciones_approved?) ||
      # no circula holograma uno
Severity: Minor
Found in app/mailers/notifier.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 verificaciones_vins has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def verificaciones_vins
    return false unless self.verificaciones?
    if self.user_vin_valid?
      return [ self.user_vin ]
    else
Severity: Minor
Found in lib/vehicle_cdmx.rb - About 35 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

Avoid too many return statements within this method.
Open

      return false
Severity: Major
Found in lib/vehicle_cdmx.rb - About 30 mins to fix

    Method new_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def new_email
        begin
          @email = @user.build_email(email_params)
        rescue
          @user.destroy
    Severity: Minor
    Found in app/controllers/notices_controller.rb - About 25 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 reset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def reset
        @params = params
        @session = session.to_hash
        redirect_to({ action: 'home' }) unless plate_param? || reset_param?
        if session.has_key?(:vin) && reset_vin?
    Severity: Minor
    Found in app/controllers/info_controller.rb - About 25 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

    Severity
    Category
    Status
    Source
    Language