Showing 157 of 338 total issues
Method member_phone_number_is_valid
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def member_phone_number_is_valid
return if member_phone_number.blank?
valid_characters = (/\A[0-9\-\+\(\) \.]+\z/i =~ member_phone_number).present?
has_at_least_six_numbers = (member_phone_number.scan(/[0-9]/).size > 5)
- 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 round_fundraising_goals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def round_fundraising_goals(values)
values.map do |value|
value = value.to_f
if value.zero?
value
- 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 render_menu
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_menu(iterator)
# terminate the call if the menu has been played too many times
iteration = iterator.blank? ? 0 : iterator
return terminate_call if iteration >= 3
- 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 function. Open
return {
...state,
directDebitOnly: action.payload,
paymentTypes,
currentPaymentType,
Avoid too many return
statements within this function. Open
return {
...state,
recurring: action.payload,
showDirectDebit,
localPaymentTypes,
Avoid too many return
statements within this function. Open
return {
...state,
...featuredAmountState(preselectAmount, { donationBands, currency }),
currency,
donationBands,
Avoid too many return
statements within this function. Open
return {
...state,
...data,
showDirectDebit,
localPaymentTypes,
Avoid too many return
statements within this function. Open
return {
...state,
form,
formValues,
outstandingFields,
Avoid too many return
statements within this function. Open
return {
...state,
currentPaymentType: safePaymentType(action.payload, state.paymentTypes),
};
Function triggerRegistrationSuccessEvent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
triggerRegistrationSuccessEvent(data) {
const tracking = data.tracking;
const member = window.champaign.personalization.member;
if (tracking && !member.id) {
if (typeof window.fbq === 'function') {
- 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
Function onSuccess
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async onSuccess(data) {
ee.emit('fundraiser:transaction_success', data, this.props.formData);
let donationType;
if (this.props.fundraiser.recurring) {
donationType = this.props.weekly ? 'weekly' : 'monthly';
- 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 express_payment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def express_payment
@page = Page.find(params[:page_id])
@follow_up_url = ''
begin
- 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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
service = EmailToolSender.new(params[:page_id], email_params, tracking_params)
if service.run
if service.action.is_a?(PendingActionService)
service.action.send_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 build
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build
return unless transaction.present?
create_customer
create_payment_method
- 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 valid?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def valid?
@errors << "Token can't be blank" unless token.present?
@errors << "Action can't be blank" unless action.present?
@errors << "Secret key can't be blank" unless http_options.dig(:query, :secret).present?
- 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
Function render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
if (!this.props.paymentMethods.length || this.props.hidden) return null;
return (
<div className="ExpressDonation">
- 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
Function submitFirstFormIfComplete
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
submitFirstFormIfComplete() {
// form.serialize() returns the forms values as URL encoded params,
// so `=&` only happens when there's a blank value in the form, eg
// name=&weight=180, and `=` at the end means the last param is blank
const $form = this.$forms.first();
- 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 place_call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def place_call
client = Twilio::REST::Client.new(Settings.twilio.account_sid, Settings.twilio.auth_token)
params = {
from: call.caller_id,
to: call.member_phone_number,
- 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_postal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_postal(postal, form_element)
return if form_element[:data_type] != 'postal' || postal.blank?
country = (@params[:country].blank? ? :US : @params[:country].to_sym)
validator = PostalValidator.new(postal, country_code: country)
- 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 exist?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def exist?
return false unless valid?
verify_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"