Showing 1,820 of 4,015 total issues
Function exports
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
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,
Function reassignByAuthor
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
reassignByAuthor: async function reassignByAuthor(unfilteredOptions) {
let options = this.filterOptions(unfilteredOptions, 'reassignByAuthor', {extraAllowedProperties: ['id']});
let authorId = options.id;
if (!authorId) {
Function optimiseFilterCacheability
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function optimiseFilterCacheability(resource, options) {
const noOptimisation = {
options,
parseResult(result) {
return result;
File timezones.js
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
export default [
{
name: 'Pacific/Pago_Pago',
label: '(GMT -11:00) Midway Island, Samoa'
},
Function default
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function () {
this.namespace = ghostPaths().apiRoot;
// this.timing = 400; // delay for each request, automatically set to 0 during testing
this.logging = false;
Function populateProductsAndPrices
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async populateProductsAndPrices(options) {
if (!options) {
return this.models.Product.transaction((transacting) => {
return this.populateProductsAndPrices({transacting});
});
Function createCheckoutSetupSession
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async createCheckoutSetupSession(req, res) {
const identity = req.body.identity;
if (!identity) {
res.writeHead(400);
Function add
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async add(data, options) {
if (!this.stripeService.configured && (data.comped || data.stripe_customer_id)) {
const property = data.comped ? 'comped' : 'stripe_customer_id';
throw new errors.ValidationError({
message: tpl(messages.stripeNotConnected),
File users.js
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const models = require('../../models');
const permissionsService = require('../../services/permissions');
const dbBackup = require('../../data/db/backup');
File CommentsService.js
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const {MemberCommentEvent} = require('@tryghost/member-events');
const DomainEvents = require('@tryghost/domain-events');
Function beforeImport
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
beforeImport() {
debug('beforeImport');
this.sanitizeAttributes();
this.addNestedRelations();
Function checkoutPlan
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async checkoutPlan({plan, tierId, cadence, cancelUrl, successUrl, email: customerEmail, name, offerId, newsletters, metadata = {}} = {}) {
const siteUrlObj = new URL(siteUrl);
const identity = await api.member.identity();
const url = endpointFor({type: 'members', resource: 'create-stripe-checkout-session'});
Function itemsToHtml
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const itemsToHtml = (items) => {
let itemHTMLChunks = [];
items.forEach((item) => {
let type = item.item_type;
Function subscribeToEvents
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
subscribeToEvents() {
// @NOTE: event handling should be moved to the client - Ghost app
// Leaving commented out handlers here to move them all together
// this.DomainEvents.subscribe(PostDeletedEvent, async (event: PostDeletedEvent) => {
Function PortalLinks
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const PortalLinks: React.FC = () => {
const [isDataAttributes, setIsDataAttributes] = useState(false);
const [selectedTier, setSelectedTier] = useState('');
const {siteData} = useGlobalData();
const {data: {tiers: allTiers} = {}} = useBrowseTiers();
CollectionsService
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class CollectionsService {
private collectionsRepository: CollectionRepository;
private postsRepository: PostsRepository;
private DomainEvents: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Function getIcon
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getIcon(event) {
let icon;
if (event.type === 'login_event') {
icon = 'logged-in';
Function mockAuthentication
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function mockAuthentication(server) {
// Password sign-in
server.post('/session', function () {
return new Response(201);
});
Function attachSubscriptionsToMember
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
attachSubscriptionsToMember(member) {
if (!member.products || !Array.isArray(member.products)) {
return member;
}
Function findPage
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
findPage: async function findPage(unfilteredOptions) {
const options = this.filterOptions(unfilteredOptions, 'findPage');
const itemCollection = this.getFilteredCollection(options);
const requestedColumns = options.columns;
// make sure we include plaintext and custom_excerpt if excerpt is requested