Showing 20 of 20 total issues
Method dashboard
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def dashboard
#Super-Admin can only create an organization
#is_admin = 0-> Regular Access, 1-> Admin Rights, 2-> Super Admin Rights
#
#Admin
- Read upRead up
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
File elections_controller.rb
has 405 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ElectionsController < ApplicationController
respond_to :html
respond_to :js
respond_to :json
Class ElectionsController
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class ElectionsController < ApplicationController
respond_to :html
respond_to :js
respond_to :json
Method dashboard
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dashboard
#Super-Admin can only create an organization
#is_admin = 0-> Regular Access, 1-> Admin Rights, 2-> Super Admin Rights
#
#Admin
Method post_nominations
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def post_nominations
# update the db based on the nominations
@election_id = params.key?(:election_id) ? params[:election_id] : ''
@position_id = params.key?(:position_id) ? params[:position_id] : ''
@user_selected = params.key?(:user_selected) ? params[:user_selected] : ''
- Read upRead up
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 show_elections
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def show_elections
@election_list = Election.all
if session[:user_id] != nil
@current_user = User.find_by(id: session[:user_id])
@rows_of_same_user = User.where(:user_email => @current_user.user_email)
- Read upRead up
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 show_modal
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def show_modal
@election_id = params.key?(:election_id) ? params[:election_id] : ''
@position_id = params.key?(:position_id) ? params[:position_id] : ''
@user_selected = params.key?(:user_selected) ? params[:user_selected] : ''
@curr_user = params.key?(:curr_user) ? params[:curr_user] : ''
- Read upRead up
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 from_omniauth
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.from_omniauth(auth)
User.where(user_email: auth.info.email).first_or_initialize do |user|
user.provider = auth.provider
user.uid = auth.uid
user.user_name = auth.info.name
- Read upRead up
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 show_elections_add
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def show_elections_add
@current_user = User.find_by(id: session[:user_id])
if params[:new_election_name] != nil && params[:new_election_org] != nil
election_param_name = params[:new_election_name]
election_param_org = params[:new_election_org]
- Read upRead up
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 deeply nested control flow statements. Open
@position_id = params.key?(:position_id) ? params[:position_id] : ''
Method encryption_save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def encryption_save
@encrypted_text = params.key?(:encrypted_text) ? params[:encrypted_text] : ''
@current_user_email = params.key?(:user_email) ? params[:user_email] : ''
@election_id = params.key?(:election_id) ? params[:election_id] : ''
- Read upRead up
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 deeply nested control flow statements. Open
elsif current_phase == 3 # phase 3 = closed
nominated_users = Nomination.where(:election_id => current_election_id)
position_list = []
for no_us in nominated_users
if position_list.include?(no_us.position) == false
Avoid deeply nested control flow statements. Open
@election_id = params.key?(:election_id) ? params[:election_id] : ''
Method show_positions_add
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def show_positions_add
@current_user = User.find_by(id: session[:user_id])
if params[:election_id] != nil && params[:new_position_name] != nil
election_param_id = params[:election_id]
position_name = params[:new_position_name]
- Read upRead up
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 deeply nested control flow statements. Open
@position_id = params.key?(:position_id) ? params[:position_id] : ''
Method get_user_prime
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_user_prime
@election_id = params.key?(:election_id) ? params[:election_id] : ''
org = Election.find_by(:election_id => @election_id).organization
@current_user_email = params.key?(:user_email) ? params[:user_email] : ''
curr_user = User.find_by(:user_email => @current_user_email, :organization => org)
- Read upRead up
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 show_positions_delete
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def show_positions_delete
@current_user = User.find_by(id: session[:user_id])
if params[:election_id] != nil && params[:position_name] != nil
if @@position_list != nil && @@position_list.key?(params[:election_id]) == true
if @@position_list[params[:election_id]].include?(params[:position_name])
- Read upRead up
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 show_nominations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def show_nominations
@election_id = params.key?(:election_id) ? params[:election_id] : ''
@position_id = params.key?(:position_id) ? params[:position_id] : ''
org = ''
if @election_id != ''
- Read upRead up
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 show_vote
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show_vote
@election_id = params.key?(:election_id) ? params[:election_id] : ''
@position_id = params.key?(:position_id) ? params[:position_id] : ''
@current_user = User.find_by(id: session[:user_id])
@curr_user_votes = @current_user.votes
- Read upRead up
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 get_current_phase
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_current_phase
@election_id = params.key?(:election_id) ? params[:election_id] : ''
@current_user = User.find_by(id: session[:user_id])
@current_user_email = @current_user.user_email
curr_election = ''
- Read upRead up
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"