Showing 1,756 of 3,886 total issues
Function NavigationModal
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
const NavigationModal = NiceModal.create(() => {
const modal = useModal();
const {updateRoute} = useRouting();
const {
localSettings,
Function createCustomNotification
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
async createCustomNotification(notification) {
if (!notification || !notification.messages || notification.messages.length === 0) {
debug(`Skipping notification creation as there are no messages to process`);
return;
}
- 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 init
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
async init() {
this.Suppression = models.Suppression;
const handleEvent = reason => async (event) => {
try {
if (reason === 'bounce') {
- 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 addTableColumn
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function addTableColumn(tableName, tableBuilder, columnName, columnSpec = schema[tableName][columnName]) {
let column;
// creation distinguishes between text with fieldtype, string with maxlength and all others
if (columnSpec.type === 'text' && Object.prototype.hasOwnProperty.call(columnSpec, 'fieldtype')) {
- 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 unsubscribeController
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
module.exports = async function unsubscribeController(req, res) {
debug('unsubscribeController');
const {query} = url.parse(req.url, 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 useNavigationEditor
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const useNavigationEditor = ({items, setItems}: {
items: NavigationItem[];
setItems: (newItems: NavigationItem[]) => void;
}): NavigationEditor => {
const hasNewItem = (newItem: NavigationItem) => Boolean((newItem.label && !newItem.label.match(/^\s*$/)) || newItem.url !== '/');
- 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 19 (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 TextField
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const TextField: React.FC<TextFieldProps> = ({
type = 'text',
inputRef,
title,
hideTitle,
- 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
File paid-breakdown.js
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* globals Chart */
import Component from '@glimmer/component';
import moment from 'moment-timezone';
import {action} from '@ember/object';
Function populateMembersMonthlyPriceIdSettings
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
async populateMembersMonthlyPriceIdSettings(options) {
if (!options) {
return this.models.Product.transaction((transacting) => {
return this.populateMembersMonthlyPriceIdSettings({transacting});
});
Function exports
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = createIrreversibleMigration(async (knex) => {
if (!DatabaseInfo.isSQLite(knex)) {
return logging.warn('Skipping adding "on delete cascade" - database is not SQLite3');
}
Function RecommendationsPage
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
const RecommendationsPage = () => {
const {api, site, pageData, t, onAction} = useContext(AppContext);
const {title, icon} = site;
const {recommendations_enabled: recommendationsEnabled = false} = site;
const [recommendations, setRecommendations] = useState(null);
Function useDefaultRecipientsOptions
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
const useDefaultRecipientsOptions = (selectedOption: string, defaultEmailRecipientsFilter?: string | null) => {
const tiers = useFilterableApi<Tier, 'tiers', 'name'>({path: '/tiers/', filterKey: 'name', responseKey: 'tiers'});
const labels = useFilterableApi<Label, 'labels', 'name'>({path: '/labels/', filterKey: 'name', responseKey: 'labels'});
const offers = useFilterableApi<Offer, 'offers', 'name'>({path: '/offers/', filterKey: 'name', responseKey: 'offers'});
File parse-member-event.js
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Helper from '@ember/component/helper';
import moment from 'moment-timezone';
import {getNonDecimal, getSymbol} from 'ghost-admin/utils/currency';
import {ghPluralize} from 'ghost-admin/helpers/gh-pluralize';
import {inject as service} from '@ember/service';
Function populateMembersYearlyPriceIdSettings
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
async populateMembersYearlyPriceIdSettings(options) {
if (!options) {
return this.models.Product.transaction((transacting) => {
return this.populateMembersYearlyPriceIdSettings({transacting});
});
Function result
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
const result = keys.reduce((obj, method) => {
const apiImpl = _.cloneDeep(apiController)[method];
Object.freeze(apiImpl.headers);
Function createCheckoutSession
has 63 lines of code (exceeds 25 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;
Function add
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
add(apiConfig, frame, options = {add: true}) {
debug('add');
if (_.get(frame,'options.source')) {
const html = frame.data.pages[0].html;
Function add
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
add(apiConfig, frame, options = {add: true}) {
debug('add');
if (_.get(frame,'options.source')) {
const html = frame.data.posts[0].html;
Function exports
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (event, model) => {
const _ = require('lodash');
const {sequence} = require('@tryghost/promise');
const api = require('../../api').endpoints;
const apiFramework = require('@tryghost/api-framework');