Showing 1,820 of 4,015 total issues
File ThemeModal.tsx
has 452 lines of code (exceeds 250 allowed). Consider refactoring. Open
import AdvancedThemeSettings from './theme/AdvancedThemeSettings';
import InvalidThemeModal, {FatalErrors} from './theme/InvalidThemeModal';
import NiceModal, {NiceModalHandler, useModal} from '@ebay/nice-modal-react';
import OfficialThemes from './theme/OfficialThemes';
import React, {useEffect, useState} from 'react';
File fixtures-generator.js
has 449 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable camelcase */
export const sites = {
singleProduct: getSiteData({
products: getProductsData({numOfProducts: 1})
Function usePinturaEditor
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function usePinturaEditor() {
const {config: globalConfig, settings} = useGlobalData() as { config: Config, settings: Setting[] };
const [pintura] = getSettingValues<boolean>(settings, ['pintura']);
const [scriptLoaded, setScriptLoaded] = useState<boolean>(false);
const [cssLoaded, setCssLoaded] = useState<boolean>(false);
Function getDescription
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
function getDescription(data, root, options = {}) {
const context = root ? root.context : null;
let description = '';
- 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 exports
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (Bookshelf) {
Bookshelf.Model = Bookshelf.Model.extend({
initializeEvents: function () {
// NOTE: triggered before `creating`/`updating`
this.on('saving', function onSaving(newObj, attrs, options) {
File helpers.test.js
has 445 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {getAllProductsForSite, getAvailableProducts, getCurrencySymbol, getFreeProduct, getMemberName, getMemberSubscription, getPriceFromSubscription, getPriceIdFromPageQuery, getSupportAddress, getDefaultNewsletterSender, getUrlHistory, hasMultipleProducts, isActiveOffer, isInviteOnlySite, isPaidMember, isSameCurrency, transformApiTiersData, isSigninAllowed, isSignupAllowed, getCompExpiry, isInThePast} from './helpers';
import * as Fixtures from './fixtures-generator';
import {site as FixturesSite, member as FixtureMember, offer as FixtureOffer, transformTierFixture as TransformFixtureTiers} from '../utils/test-fixtures';
import {isComplimentaryMember} from '../utils/helpers';
File UserDetailModal.tsx
has 443 lines of code (exceeds 250 allowed). Consider refactoring. Open
import ChangePasswordForm from './users/ChangePasswordForm';
import EmailNotifications from './users/EmailNotifications';
import NiceModal, {useModal} from '@ebay/nice-modal-react';
import ProfileBasics from './users/ProfileBasics';
import ProfileDetails from './users/ProfileDetails';
Function SUBSCRIBED_FILTER
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
export const SUBSCRIBED_FILTER = ({newsletters, group}) => {
return {
label: newsletters.length > 1 ? 'All newsletters' : 'Newsletter subscription',
name: 'subscribed',
columnLabel: 'Subscribed',
- 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 exports
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (Bookshelf) {
Bookshelf.Model = Bookshelf.Model.extend({}, {
/**
* ### Generate Slug
* Create a string to act as the permalink for an object.
- 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 forPost
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
module.exports.forPost = (options, model, attrs) => {
const _ = require('lodash');
// This function is split up in 3 conditions for 3 different purposes:
// 1. Gets excerpt from post's plaintext. If custom_excerpt exists, it overrides the excerpt but the key remains excerpt.
if (Object.prototype.hasOwnProperty.call(options, 'columns') || _.includes(options.columns, 'excerpt') || _.includes(options.columns, 'excerpt') && options.formats && options.formats.includes('plaintext')) {
- 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 exports
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (Bookshelf) {
Bookshelf.Model = Bookshelf.Model.extend({
// When loading an instance, subclasses can specify default to fetch
defaultColumnsToFetch: function defaultColumnsToFetch() {
return [];
- 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 exports
has 164 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (defaults) {
let app = new EmberApp(defaults, {
addons: {denylist},
babel: {
plugins: [
Function createApiInstance
has 163 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createApiInstance(config) {
const membersApiInstance = MembersApi({
tokenConfig: config.getTokenConfig(),
auth: {
getSigninURL: config.getSigninURL.bind(config),
File AccountPlanPage.js
has 435 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, {useContext, useState} from 'react';
import AppContext from '../../AppContext';
import ActionButton from '../common/ActionButton';
import CloseButton from '../common/CloseButton';
import BackButton from '../common/BackButton';
Function generate
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
generate() {
this.count += 1;
const member = this.model;
const customer = this.membersStripeCustomers.get(this.model.id);
- 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 Sidebar
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Sidebar: React.FC = () => {
const {filter, setFilter, checkVisible, noResult, setNoResult} = useSearch();
const {updateRoute} = useRouting();
const searchInputRef = useRef<HTMLInputElement | null>(null);
const {isAnyTextFieldFocused} = useFocusContext();
Consider simplifying this complex logical expression. Open
if (!unstyled) {
className = clsx(
'inline-flex items-center justify-center whitespace-nowrap rounded text-sm transition',
((link && color !== 'clear' && color !== 'black') || (!link && color !== 'clear')) ? 'font-bold' : 'font-semibold',
!link ? `${size === 'sm' ? 'h-7' : 'h-[34px]'}` : '',
Function replaceIdentifiers
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
replaceIdentifiers() {
const ownerUserId = _.find(this.requiredExistingData.users, (user) => {
if (user.roles[0].name === 'Owner') {
return 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
Function PaidAccountActions
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
const PaidAccountActions = () => {
const {member, site, onAction, t} = useContext(AppContext);
const onEditBilling = () => {
const subscription = getMemberSubscription({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 AddOfferModal
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
const AddOfferModal = () => {
const {siteData} = useGlobalData();
const typeOptions = [
{title: 'Discount', description: 'Offer a special reduced price', value: 'percent'},
{title: 'Free trial', description: 'Give free access for a limited time', value: 'trial'}
- 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"