Showing 1,820 of 4,015 total issues
Function MainContent
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const MainContent: React.FC = () => {
const {currentUser} = useGlobalData();
const {route, updateRoute, loadingModal} = useRouting();
const {isDirty} = useGlobalDirtyState();
Function getLinkTarget
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getLinkTarget = (action: Action): InternalLink | ExternalLink | undefined => {
let resourceType = action.resource_type;
if (action.event !== 'deleted') {
switch (action.resource_type) {
Function fetchAllSubscriptionDeltas
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async fetchAllSubscriptionDeltas() {
const knex = this.knex;
const rows = await knex('members_paid_subscription_events')
.join('stripe_prices AS price', function () {
this.on('price.stripe_price_id', '=', 'members_paid_subscription_events.from_plan')
Function comments
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = async function comments(options) {
// todo: For now check on the comment id to exclude normal pages (we probably have a better way to do this)
const commentId = this.comment_id;
Function updateSettings
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async updateSettings(settings) {
// abort if any settings do not match known settings
const firstUnknownSetting = settings.find(setting => !this._activeThemeSettings[setting.key]);
if (firstUnknownSetting) {
Function exports
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (environment) {
let ENV = {
modulePrefix: 'ghost-admin',
environment,
cdnUrl: process.env.GHOST_CDN_URL || '',
Function permissible
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
permissible: async function permissible(postModel, action, context, unsafeAttrs, loadedPermissions, hasUserPermission, hasApiKeyPermission) {
let isContributor;
let isOwner;
let isAdmin;
let isEditor;
Function exports
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (Bookshelf) {
Bookshelf.Model = Bookshelf.Model.extend({
getNullableStringProperties() {
const table = schema.tables[this.tableName];
return Object.keys(table).filter(column => table[column].nullable);
Function post
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const post = (attrs, frame) => {
const columns = frame && frame.options && frame.options.columns || null;
const fields = frame && frame.original && frame.original.query && frame.original.query.fields || null;
if (localUtils.isContentAPI(frame)) {
Function up
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function up(knex) {
if (DatabaseInfo.isSQLite(knex)) {
logging.info('Skipped linking members_created_events and members_subscription_created_events on SQLite');
return;
}
Function down
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function down(connection) {
logging.info('Adding newsletter_show_header setting');
const oldSetting = await connection('settings')
.where('key', '=', 'newsletter_show_header')
Function getImageSizeFromUrl
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getImageSizeFromUrl(imagePath) {
if (this.storageUtils.isLocalImage(imagePath)) {
// don't make a request for a locally stored image
return this.getImageSizeFromStoragePath(imagePath);
}
Function SearchBox
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function SearchBox() {
const {searchValue, dispatch, inputRef, t} = useContext(AppContext);
const containerRef = useRef(null);
useEffect(() => {
setTimeout(() => {
Function permissible
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async permissible(inviteModel, action, context, unsafeAttrs, loadedPermissions, hasUserPermission, hasApiKeyPermission) {
const isAdd = (action === 'add');
if (!isAdd) {
if (hasUserPermission && hasApiKeyPermission) {
Function update
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ops.push(function update() {
return ghostBookshelf.Model.edit.call(self, data, options).then(async (user) => {
let roleId;
if (!data.roles || !data.roles.length) {
Function populateDefaults
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
populateDefaults: async function populateDefaults(unfilteredOptions) {
const options = this.filterOptions(unfilteredOptions, 'populateDefaults');
const self = this;
if (!options.context) {
Function init
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async init() {
const stripeService = require('../stripe');
const createMembersApiInstance = require('./api');
const env = config.get('env');
Function up
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function up(knex) {
logging.info('Adding on delete SET NULL for comments');
await dropForeign({
fromTable: 'comments',
Function down
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function down(knex) {
logging.info('Reverting default_content_visibility for specific tiers');
const settings = await knex('settings')
.select()
Function render
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async render(lexical, userOptions = {}) {
if (!postsService) {
const getPostServiceInstance = require('../services/posts/posts-service');
postsService = getPostServiceInstance();
}