Showing 157 of 338 total issues
Function exports
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production'];
var currentEnv = api.env();
var isDevelopmentEnv = api.env('development');
var isProductionEnv = api.env('production');
File BraintreeCardFields.js
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component } from 'react';
import { injectIntl, FormattedMessage } from 'react-intl';
import classnames from 'classnames';
import braintree from 'braintree-web';
import hostedFields from 'braintree-web/hosted-fields';
Class Page
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Page < ApplicationRecord # rubocop:disable Metrics/ClassLength
extend FriendlyId
has_paper_trail
PRONTO_TEMPLATES = ['Default: Petition And Scroll To Share Greenpeace', 'Fundraiser With Title Below Image'].freeze
File action_queue.rb
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'active_support/concern'
module ActionQueue
module Enqueable
extend ActiveSupport::Concern
File FundraiserView.js
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component, Fragment } from 'react';
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import classnames from 'classnames';
import _ from 'lodash';
Class PagesController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class PagesController < ApplicationController # rubocop:disable Metrics/ClassLength
newrelic_ignore_enduser only: %i[show follow_up double_opt_in_notice]
skip_before_action :verify_authenticity_token, raise: false, only: %i[create update destroy]
before_action :authenticate_user!, except: %i[feeds show follow_up double_opt_in_notice]
before_action :get_page, only: %i[edit update destroy follow_up double_opt_in_notice analytics actions preview emails]
Class LiquidRenderer
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class LiquidRenderer # rubocop:disable Metrics/ClassLength
include Rails.application.routes.url_helpers
HIDDEN_FIELDS = %w[source bucket referrer_id rid akid referring_akid].freeze
SCROLL_TO_DONATE_LAYOUT = 'Default: Petition And Scroll To Donate Greenpeace'
Function render
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="AmountSelection-container section">
<Thermometer />
<DonationBands
Function rtl
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
rtl: function(context) {
var self = this;
var selection;
// ui has renders to build ui elements.
// - you can create a button with `ui.button`
Fundraiser
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class Fundraiser extends Plugin<IFundraiserPluginConfig> {
public store: Store<IAppState>;
public customRenderer: (instance: Fundraiser) => any | undefined;
constructor(options: IPluginOptions<IFundraiserPluginConfig>) {
Function ltr
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ltr: function(context) {
var self = this;
// ui has renders to build ui elements.
var ui = $.summernote.ui;
context.memo('button.ltr', function() {
Function render
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const errorMessage = this.state.newPensionFundNameError ? (
<FormattedMessage
id="email_tool.form.errors.suggest_fund"
defaultMessage="Name of pension fund can't be blank"
Function render
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { restrictedCountryCode } = this.props;
const className = classnames(
{
SweetPhoneInput__root: true,
Function createHostedFields
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
createHostedFields(client) {
Promise.all([
braintree.threeDSecure.create(
{
client: client,
Function render
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let targets;
if (this.state.not_found) {
targets = (
Function render
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { header, footer, errors } = this.props;
const hasHeaderValue = this.hasValue(header);
const hasFooterValue = this.hasValue(footer);
Function handleSuccess
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
handleSuccess(e, data) {
ee.emit('petition:submitted');
const tracking = data.tracking;
const member = window.champaign.personalization.member;
- 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 click
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
click: function() {
function clearSelection() {
if (document.selection) {
document.selection.empty();
} else if (window.getSelection) {
Function render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
disabled,
currentPaymentType,
onChange,
Function reducer
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function reducer(state = defaultState, action) {
switch (action.type) {
case '@@chmp:initialize':
const {
personalization: { member, location },