avrj/eventTicketing

View on GitHub

Showing 10 of 16 total issues

Method update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    if @customer.authenticate(customer_params[:current_password])
        if customer_params[:password].empty? && customer_params[:password_confirmation].empty?
          if @customer.update(customer_params_without_new_password)
            redirect_to customer_contact_information_path, notice: 'Contact information was successfully updated.'
Severity: Minor
Found in app/controllers/customer/contact_informations_controller.rb - About 1 hr 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 create has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create
    @tickets = session[:tickets]
    @seats = session[:seats]

    @real_seats = Seat.where(:id => @seats).joins(:ticket).where("tickets.reservation_id is null AND tickets.given_away = 'f'")
Severity: Minor
Found in app/controllers/customer/orders_controller.rb - About 1 hr to fix

    Method update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def update
        errors = false
        respond_to do |format|
          if @seat.update(seat_params)
            @ticket = Ticket.find_by(seat: @seat)
    Severity: Minor
    Found in app/controllers/admin/seats_controller.rb - About 55 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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        errors = false
    
        for counter in 1..ticket_params[:quantity].to_i
          @ticket = Ticket.new(ticket_params)
    Severity: Minor
    Found in app/controllers/admin/tickets_controller.rb - About 55 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 add_tickets has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_tickets
        if params.has_key?(:tickets)
          count = 0;
    
          params[:tickets].each do |ticket, quantity|
    Severity: Minor
    Found in app/controllers/shopping_cart_controller.rb - About 55 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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        @customer = Customer.new(customer_params)
    
        respond_to do |format|
          if @customer.save
    Severity: Minor
    Found in app/controllers/customer/customers_controller.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

    Method update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def update
        if customer_params[:password].empty? && customer_params[:password_confirmation].empty?
          if @customer.update(customer_params_without_new_password)
            redirect_to admin_customer_path(@customer), notice: 'Customer was successfully updated.'
          else
    Severity: Minor
    Found in app/controllers/admin/customers_controller.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

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

      def create
        @tickets = session[:tickets]
        @seats = session[:seats]
    
        @real_seats = Seat.where(:id => @seats).joins(:ticket).where("tickets.reservation_id is null AND tickets.given_away = 'f'")
    Severity: Minor
    Found in app/controllers/customer/orders_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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        customerUser = Customer.find_by email: customer_params[:email]
    
        if customerUser && customerUser.authenticate(customer_params[:password])
          session[:customer_user_id] = customerUser.id
    Severity: Minor
    Found in app/controllers/customer/sessions_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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        @seat = Seat.new(seat_params)
    
        random_digits = rand(9999999999).to_s.center(10, rand(9).to_s)
    
    
    Severity: Minor
    Found in app/controllers/admin/seats_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