Showing 1,820 of 4,015 total issues
Function exports
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (Bookshelf) {
Bookshelf.Model = Bookshelf.Model.extend({}, {
/**
* ### Generate Slug
* Create a string to act as the permalink for an object.
Function setFromZip
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
setFromZip: async (zip) => {
const themeName = getStorage().getSanitizedFileName(zip.name.split('.zip')[0]);
const backupName = `${themeName}_${ObjectID()}`;
// check if zip name matches one of the default themes
Function getText
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
getText(url, type, email) {
const siteTitle = settingsCache.get('title');
switch (type) {
case 'subscribe':
return trimLeadingWhitespace`
Function getLinkTarget
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getLinkTarget(ev) {
let resourceType = ev.resource_type;
if (ev.event !== 'deleted') {
switch (ev.resource_type) {
Function _uploadSuccess
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
_uploadSuccess(importResponse) {
let importedCount = importResponse.meta.stats.imported;
const erroredMembers = importResponse.meta.stats.invalid;
let errorCount = erroredMembers.length;
const errorList = {};
Function mockNewsletters
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function mockNewsletters(server) {
server.get('/newsletters/', paginatedResponse('newsletters'));
server.get('/newsletters/:id/');
server.post('/newsletters/', function ({newsletters}, {queryParams}) {
Function updatePortalPlansSetting
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
async updatePortalPlansSetting(plans, options) {
if (!options) {
return this.models.Product.transaction((transacting) => {
return this.updatePortalPlansSetting(plans, {transacting});
});
Function ImplWrapper
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
obj[method] = async function ImplWrapper() {
const apiConfig = {docName, method};
let options;
let data;
let frame;
Function validateTaxonomies
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
_private.validateTaxonomies = function validateTaxonomies(taxonomies) {
if (taxonomies.constructor !== Object) {
throw new errors.ValidationError({
message: tpl(messages.validationError, {
at: taxonomies,
Function prepAttrsForEmailVerification
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
async prepAttrsForEmailVerification(attrs, newsletter) {
const cleanedAttrs = _.cloneDeep(attrs);
const emailsToVerify = [];
const emailProperties = [
{property: 'sender_email', type: 'from', emptyable: true, error: messages.senderEmailNotAllowed}
Function formatUrl
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const formatUrl = (value: string, baseUrl?: string, nullable?: boolean) => {
if (nullable && !value) {
return {save: null, display: ''};
}
Function formatPostTime
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export function formatPostTime(timeago, {timezone = 'etc/UTC', format, relative, absolute, scheduled, short}) {
if (relative) {
// No special handling, just use moment.from
return moment(timeago).from(moment.utc());
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function model
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
model(params) {
const user = this.session.user;
let filterParams = {tag: params.tag, visibility: params.visibility};
let paginationParams = {
perPageParam: 'limit',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function updateSubscription
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
async updateSubscription(data, options) {
const sharedOptions = {
transacting: options ? options.transacting : null
};
if (!this._stripeAPIService.configured) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function prepareUserMessage
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const prepareUserMessage = function prepareUserMessage(err, req) {
const userError = {
message: err.message,
context: err.context
};
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function exports
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (Bookshelf) {
Bookshelf.Model = Bookshelf.Model.extend({
/**
* Return a relation, and load it if it hasn't been loaded already (or force a refresh with the forceRefresh option).
* refs https://github.com/TryGhost/Team/issues/1626
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function prepSettingsForEmailVerification
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
async prepSettingsForEmailVerification(settings, getSetting) {
const filteredSettings = [];
const emailsToVerify = [];
for (const setting of settings) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function exports
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
module.exports = createIrreversibleMigration(async (knex) => {
logging.info(`Starting regeneration of posts HTML`);
await knex.transaction(async (trx) => {
// get list of posts ids, use .forUpdate to lock rows until the transaction is finished
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function exports
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
module.exports = createIrreversibleMigration(async (knex) => {
logging.info('Starting re-generation of posts html.');
await knex.transaction(async (trx) => {
// get list of posts ids, use .forUpdate to lock rows until the transaction is finished
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function doImport
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
doImport: async function doImport(importData, importOptions) {
debug('doImport');
importOptions = importOptions || {};
if (importOptions.importTag && importData?.data?.posts) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"