Showing 1,820 of 4,015 total issues
Function validatePassword
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function validatePassword(password, email, blogTitle) {
const validationResult = {isValid: true};
const disallowedPasswords = ['password', 'ghost', 'passw0rd'];
let blogUrl = urlUtils.urlFor('home', true);
Function price
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function price(planOrAmount, options) {
let plan;
let amount;
if (arguments.length === 1) {
options = planOrAmount;
Function servePublicFileMiddleware
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function servePublicFileMiddleware(req, res, next) {
if (cache && matchCacheKey(req, cache)) {
res.writeHead(200, cache.headers);
return res.end(cache.body);
}
Function handleEvent
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async handleEvent(type, event) {
if (type === MilestoneCreatedEvent && event.data.milestone) {
await this.emails.notifyMilestoneReceived(event.data);
}
Function createCustomNotification
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async createCustomNotification(notification) {
if (!notification || !notification.messages || notification.messages.length === 0) {
debug(`Skipping notification creation as there are no messages to process`);
return;
}
Function setupAdminApp
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function setupAdminApp() {
debug('Admin setup start');
const adminApp = express('admin');
// Admin assets
Function constructor
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor({NewsletterModel, MemberModel, mail, singleUseTokenProvider, urlUtils, limitService, labs, emailAddressService}) {
this.NewsletterModel = NewsletterModel;
this.MemberModel = MemberModel;
this.urlUtils = urlUtils;
/** @private */
Function down
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function down(knex) {
logging.info('Restoring foreign key for comments');
await dropForeign({
fromTable: 'comments',
Function up
has 45 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 fetchOembedData
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async fetchOembedData(url, html, cardType) {
// Lazy require the library to keep boot quick
const cheerio = require('cheerio');
// check for <link rel="alternate" type="application/json+oembed"> element
Function fontClassName
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const fontClassName = (fontName: string, heading: boolean = true) => {
let className = '';
if (fontName === 'Cardo') {
className = clsx('font-cardo', heading && 'font-bold');
} else if (fontName === 'Manrope') {
Function confirmStatusChange
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const confirmStatusChange = async () => {
if (offer?.status === 'active') {
NiceModal.show(ConfirmationModal, {
title: 'Archive offer',
prompt: <>
Function validate
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const validate = (config, attrs) => {
let errors = [];
_.each(config, (value, key) => {
if (value.required && !attrs[key]) {
Function prepareError
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports.prepareError = function prepareError(err, req, res, next) {
debug(err);
if (Array.isArray(err)) {
err = err[0];
Function notifyDonationReceived
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async notifyDonationReceived({donationPaymentEvent}) {
const emailPromises = [];
const users = await this.models.User.getEmailAlertUsers('donation');
const formattedAmount = this.getFormattedAmount({currency: donationPaymentEvent.currency, amount: donationPaymentEvent.amount / 100});
Function unparse
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const unparse = (rows, columns = DEFAULT_COLUMNS.slice()) => {
columns = columns.map((column) => {
if (column === 'subscribed') {
return 'subscribed_to_emails';
}
Function _pingUrl
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
SchedulingDefault.prototype._pingUrl = function (object) {
const {url, time} = object;
debug('Ping url', url, moment().format('YYYY-MM-DD HH:mm:ss'), moment(time).format('YYYY-MM-DD HH:mm:ss'));
Function getSignupEvents
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getSignupEvents(options = {}, filter) {
options = {
...options,
withRelated: [
'member',
Function getHistory
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getHistory() {
// Fetch current total amounts and start counting from there
const totals = await this.getCurrentMrr();
const rows = await this.fetchAllDeltas();
Function serialize
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
serialize(options) {
const defaultSerializedObject = ghostBookshelf.Model.prototype.serialize.call(this, options);
const serialized = {
id: defaultSerializedObject.subscription_id,