Showing 1,756 of 3,886 total issues
Function OffersIndexModal
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
export const OffersIndexModal = () => {
const modal = useModal();
const {updateRoute} = useRouting();
const {data: {offers: allOffers = []} = {}, isFetching: isFetchingOffers} = useBrowseOffers({
searchParams: {
- 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 ThemeToolbar
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
const ThemeToolbar: React.FC<ThemeToolbarProps> = ({
currentTab,
setCurrentTab,
themes
}) => {
- 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 fixtures-generator.js
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable camelcase */
export const sites = {
singleProduct: getSiteData({
products: getProductsData({numOfProducts: 1})
File paid-mix.js
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* globals Chart */
import Component from '@glimmer/component';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
Function fetchAll
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
fetchAll: function (options) {
options = options || {};
const nql = require('@tryghost/nql');
const modelName = options.modelName;
Function validateSchema
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
function validateSchema(tableName, model, options) {
options = options || {};
const columns = _.keys(schema[tableName]);
let validationErrors = [];
- 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 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PaidAccountActions = () => {
const {member, site, onAction, t} = useContext(AppContext);
const onEditBilling = () => {
const subscription = getMemberSubscription({member});
Function PortalModal
has 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PortalModal: React.FC = () => {
const {updateRoute} = useRouting();
const [selectedPreviewTab, setSelectedPreviewTab] = useState('signup');
Function DesignModal
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
const DesignModal: React.FC = () => {
const {settings, siteData} = useGlobalData();
const {mutateAsync: editSettings} = useEditSettings();
const {data: {posts: [latestPost]} = {posts: []}} = useBrowsePosts({
searchParams: {
Function Sidebar
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
}> = ({newsletter, onlyOne, updateNewsletter, validate, errors, clearError}) => {
const {updateRoute} = useRouting();
const {mutateAsync: editNewsletter} = useEditNewsletter();
const limiter = useLimiter();
const {settings, siteData, config} = useGlobalData();
- 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 StaffServiceEmails.js
has 400 lines of code (exceeds 250 allowed). Consider refactoring. Open
const {promises: fs, readFileSync} = require('fs');
const path = require('path');
const moment = require('moment');
const glob = require('glob');
const {EmailAddressParser} = require('@tryghost/email-addresses');
Function getAction
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
getAction(event, hasMultipleNewsletters) {
if (event.type === 'signup_event' || (event.type === 'subscription_event' && event.data.type === 'created' && event.data.signup)) {
return 'signed up';
}
- 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 37 (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 MembersAPI
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function MembersAPI({
tokenConfig: {
issuer,
privateKey,
publicKey
- 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 prepAttrsForEmailVerification
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
async prepAttrsForEmailVerification(attrs, newsletter) {
const cleanedAttrs = _.cloneDeep(attrs);
const emailsToVerify = [];
const emailProperties = [
{property: 'sender_email', type: 'from', emptyable: true, error: messages.senderEmailNotAllowed}
- 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 generate
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
generate() {
this.count += 1;
const member = this.model;
const customer = this.membersStripeCustomers.get(this.model.id);
Function DetailPage
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
const DetailPage: React.FC = () => {
const {updateRoute} = useRouting();
return (
<Page
File boot.js
has 398 lines of code (exceeds 250 allowed). Consider refactoring. Open
// The Ghost Boot Sequence
// -----------------------
// - This is intentionally one big file at the moment, so that we don't have to follow boot logic all over the place
// - This file is FULL of debug statements so we can see timings for the various steps because the boot needs to be as fast as possible
// - As we manage to break the codebase down into distinct components for e.g. the frontend, their boot logic can be offloaded to them
File commands.js
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const logging = require('@tryghost/logging');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const db = require('../db');
Function exports
has 138 lines of code (exceeds 25 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 [];