Showing 1,820 of 4,015 total issues
Function forPost
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports.forPost = (options, model, attrs) => {
const _ = require('lodash');
// This function is split up in 3 conditions for 3 different purposes:
// 1. Gets excerpt from post's plaintext. If custom_excerpt exists, it overrides the excerpt but the key remains excerpt.
if (Object.prototype.hasOwnProperty.call(options, 'columns') || _.includes(options.columns, 'excerpt') || _.includes(options.columns, 'excerpt') && options.formats && options.formats.includes('plaintext')) {
Function validate
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async validate(token, options = {}) {
if (!options.transacting) {
return await this.model.transaction((transacting) => {
return this.validate(token, {
...options,
Function doReset
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function doReset(options, tokenParts, settingsAPI) {
let dbHash;
const data = options.data.password_reset[0];
const resetToken = data.token;
Function up
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function up(connection) {
const currentSetting = await connection('settings')
.where({key: 'members_signup_access'})
.select('value')
.first();
Function allEvents
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const allEvents = allSubscriptions.reduce((allEventsAcc, subscription) => {
if (['incomplete', 'incomplete_expired'].includes(subscription.status)) {
return allEventsAcc;
}
Function navigation
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function navigation(options) {
options = options || {};
options.hash = options.hash || {};
options.data = options.data || {};
Function handle
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async handle(argv = {}) {
const _ = require('lodash');
// knex has to be loaded _after_ the call to setup()
// the db connection requires nconf which passes argv to yargs,
// which intercepts --help and stops execution
Function confirmStatusChange
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const confirmStatusChange = async () => {
if (newsletter.status === 'active') {
NiceModal.show(ConfirmationModal, {
title: 'Archive newsletter',
prompt: <>
File gh-image-uploader.js
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import Component from '@ember/component';
import ghostPaths from 'ghost-admin/utils/ghost-paths';
import {GENERIC_ERROR_MESSAGE} from 'ghost-admin/services/notifications';
import {
UnsupportedMediaTypeError,
Function generateMonochromePalette
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function generateMonochromePalette(baseColor, count = 10) {
// Convert hex to RGB
let r = parseInt(baseColor.slice(1, 3), 16);
let g = parseInt(baseColor.slice(3, 5), 16);
let b = parseInt(baseColor.slice(5, 7), 16);
Function browse
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async browse(options) {
const defaultWithRelated = [
'labels',
'stripeSubscriptions',
'stripeSubscriptions.customer',
Function bulkEdit
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async bulkEdit(data, options) {
const {all, filter, search} = options;
if (!['unsubscribe', 'addLabel', 'removeLabel'].includes(data.action)) {
throw new errors.IncorrectUsageError({
Function connect
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const connect = (options = {}) => {
let wasResolved = false;
const waitTimeout = setTimeout(() => {
logging.info('Bootstrap socket timed out.');
Function onUpdated
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
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';
Function revertPortalPlansSetting
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async revertPortalPlansSetting(options) {
if (!options) {
return this.models.Product.transaction((transacting) => {
return this.revertPortalPlansSetting({transacting});
});
Function formatOnWrite
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
formatOnWrite(attrs) {
// Ensure all URLs are stored as transform-ready with __GHOST_URL__ representing config.url
const urlTransformMap = {
mobiledoc: {
method: 'mobiledocToTransformReady',
Function add
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
add: function add(dataToClone, unfilteredOptions) {
const options = this.filterOptions(unfilteredOptions, 'add');
const self = this;
const data = _.cloneDeep(dataToClone);
let userData = this.filterData(data);
Function transferOwnership
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
transferOwnership: function transferOwnership(object, unfilteredOptions) {
const options = ghostBookshelf.Model.filterOptions(unfilteredOptions, 'transferOwnership');
let ownerRole;
let contextUser;
Function assignTagToUserPosts
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async assignTagToUserPosts({id, context, transacting}) {
// get author slug
const author = await this.models.User.findOne({
id
}, {
Function domainEventDispatcher
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
domainEventDispatcher(modelEventName: string, data: any) {
let event;
switch (modelEventName) {
case 'post.deleted':