Showing 157 of 338 total issues
Function Form
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function Form(props: IProps, second?: any) {
const dispatch = useDispatch();
const values = useSelector((state: IAppState) => state.forms[props.id]);
const member = useSelector((state: IAppState) => state.member);
const [highlightConsent, setHighlightConsent] = React.useState(false);
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { amounts } = this.props;
return (
<div className="DonationBands-container">
{amounts.map((amount, i) => (
Method show
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
respond_to :html
one_click_processor = process_one_click
Function setSelectedAmountButton
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function setSelectedAmountButton(payload) {
return (dispatch, getState) => {
const state = getState();
const { selectedAmountButton, donationAmount, isCustomAmount } =
state.fundraiser || {};
Function TargetsStatusTable
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function TargetsStatusTable(props) {
const data = props.data;
return (
<table className="table totals">
<tbody>
Method express_payment
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def express_payment
@page = Page.find(params[:page_id])
@follow_up_url = ''
begin
Method subscription_payload
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def subscription_payload
{
type: 'donation',
payment_provider: 'braintree',
params: {
Method total_donations
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def total_donations
@page = Page.find(params[:page_id])
if @page.campaign.blank?
amount = @page.total_donations
Function PetitionComponent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function PetitionComponent(props: IProps) {
const dispatch = useDispatch();
const member: IChampaignMember = useSelector((state: any) => state.member);
const fields = filterNonEmptyFields(props.config.fields, member);
Method initialize
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(nonce, amount, currency, user, page_id, store_in_vault, device_data, extra_params)
Method initialize
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(nonce, amount, currency, user, page_id,
store_in_vault = false, device_data = {}, extra_params = {})
Method redirect_to_donations_experiment
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def redirect_to_donations_experiment
return unless @page.published?
return unless @page.language_code
return unless @page.donation_page?
return if user_signed_in?
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
member,
onlyRecurring,
recurringDonor,
- 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 write_subscription
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def write_subscription(subscription_gc_id, amount, currency, page_id, action_id, customer_id, payment_method_id)
Method plugins_config
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def plugins_config(page)
return {} unless page
page.plugins.each_with_object({}) do |plugin, hsh|
return hsh unless plugin.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 handleClick
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
handleClick() {
const loginHandler = resp => {
if (
resp.status !== 'connected' ||
resp.authResponse.grantedScopes.indexOf('publish_actions') === -1
- 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 write_subscription
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def write_subscription(payment_method_id, customer_id, subscription_result, page_id, action_id, currency)
Method call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
@status, @headers, @response = @app.call(env)
req = Rack::Request.new(env)
path_match = PathMatcher.match(req.path)
- 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 setModeValues
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
setModeValues(mode) {
if (!this.hasField('choices', mode)) {
this.resetChoices();
}
if (!this.hasField('defaultValue', mode)) {
- 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 push
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.push(event, action, mailing_id)
case event
when :new_action
if action.donation
if action.form_data.fetch('payment_provider', '').inquiry.go_cardless?
- 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"