Showing 1,820 of 4,015 total issues
Offer
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Offer {
events = [];
get id() {
return this.props.id.toHexString();
}
Member
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
const Member = ghostBookshelf.Model.extend({
tableName: 'members',
defaults() {
return {
I18n
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class I18n {
/**
* @param {object} [options]
* @param {string} options.basePath - the base path to the translations directory
* @param {string} [options.locale] - a locale string
Function edit
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
async edit(settings, options, stripeConnectData) {
let filteredSettings = settings.filter((setting) => {
// The `stripe_connect_integration_token` "setting" is only used to set the `stripe_connect_*` settings.
return ![
'stripe_connect_integration_token',
Function setupSiteApp
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function setupSiteApp(routerConfig) {
debug('Site setup start', routerConfig);
const siteApp = express('site');
File authors.js
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const {sequence} = require('@tryghost/promise');
File PopupModal.js
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import Frame from './Frame';
import {hasMode} from '../utils/check-mode';
import AppContext from '../AppContext';
import {getFrameStyles} from './Frame.styles';
File parse-member-event.js
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Helper from '@ember/component/helper';
import moment from 'moment-timezone';
import {getNonDecimal, getSymbol} from 'ghost-admin/utils/currency';
import {ghPluralize} from 'ghost-admin/helpers/gh-pluralize';
import {inject as service} from '@ember/service';
Function mockStats
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function mockStats(server) {
server.get('/stats/subscriptions/', function () {
return {
stats: [],
meta: {
Function _getSubscriptionCheckoutData
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _getSubscriptionCheckoutData(body) {
const tierId = body.tierId;
const offerId = body.offerId;
let cadence = body.cadence;
Function replaceIdentifiers
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
replaceIdentifiers() {
const ownerUserId = _.find(this.requiredExistingData.users, (user) => {
if (user.roles[0].name === 'Owner') {
return true;
}
Function up
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function up(knex) {
logging.info('Checking default_content_visibility for specific tiers');
const settings = await knex('settings')
.select()
Function each
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
_.each(columns, function each(columnKey) {
let message = ''; // KEEP: Validator.js only validates strings.
const strVal = _.toString(model.get(columnKey));
if (options.method !== 'insert' && !_.has(model.changed, columnKey)) {
Function getImageDimensions
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getImageDimensions(metaData) {
const MAX_SOCIAL_IMG_WIDTH = config.get('imageOptimization:internalImageSizes:social-image:width') || 1200;
const fetch = {
coverImage: imageSizeCache.getCachedImageSizeFromUrl(metaData.coverImage.url),
Function add
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
async add(data, options) {
if (!this.stripeService.configured && (data.comped || data.stripe_customer_id)) {
const property = data.comped ? 'comped' : 'stripe_customer_id';
throw new errors.ValidationError({
message: tpl(messages.stripeNotConnected),
- 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 mediaValidation
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
const mediaValidation = function ({type}) {
return function mediaUploadValidation(req, res, next) {
const extensions = (config.get('uploads')[type] && config.get('uploads')[type].extensions) || [];
const contentTypes = (config.get('uploads')[type] && config.get('uploads')[type].contentTypes) || [];
- 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 20 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {page, pageQuery, site, customSiteUrl} = this.context;
const products = getSiteProducts({site});
const noOfProducts = products.length;
- 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 getPageFromLinkPath
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
getPageFromLinkPath(path) {
const customPricesSignupRegex = /^signup\/?(?:\/(\w+?))?\/?$/;
const customMonthlyProductSignup = /^signup\/?(?:\/(\w+?))\/monthly\/?$/;
const customYearlyProductSignup = /^signup\/?(?:\/(\w+?))\/yearly\/?$/;
const customOfferRegex = /^offers\/(\w+?)\/?$/;
- 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 getPortalPreviewUrl
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export const getPortalPreviewUrl = ({settings, config, tiers, siteData, selectedTab} : portalPreviewUrlTypes): string | null => {
if (!siteData?.url) {
return null;
}
let portalTiers = tiers.filter((t) => {
- 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 ThemePreview
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
}> = ({
selectedTheme,
isInstalling,
installedTheme,
onBack,
- 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"