Showing 1,820 of 4,015 total issues
Function articleBodyStyles
has 4696 lines of code (exceeds 25 allowed). Consider refactoring. Open
const articleBodyStyles = (siteUrl: string|undefined) => {
return `<style>
/* Table of contents
/* ------------------------------------------------------------
File articleBodyStyles.ts
has 4699 lines of code (exceeds 250 allowed). Consider refactoring. Open
const articleBodyStyles = (siteUrl: string|undefined) => {
return `<style>
/* Table of contents
/* ------------------------------------------------------------
File MemberRepository.js
has 1327 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const tpl = require('@tryghost/tpl');
const DomainEvents = require('@tryghost/domain-events');
File activitypub.test.ts
has 1227 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {Activity, ActivityPubAPI} from './activitypub';
function NotFound() {
return new Response(null, {
status: 404
File post.js
has 1172 lines of code (exceeds 250 allowed). Consider refactoring. Open
// # Post Model
const _ = require('lodash');
const crypto = require('crypto');
const moment = require('moment');
const {sequence} = require('@tryghost/promise');
Function linkSubscription
has a Cognitive Complexity of 145 (exceeds 5 allowed). Consider refactoring. Open
async linkSubscription(data, options = {}) {
if (!this._stripeAPIService.configured) {
throw new errors.BadRequestError({message: tpl(messages.noStripeConnection, {action: 'link Stripe Subscription'})});
}
- 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
File Frame.styles.js
has 1088 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** By default, CRAs webpack bundle combines and appends the main css at root level, so they are not applied inside iframe
* This uses a hack where we append `<style> </style>` tag with all CSS inside the head of iframe dynamically, thus making it available easily
* We can create separate variables to keep styles grouped logically, and export them as one appended string
*/
File schema.js
has 1065 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* String Column Sizes Information
* (From: https://github.com/TryGhost/Ghost/pull/7932)
*
* Small strings = length 50
* Medium strings = length 191
File ProductsSection.js
has 987 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, {useContext, useEffect, useState} from 'react';
import {ReactComponent as LoaderIcon} from '../../images/icons/loader.svg';
import {ReactComponent as CheckmarkIcon} from '../../images/icons/checkmark.svg';
import {getCurrencySymbol, getPriceString, getStripeAmount, getMemberActivePrice, getProductFromPrice, getFreeTierTitle, getFreeTierDescription, getFreeProduct, getFreeProductBenefits, getSupportAddress, formatNumber, isCookiesDisabled, hasOnlyFreeProduct, isMemberActivePrice, hasFreeTrialTier, isComplimentaryMember} from '../../utils/helpers';
import AppContext from '../../AppContext';
Function onSaving
has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring. Open
onSaving: async function onSaving(model, attrs, options) {
options = options || {};
const self = this;
let title;
- 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 ProductsSectionStyles
has 446 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ProductsSectionStyles = () => {
// const products = getSiteProducts({site});
// const noOfProducts = products.length;
return `
.gh-portal-products {
File App.js
has 865 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import * as Sentry from '@sentry/react';
import TriggerButton from './components/TriggerButton';
import Notification from './components/Notification';
import PopupModal from './components/PopupModal';
File user.js
has 804 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const validator = require('@tryghost/validator');
const ObjectId = require('bson-objectid').default;
const ghostBookshelf = require('./base');
const baseUtils = require('./base/utils');
File EventRepository.js
has 796 lines of code (exceeds 250 allowed). Consider refactoring. Open
const errors = require('@tryghost/errors');
const nql = require('@tryghost/nql');
const mingo = require('mingo');
const {replaceFilters, expandFilters, splitFilter, getUsedKeys, chainTransformers, mapKeys, rejectStatements} = require('@tryghost/mongo-utils');
File helpers.js
has 795 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {getDateString} from './date-time';
export function removePortalLinkFromUrl() {
const [path] = window.location.hash.substr(1).split('?');
const linkRegex = /^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/;
Function emptyData
has 368 lines of code (exceeds 25 allowed). Consider refactoring. Open
get emptyData() {
return {
stats: [
{
date: '2022-04-07',
File anchor-attribution.js
has 765 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global Chart */
import Component from '@glimmer/component';
import moment from 'moment-timezone';
import {action} from '@ember/object';
Function linkSubscription
has 359 lines of code (exceeds 25 allowed). Consider refactoring. Open
async linkSubscription(data, options = {}) {
if (!this._stripeAPIService.configured) {
throw new errors.BadRequestError({message: tpl(messages.noStripeConnection, {action: 'link Stripe Subscription'})});
}
File SignupPage.js
has 737 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import ActionButton from '../common/ActionButton';
import AppContext from '../../AppContext';
import CloseButton from '../common/CloseButton';
import SiteTitleBackButton from '../common/SiteTitleBackButton';
Function exports
has a Cognitive Complexity of 82 (exceeds 5 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) {
- 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"