Showing 1,756 of 3,886 total issues
File member.js
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
const ghostBookshelf = require('./base');
const uuid = require('uuid');
const _ = require('lodash');
const config = require('../../shared/config');
const {gravatar} = require('../lib/image');
Function checkoutSessionEvent
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
async checkoutSessionEvent(session) {
if (session.mode === 'setup') {
const setupIntent = await this.api.getSetupIntent(session.setup_intent);
const member = await this.deps.memberRepository.get({
customer_id: setupIntent.metadata.customer_id
Function fetchQueryStrData
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
fetchQueryStrData(qs = '') {
const qsParams = new URLSearchParams(qs);
const data = {
site: {
plans: {}
- 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 create
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
async create(data, options = {}) {
if (!this._stripeAPIService.configured && (data.stripe_prices || data.monthly_price || data.yearly_price)) {
throw new UpdateCollisionError({
message: 'The requested functionality requires Stripe to be configured. See https://ghost.org/integrations/stripe/',
code: 'STRIPE_NOT_CONFIGURED'
File Modal.tsx
has 383 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {useModal} from '@ebay/nice-modal-react';
import clsx from 'clsx';
import React, {useEffect, useState} from 'react';
import useGlobalDirtyState from '../../hooks/useGlobalDirtyState';
import {confirmIfDirty} from '../../utils/modals';
Function draw
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
Chart.elements.Rectangle.prototype.draw = function () {
var ctx = this._chart.ctx;
var vm = this._view;
var left, right, top, bottom, borderSkipped, radius;
Function exports
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (Bookshelf) {
const insertAction = (data, options) => {
// CASE: model does not support action for target event
if (!data) {
return;
Function updateMockedData
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
updateMockedData({days}) {
const generateDays = days;
const startDate = new Date();
startDate.setDate(startDate.getDate() - generateDays + 1);
- 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 a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
permissible: async function permissible(userModelOrId, action, context, unsafeAttrs, loadedPermissions, hasUserPermission, hasApiKeyPermission) {
const self = this;
const userModel = userModelOrId;
let origArgs;
- 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 getTitle
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
function getTitle(data, root, options = {}) {
const context = root ? root.context : null;
const siteTitle = settingsCache.get('title') || '';
const pagination = root ? root.pagination : null;
- 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 Modal
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
const Modal: React.FC<ModalProps> = ({
size = 'md',
width,
height,
testId,
- 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 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
get chartOptions() {
const that = this;
let activeDays = this.dashboardStats.chartDays;
let barColor = this.feature.nightShift ? 'rgba(200, 204, 217, 0.25)' : 'rgba(200, 204, 217, 0.65)';
exports
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
module.exports = class StripeAPI {
/**
* StripeAPI
*/
constructor(deps) {
Function PinturaModal
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PinturaModal = NiceModal.create(() => {
const {updateRoute} = useRouting();
const modal = NiceModal.useModal();
const [enabled, setEnabled] = useState(false);
const [uploadingState, setUploadingState] = useState({
Function create
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
async create(data, options) {
if (!options) {
options = {};
}
Function exports
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (path, headerMapping, defaultLabels = []) => {
return new Promise(function (resolve, reject) {
const csvFileStream = fs.createReadStream(path);
const csvParserStream = papaparse.parse(papaparse.NODE_STREAM_INPUT, {
header: 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 onUpdated
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
onUpdated: function onUpdated(model, options) {
ghostBookshelf.Model.prototype.onUpdated.apply(this, arguments);
model.statusChanging = model.get('status') !== model.previous('status');
model.isPublished = model.get('status') === 'published';
- 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 ping
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
function ping(post) {
let message;
let title;
let author;
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 chartOptions
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
get chartOptions() {
let that = this;
let ticksY = {display: false};
let totalCadence = this.dashboardStats.paidMembersByCadence.month + this.dashboardStats.paidMembersByCadence.year;
let minTickValue = -(Math.round(this.dashboardStats.paidMembersByCadence.month / totalCadence * 100));
GhPostSettingsMenu
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
@classic
@tagName('')
export default class GhPostSettingsMenu extends Component {
@service feature;
@service store;