Showing 1,820 of 4,015 total issues
Anchor
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Anchor extends Component {
@service dashboardStats;
@service feature;
@tracked chartDisplay = 'mrr';
@tracked resizing = false;
File MemberBREADService.js
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const tpl = require('@tryghost/tpl');
const moment = require('moment');
Function getIcon
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
getIcon(event) {
let icon;
if (event.type === 'login_event') {
icon = 'logged-in';
- 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 getReferrerDetails
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
getReferrerDetails(history) {
// Empty history will return null as it means script is not loaded
if (history.length === 0) {
return {
referrerSource: 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 getLinkTarget
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function getLinkTarget(ev) {
let resourceType = ev.resource_type;
if (ev.event !== 'deleted') {
switch (ev.resource_type) {
- 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 error
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
error(error, transition) {
// unauthorized errors are already handled in the ajax service
if (isUnauthorizedError(error)) {
return false;
}
- 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 chartOptions
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
get chartOptions() {
let that = this;
let ticksY = {display: false};
let totalCadence = this.dashboardStats.paidMembersByCadence.month + this.dashboardStats.paidMembersByCadence.year;
let minTickValue = -(Math.round(this.dashboardStats.paidMembersByCadence.month / totalCadence * 100));
- 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 create
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
async create(data, options = {}) {
if (!this._stripeAPIService.configured && (data.stripe_prices || data.monthly_price || data.yearly_price)) {
throw new UpdateCollisionError({
message: 'The requested functionality requires Stripe to be configured. See https://ghost.org/integrations/stripe/',
code: 'STRIPE_NOT_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 post
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. 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)) {
- 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 createSessionFromMagicLink
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
const createSessionFromMagicLink = async function createSessionFromMagicLink(req, res, next) {
if (!req.url.includes('token=')) {
return next();
}
- 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 AddRecommendationModal
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
const AddRecommendationModal: React.FC<RoutingModalProps & AddRecommendationModalProps> = ({searchParams, recommendation, animate}) => {
const [enterPressed, setEnterPressed] = useState(false);
const modal = useModal();
const {updateRoute} = useRouting();
const {mutateAsync: checkRecommendation} = useCheckRecommendation();
- 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 setupGhostApi
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function setupGhostApi({siteUrl = window.location.origin, apiUrl, apiKey}: {siteUrl: string, apiUrl: string, apiKey: string}) {
const apiPath = 'members/api';
function endpointFor({type, resource, params = ''}: {type: string, resource: string, params?: string}) {
if (type === 'members') {
- 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 93 lines of code (exceeds 25 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',
Function fetchQueryStrData
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
fetchQueryStrData(qs = '') {
const qsParams = new URLSearchParams(qs);
const data = {
site: {
plans: {}
Function draw
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw: function () {
var ctx = this._chart.ctx;
var vm = this._view;
var left, right, top, bottom, borderSkipped, radius;
File test-fixtures.js
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable no-unused-vars*/
import {getFreeProduct, getMemberData, getOfferData, getPriceData, getProductData, getSiteData, getSubscriptionData, getNewsletterData} from './fixtures-generator';
export const transformTierFixture = [
getFreeProduct({
Consider simplifying this complex logical expression. Open
if (!member) {
const metadataName = _.get(session, 'metadata.name');
const metadataNewsletters = _.get(session, 'metadata.newsletters');
const attribution = {
id: session.metadata.attribution_id ?? null,
File import-manager.js
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const fs = require('fs-extra');
const path = require('path');
const os = require('os');
const glob = require('glob');
Function forceStripeSubscriptionToProduct
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
async forceStripeSubscriptionToProduct(data, options) {
if (!this._stripeAPIService.configured) {
throw new DataImportError({
message: tpl(messages.noStripeConnection, {action: 'force subscription to product'})
});
Function FirstpromoterModal
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
const FirstpromoterModal = NiceModal.create(() => {
const {updateRoute} = useRouting();
const {settings} = useGlobalData();
const {mutateAsync: editSettings} = useEditSettings();