Showing 1,820 of 4,015 total issues
Function mockPages
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function mockPages(server) {
server.post('/pages', function ({pages, users, tags}) {
let attrs = this.normalizedRequestAttrs();
attrs.authors = extractAuthors(attrs, users);
Function resourceNotFound
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports.resourceNotFound = function resourceNotFound(req, res, next) {
if (req?.headers?.['accept-version'] && res.locals?.safeVersion) {
// Protect against invalid `Accept-Version` headers
const acceptVersionSemver = semver.coerce(req.headers['accept-version']);
if (!acceptVersionSemver) {
Function getSubscriptionHistory
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getSubscriptionHistory() {
const subscriptionDeltaEntries = await this.fetchAllSubscriptionDeltas();
const counts = await this.fetchSubscriptionCounts();
/** @type {Object.<string, Object.<string, number>>} */
Function getPriceForDonations
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getPriceForDonations() {
const nickname = this.getDonationPriceNickname();
const currency = this.settingsCache.get('donations_currency');
const suggestedAmount = this.settingsCache.get('donations_suggested_amount');
Function onSaving
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async onSaving(model, _attr, options) {
ghostBookshelf.Model.prototype.onSaving.apply(this, arguments);
if (model.get('name')) {
model.set('name', model.get('name').trim());
Function _createSubscriptionCheckoutSession
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async _createSubscriptionCheckoutSession(options) {
if (options.offer) {
// Attach offer information to stripe metadata for free trial offers
// free trial offers don't have associated stripe coupons
options.metadata.offer = options.offer.id;
Function all
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async all(models, apiConfig, frame) {
debug('all');
// CASE: e.g. destroy returns null
if (!models) {
Function all
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async all(models, apiConfig, frame) {
debug('all');
// CASE: e.g. destroy returns null
if (!models) {
Function setFromFilePath
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async setFromFilePath(filePath) {
await this.createBackupFile(this.settingsPath, this.backupPath);
await this.saveFile(filePath, this.settingsPath);
urlService.resetGenerators({releaseResourcesOnly: true});
Function importFromFile
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async importFromFile(file, importOptions = {}) {
let importData;
if (importOptions.data) {
importData = importOptions.data;
} else {
Function up
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function up(knex) {
const products = await knex
.select('id')
.where({
type: 'paid'
Function editBilling
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async editBilling({successUrl, cancelUrl, subscriptionId} = {}) {
const siteUrlObj = new URL(siteUrl);
const identity = await api.member.identity();
const url = endpointFor({type: 'members', resource: 'create-stripe-update-session'});
if (!successUrl) {
Function StaffToken
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const StaffToken: React.FC = () => {
const {refetch: apiKey} = getStaffToken({
enabled: false
});
const handleError = useHandleError();
Function FormPage
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const FormPage: React.FC = () => {
const [error, setError] = React.useState('');
const [loading, setLoading] = React.useState(false);
const [success, setSuccess] = React.useState(false);
const {api, setPage, options, t} = useAppContext();
Consider simplifying this complex logical expression. Open
Open
if (options.property) {
description = data.post[`${options.property}_description`]
|| data.post.custom_excerpt
|| data.post.meta_description
|| generateExcerpt(data.post.excerpt || '', {words: 50})
Consider simplifying this complex logical expression. Open
Open
if (options.property) {
description = data.page[`${options.property}_description`]
|| data.page.custom_excerpt
|| data.page.meta_description
|| generateExcerpt(data.page.excerpt || '', {words: 50})
Consider simplifying this complex logical expression. Open
Open
if (options.property) {
description = data.post[`${options.property}_description`]
|| data.post.custom_excerpt
|| data.post.meta_description
|| generateExcerpt(data.post.excerpt || '', {words: 50})
Function passwordValidation
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
passwordValidation(model, password, errorTarget) {
let blogUrl = model.config?.blogUrl || window.location.host;
let blogTitle = model.blogTitle || model.config?.blogTitle;
let blogUrlWithSlash;
Function postBuild
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
postBuild: function (results) {
const fs = this.project.require('fs-extra');
const walkSync = this.project.require('walk-sync');
const assetsOut = path.join(path.dirname(require.resolve('ghost')), `core/built/admin`);
Function registerHelpers
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
registerHelpers(handlebars, labs) {
handlebars.registerHelper('if', function (conditional, options) {
if (conditional) {
return options.fn(this);
} else {