Showing 1,820 of 4,015 total issues
Function sendAuthCodeToUser
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function sendAuthCodeToUser(req, res) {
const session = await getSession(req, res);
const token = await generateAuthCodeForUser(req, res);
const user = await findUserById({id: session.user_id});
Function compute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
compute(
positionalParams,
{excludedEvents = [], includeEvents = null, member = '', post = '', excludeEmailEvents = false}
) {
const excludedEventsSet = new Set();
Function finalise
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async finalise() {
const stripeProducts = await this.transaction.select('id', 'product_id', 'stripe_product_id').from('stripe_products');
const stripePrices = await this.transaction.select('id', 'stripe_product_id', 'interval').from('stripe_prices');
const products = await this.transaction.select('id').from('products');
Function create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static create(type, months) {
if (!type || typeof type !== 'string') {
throw new InvalidOfferDuration({
message: 'Offer `duration` must be a string.'
});
Function showAlert
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
showAlert(message, options = {}) {
options = options || {};
if (!options.isApiError && (!options.type || options.type === 'error')) {
if (this.config.sentry_dsn) {
Function willTransition
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@action
willTransition(transition) {
let isExploreTransition = false;
if (transition) {
Function server
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const server = require('http').createServer(async (req, res) => {
if (!req.method) {
res.writeHead(405);
return res.end('Method not allowed.');
}
Function _setAttributionMetadata
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async _setAttributionMetadata(metadata) {
// Don't allow to set the source manually
delete metadata.attribution_id;
delete metadata.attribution_url;
delete metadata.attribution_type;
Function filterExpansions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
filterExpansions: function filterExpansions() {
const postsMetaKeys = _.without(ghostBookshelf.model('PostsMeta').prototype.orderAttributes(), 'posts_meta.id', 'posts_meta.post_id');
const expansions = [{
key: 'primary_tag',
Function getReferrersHistory
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getReferrersHistory() {
const paidConversionEntries = await this.fetchAllPaidConversionSources();
const signupEntries = await this.fetchAllSignupSources();
const allEntries = signupEntries.map((entry) => {
Function getProductForDonations
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getProductForDonations({name}) {
const existingDonationPrices = await this.StripePriceModel
.where({
type: 'donation'
})
Function parseDefaultSettings
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseDefaultSettings() {
const defaultSettingsInCategories = require('../data/schema/').defaultSettings;
const defaultSettingsFlattened = {};
const dynamicDefault = {
Function edit
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
edit(apiConfig, frame) {
// CASE: allow shorthand syntax where a single key and value are passed to edit instead of object and options
if (_.isString(frame.data)) {
frame.data = {settings: [{key: frame.data, value: frame.options}]};
}
Function commentMapper
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const commentMapper = (model, frame) => {
const jsonModel = model.toJSON ? model.toJSON(frame.options) : model;
const response = _.pick(jsonModel, commentFields);
Function user
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
user: function (id) {
return models.User.findOne({id: id}, {withRelated: ['permissions', 'roles', 'roles.permissions']})
.then(function (foundUser) {
// CASE: {context: {user: id}} where the id is not in our database
if (!foundUser) {
Function onCreating
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onCreating: function onCreating(model, attr, options) {
if (Object.prototype.hasOwnProperty.call(schema.tables[this.tableName], 'created_by')) {
if (!options.importing || (options.importing && !this.get('created_by'))) {
this.set('created_by', String(this.contextUser(options)));
}
Function permissible
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async permissible(commentModelOrId, action, context, unsafeAttrs, loadedPermissions, hasUserPermission, hasApiKeyPermission, hasMemberPermission) {
const self = this;
if (hasUserPermission) {
return true;
Function promises
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const promises = data.map(function (item) {
if (item.toJSON) {
item = item.toJSON();
}
if (!(_.isString(item.key) && item.key.length > 0)) {
Function query
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async query(frame) {
const paidMembers = await membersService.api.memberBREADService.browse({limit: 0, filter: 'status:paid'});
if (_.get(paidMembers, 'meta.pagination.total') !== 0) {
throw new BadRequestError({
message: 'Cannot disconnect Stripe whilst you have active subscriptions.'
Function init
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async init() {
if (this.service) {
// Already done
return;
}