Updated

app/controllers/embedded / internal_controller.rb

A
17 lines of codes
1 methods
13.8 complexity/method
1 churn
13.83 complexity
0 duplications
class Embedded::InternalController < ApplicationController
  1. Embedded::InternalController assumes too much for instance variable '@chatwoot'
  2. Embedded::InternalController assumes too much for instance variable '@current_account'
  3. Embedded::InternalController has no descriptive comment
before_action :authenticate_app def authenticate_app
  1. Embedded::InternalController#authenticate_app has approx 8 statements
token = params['token'] begin @chatwoot = Apps::Chatwoot.find_by_embedding_token(token) @current_account = @chatwoot.account @current_user = @current_account.users.first rescue ActiveRecord::RecordNotFound => e
  1. Embedded::InternalController#authenticate_app has the variable name 'e' Locations: 0 1
render json: { errors: e.message }, status: :unauthorized
  1. Embedded::InternalController#authenticate_app calls 'e.message' 2 times Locations: 0 1
  2. Embedded::InternalController#authenticate_app calls 'render json: { errors: e.message }, status: :unauthorized' 2 times Locations: 0 1
rescue JWT::DecodeError => e
  1. Embedded::InternalController#authenticate_app has the variable name 'e' Locations: 0 1
render json: { errors: e.message }, status: :unauthorized
  1. Embedded::InternalController#authenticate_app calls 'e.message' 2 times Locations: 0 1
  2. Embedded::InternalController#authenticate_app calls 'render json: { errors: e.message }, status: :unauthorized' 2 times Locations: 0 1
end end end