Showing 157 of 338 total issues
Method csv
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def csv
rows = @actions.map do |action|
keys.map do |k|
value = val(k, action)
value.is_a?(String) && value.index(COMMA).present? ? "\"#{value}\"" : 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 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 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
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,
directDebitOnly: action.payload,
paymentTypes,
currentPaymentType,
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
Method update_page
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_page
return unless @params[:page]
plugins_before = @page.plugins
- 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 search
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def search
@queries.each_pair do |search_type, query|
next unless query.present?
case search_type.to_sym
- 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
Function showOneOffButton
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
showOneOffButton() {
if (this.state.recurringDonor) {
return true;
} else {
if (this.state.recurringDefault === 'only_one_off') {
- 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 genuine_user?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def genuine_user?
unless user.has_account?
return true if email_account_exist?(email)
log_error_message('Recaptcha: Failed, UserAccountNotExist, EmailAccountExistence: false', true)
- 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 import
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def import
return false unless valid?
begin
funds = JSON.parse(File.read(file.tempfile))
- 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 updateSummaryRows
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
updateSummaryRows: function(data) {
// this only updates existing shares. new ones are appended by
// code in view/share/shares/create.js.erb, using rails UJS
$.get(`/api/pages/${data.id}/share-rows`, rows => {
_.each(rows, 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 location
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def location
return @location if @location.blank?
country_code = if @member.try(:country) && @member.country.length == 2
@member.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"