Showing 1,756 of 3,886 total issues
Function ViewContainer
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
const ViewContainer: React.FC<ViewContainerProps> = ({
type,
title,
firstOnPage = true,
headerContent,
- 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 ghost_head
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = async function ghost_head(options) { // eslint-disable-line camelcase
debug('begin');
// if server error page do nothing
if (options.data.root.statusCode >= 500) {
File settings.js
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const uuid = require('uuid');
const crypto = require('crypto');
const keypair = require('keypair');
const ObjectID = require('bson-objectid').default;
File TierDetailModal.tsx
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
import NiceModal, {useModal} from '@ebay/nice-modal-react';
import React, {useEffect, useRef} from 'react';
import TierDetailPreview from './TierDetailPreview';
import useFeatureFlag from '../../../../hooks/useFeatureFlag';
import useSettingGroup from '../../../../hooks/useSettingGroup';
exports
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
module.exports = {
get all() {
return require('./all');
},
Function setComplimentarySubscription
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
async setComplimentarySubscription(data, options = {}) {
if (!options.transacting) {
return this._Member.transaction((transacting) => {
return this.setComplimentarySubscription(data, {
...options,
File validate.js
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const _private = {};
let RESOURCE_CONFIG;
Function http
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
const http = (apiImpl) => {
/**
* @param {import('express').Request} req - Express request object.
* @param {import('express').Response} res - Express response object.
* @param {import('express').NextFunction} next - Express next function.
- 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 permissible
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
permissible: async function permissible(userModelOrId, action, context, unsafeAttrs, loadedPermissions, hasUserPermission, hasApiKeyPermission) {
const self = this;
const userModel = userModelOrId;
let origArgs;
Function ZapierModal
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ZapierModal = NiceModal.create(() => {
const modal = NiceModal.useModal();
const {updateRoute} = useRouting();
const {zapierTemplates} = useSettingsApp();
const {data: {integrations} = {integrations: []}} = useBrowseIntegrations();
Function AnnouncementBarModal
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AnnouncementBarModal: React.FC = () => {
const {siteData} = useGlobalData();
const {localSettings, updateSetting, handleSave, okProps} = useSettingGroup({savingDelay: 500});
const [announcementContent] = getSettingValues<string>(localSettings, ['announcement_content']);
const [accentColor] = getSettingValues<string>(localSettings, ['accent_color']);
File post.js
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Ember from 'ember';
import Model, {attr, belongsTo, hasMany} from '@ember-data/model';
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
import boundOneWay from 'ghost-admin/utils/bound-one-way';
import moment from 'moment-timezone';
File data-attributes.js
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable no-console */
import {getCheckoutSessionDataFromPlanAttribute, getUrlHistory} from './utils/helpers';
import {HumanReadableError} from './utils/errors';
export function formSubmitHandler({event, form, errorEl, siteUrl, submitHandler}) {
Function PreviewModalContent
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
export const PreviewModalContent: React.FC<PreviewModalProps> = ({
testId,
title,
titleHeadingLevel = 4,
size = 'full',
- 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 chartOptions
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
get chartOptions() {
const barColor = this.feature.nightShift ? 'rgba(200, 204, 217, 0.25)' : 'rgba(200, 204, 217, 0.65)';
return {
responsive: true,
Function init
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
init() {
if (this.service) {
return;
}
File members-api.js
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
const {Router} = require('express');
const body = require('body-parser');
const MagicLink = require('@tryghost/magic-link');
const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
File spam-prevention.js
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
const moment = require('moment');
const extend = require('lodash/extend');
const pick = require('lodash/pick');
const errors = require('@tryghost/errors');
const config = require('../../../../../shared/config');
File dashboard-mocks.js
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Service from '@ember/service';
import {tracked} from '@glimmer/tracking';
/**
* @typedef {import('./dashboard-stats').MemberCountStat} MemberCountStat
Function exports
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (Bookshelf) {
Bookshelf.Model = Bookshelf.Model.extend({
// Ghost option handling - get permitted attributes from server/data/schema.js, where the DB schema is defined
permittedAttributes: function permittedAttributes() {
return _.keys(schema.tables[this.tableName])