Showing 1,820 of 4,015 total issues
Function dummyCards
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
const dummyCards = (noOfCards: number) => {
const cards = [];
for (let i = 0; i < noOfCards; i++) {
cards.push(
File pages.js
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
const models = require('../../models');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const getPostServiceInstance = require('../../services/posts/posts-service');
const ALLOWED_INCLUDES = ['tags', 'authors', 'authors.roles', 'tiers', 'count.signups', 'count.paid_conversions', 'post_revisions', 'post_revisions.author'];
Function chartData
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
get chartData() {
const totalCadence = this.dashboardStats.paidMembersByCadence.month + this.dashboardStats.paidMembersByCadence.year;
const monthlyPercentage = Math.round(this.dashboardStats.paidMembersByCadence.month / totalCadence * 100);
const annualPercentage = Math.round(this.dashboardStats.paidMembersByCadence.year / totalCadence * 100);
const barThickness = 5;
- 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 getCustomerIdByEmail
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async getCustomerIdByEmail(email) {
await this._searchRateLimitBucket.throttle();
try {
const result = await this._stripe.customers.search({
query: `email:"${email}"`,
- 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 handleSetupEvent
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async handleSetupEvent(session) {
const setupIntent = await this.api.getSetupIntent(session.setup_intent);
const memberRepository = this.deps.memberRepository;
const member = await memberRepository.get({
- 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 populateProductsAndPrices
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async populateProductsAndPrices(options) {
if (!options) {
return this.models.Product.transaction((transacting) => {
return this.populateProductsAndPrices({transacting});
});
- 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 createCheckoutSession
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async createCheckoutSession(req, res) {
const type = req.body.type ?? 'subscription';
const metadata = req.body.metadata ?? {};
const identity = req.body.identity;
const membersEnabled = true;
- 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 onSaving
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
onSaving: function onSaving(newPage, attr, options) {
const self = this;
const tasks = [];
let passwordValidation = {};
- 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 up
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async function up(knex) {
logging.info('Populating members_paid_subscription_events from members_stripe_customers_subscriptions');
const allSubscriptions = await knex
.select(
'c.member_id',
- 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 getOgImage
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function getOgImage(data) {
const context = data.context ? data.context : null;
const contextObject = getContextObject(data, context);
if (_.includes(context, 'home')) {
- 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 tiers
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function tiers(options = {}) {
options = options || {};
options.hash = options.hash || {};
const separator = isString(options.hash.separator) ? options.hash.separator : ', ';
- 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 getTwitterImage
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function getTwitterImage(data) {
const context = data.context ? data.context : null;
const contextObject = getContextObject(data, context);
if (_.includes(context, 'home')) {
- 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 entryController
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function entryController(req, res, next) {
debug('entryController', res.routerOptions);
return dataService.entryLookup(req.path, res.routerOptions, res.locals)
.then(function then(lookup) {
- 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 intercept
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
intercept<T>(context: ExecutionContext, next: CallHandler): Observable<T> {
if (context.getType() !== 'http') {
return next.handle();
}
const [
- 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 handleOfferQuery
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async handleOfferQuery({site, offerId, member = this.state.member}) {
const {portal_button: portalButton} = site;
removePortalLinkFromUrl();
if (!isPaidMember({member})) {
try {
- 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 App
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const App: React.FC<AppProps> = ({scriptTag}) => {
const options = useOptions(scriptTag);
const [state, setFullState] = useState<EditableAppContext>({
initStatus: 'running',
member: null,
- 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 import
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
async import(quantity) {
if (quantity === 0) {
return;
}
Function generate
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
generate() {
const id = this.fastFakeObjectId();
let newsletter;
if (this.newsletters.length === 0) {
Function _uploadFile
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
_uploadFile: task(function* (tracker, file, index) {
let ajax = this.ajax;
let formData = this._getFormData(file);
let url = `${ghostPaths().apiRoot}${this.uploadUrl}`;
let metadata = null;
Function chartOptions
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
get chartOptions() {
let chartTitle = 'Free signups';
if (this.args.sortColumn === 'signups') {
chartTitle = 'Free signups';
} else {