Showing 38 of 66 total issues
Method validate_mileage_rate_id
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_mileage_rate_id
if @record.car_travel? || @record.bike_travel?
validate_presence(:mileage_rate_id, :blank)
if @record.mileage_rate_id.present? && (car_travel_missing_milage_rates || bike_travel_missing_milage_rates)
add_error(:mileage_rate_id, :invalid)
- 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 validate_pcm_quantity
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_pcm_quantity
if @record.claim.supplementary? || @record.claim.case_type.try(:allow_pcmh_fee_type?)
add_error(:quantity, :pcm_numericality) if @record.quantity > 3
else
add_error(:quantity, :pcm_not_applicable) unless @record.quantity.zero? || @record.quantity.blank?
- 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 too many return
statements within this method. Open
return Fee::MiscFeeType.agfs_scheme_10s if agfs_reform?
Avoid too many return
statements within this method. Open
return Fee::MiscFeeType.agfs_scheme_12s if agfs_scheme_12?
Function init
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
init: function (func, wait, immediate) {
let timeout
return function executedFunction () {
const context = this
const args = arguments
- 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 all_values_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def all_values_for(key)
each_with_object([]) do |(k, v), values|
values << v if k.eql?(key)
values.concat(v.select { |el| el.is_a?(Hash) }.flat_map { |el| el.all_values_for(key) }) if v.is_a? Array
values.concat(v.all_values_for(key)) if v.is_a? Hash
- 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 assign_total_attrs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assign_total_attrs
# TODO: understand if this check is really needed
# left it here mostly to ensure the new changes do
# not impact anything API related
return if from_api?
- 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 parse_options!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_options!
# The following personalisation is for the default provided template_id
# If you use a different template_id, make sure to provide in the command line
# the proper personalisation, encoded in JSON format. Example:
# --personalisation "{\"name\":\"test\",\"visit_url\":\"https://test.com\"}"
- 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 notify_resource
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def notify_resource
resource.reload
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_flashing_format?
sign_up(resource_name, resource)
- 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 step_fields_for_validation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def step_fields_for_validation
# NOTE: keeping existent validation for API purposes
# The form validations just validate the fields for the current step
return self.class.fields_for_steps[@record.form_step] || [] unless @record.from_api? || @record.form_step.nil?
return self.class.fields_for_steps.values.flatten if !@record.from_api? && @record.form_step.nil?
- 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 sort_using
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sort_using(column, direction)
raise 'Invalid column' unless sortable_by?(column)
raise 'Invalid sort direction' unless %( asc desc ).include?(direction)
if META_SORT_COLUMNS.include?(column)
- 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 agfs_scheme_scope
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def agfs_scheme_scope
return Fee::MiscFeeType.agfs_scheme_16s if agfs_scheme_16?
return Fee::MiscFeeType.agfs_scheme_15s if agfs_scheme_15?
return Fee::MiscFeeType.agfs_scheme_14s if agfs_scheme_14?
return Fee::MiscFeeType.agfs_scheme_13s if agfs_scheme_13?
- 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 validate_amount
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_amount
return if fee_code.nil?
return if @record.calculated?
add_error(:amount, :"#{fee_code.downcase}_invalid") if amount_outside_allowed_range?
- 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 assign_total_attrs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assign_total_attrs
# TODO: understand if this check is really needed
# left it here mostly to ensure the new changes do
# not impact anything API related
return if from_api?
- 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 validate_retrial_start_and_end
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_retrial_start_and_end(start_attribute, end_attribute, inverse: false)
return unless @record&.requires_retrial_dates?
start_attribute, end_attribute = end_attribute, start_attribute if inverse
# TODO: this condition is a temproary workaround for live data that existed prior to addition of retrial details
validate_presence(start_attribute, :blank) if @record.editable?
- 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 available_roles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def available_roles
return %w[admin] if provider.nil?
if provider.agfs? && provider.lgfs?
%w[admin advocate litigator]
- 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 process_row
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_row(row)
sn = SupplierNumber.find_by(supplier_number: row['account_number'])
return not_found(row) unless sn
return not_updated(row) if sn.postcode.present?
update_record(sn, row)
- 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 call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def call
return unless claim&.agfs?
return all_categories unless claim.fee_scheme
return new_monarch_categories if claim.fee_scheme.version >= 15
return agfs_reform_categories if claim.agfs_reform?
- 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"