Showing 133 of 203 total issues
Method check_osm_setup
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_osm_setup
sections = Osm::Section.get_all(osm_api, :no_cache => true)
Osm::Model.cache_delete(osm_api, ['permissions', osm_api.user_id]) # Clear cached user permissions
@other_sections = Array.new
Method badge_stock_check
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def badge_stock_check
@my_params = params.require(:badge_stock_check)
.permit(:include_core, :include_activity, :include_challenge, :include_staged, :hide_no_stock)
require_section_type Constants::YOUTH_AND_ADULT_SECTIONS
Method flexi_record
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def flexi_record
require_osm_permission :read, :flexi
flexi_record = nil
flexi_record_id = params[:flexi_record_id].to_i
Method get_calendar_items_for_section
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_calendar_items_for_section(api, section, options)
[:start, :finish, :include_meetings, :include_events].each do |attr|
fail ArgumentError, "options doesn't contain a value for :#{attr}" unless options.has_key?(attr)
end
Function drawDayChart
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawDayChart(data, options, chart) {
data_table = new google.visualization.DataTable();
data_table.addColumn({
type: 'string',
label: 'Day'
Method perform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
noterm_emails_sent = {}
forbidden_emails_sent = {}
reminders = EmailReminder.where(:send_on => Date.today.wday).order(:section_id)
count = reminders.size
Method programme_meetings
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def programme_meetings
require_osm_permission :read, :programme
headers = [
'ID',
Method get_fake_data
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_fake_data
events = []
attendance = {}
(1 + rand(3)).times do |i|
Method show
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@record = nil
record_id = params[:record_id].to_i
@section.flexi_records.each do |record|
Method send_email
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_email(options={})
# :only_to is an array of strings or objects with an :email_address method or nil (send to everyone).
# :except_to is an array of strings or objects with an :email_address method or nil (send to everyone).
# :skip_subscribed_check if true then the email will be sent even if the subscription state is not :subscribed
Method create
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@user = User.new(params[:user].permit(:name, :email_address, :password, :password_confirmation, :gdpr_consent))
@user.gdpr_consent ||= false
if @signup_code
Method health
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def health
data = Status.new.health
status = data[:healthy] ? :ok : :service_unavailable
respond_with(data) do |format|
format.cacti { render cacti: {healthy: data[:healthy] ? 1 : 0}, status: status }
- 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_balanced_statistics
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_balanced_statistics(data, type)
statistics = {}
[:number, :time].each do |num_or_time|
statistics[num_or_time] = {
- 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
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def show
@record = nil
record_id = params[:record_id].to_i
@section.flexi_records.each do |record|
- 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 badge_completion_matrix
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def badge_completion_matrix
require_section_type Constants::YOUTH_AND_ADULT_SECTIONS
require_osm_permission(:read, :badge)
return if performed? # The above either redirected or rendered
- 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 email_reminders_data
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def email_reminders_data
todays_data = Statistics.create_or_retrieve_for_date(Date.today)
by_day = [todays_data['email_reminders_by_day'], todays_data['email_reminder_shares_by_day']]
by_day_max = 0
Method get_list
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_list
emails = Array.new
no_emails = Array.new
section = Osm::Section.get(user.osm_api, section_id)
fail Osm::Forbidden if section.nil?
Method get_data
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_data
earliest = configuration[:the_last_n_weeks].weeks.ago.to_date
latest = Date.current
api = user.osm_api
Method search_results
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search_results
if params[:selected].nil?
flash[:error] = 'You must select some fields to search.'
redirect_to osm_search_members_form_path(:search_for => params[:search_for]) and return
end
Method flexi_record
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def flexi_record
require_osm_permission :read, :flexi
flexi_record = nil
flexi_record_id = params[:flexi_record_id].to_i
- 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"