Showing 1,820 of 4,015 total issues
Function createCheckoutSession
has 65 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 onSaving
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSaving: function onSaving(newPage, attr, options) {
const self = this;
const tasks = [];
let passwordValidation = {};
Function ping
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ping(post) {
let pingXML;
const title = post.title;
const url = urlService.getUrlByResourceId(post.id, {absolute: true});
Function apiKeyAuthenticateWithToken
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
const authenticateWithToken = async function apiKeyAuthenticateWithToken(originalUrl, token, ignoreMaxAge) {
const decoded = jwt.decode(token, {complete: true});
const jwtValidationOptions = ignoreMaxAge ? _.omit(JWT_OPTIONS_DEFAULTS, 'maxAge') : JWT_OPTIONS_DEFAULTS;
if (!decoded || !decoded.header) {
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 fetchOembedData
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
async fetchOembedData(url, html, cardType) {
// Lazy require the library to keep boot quick
const cheerio = require('cheerio');
// check for <link rel="alternate" type="application/json+oembed"> element
- 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 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 updateSubscription
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
async updateSubscription(data, options) {
const sharedOptions = {
transacting: options ? options.transacting : null
};
if (!this._stripeAPIService.configured) {
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 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 NewsletterPreviewContent.tsx
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
import CoverImage from '../../../../assets/images/user-cover.png';
import LatestPosts1 from '../../../../assets/images/latest-posts-1.png';
import LatestPosts2 from '../../../../assets/images/latest-posts-2.png';
import LatestPosts3 from '../../../../assets/images/latest-posts-3.png';
import clsx from 'clsx';
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 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 getEventTimeline
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getEventTimeline(options = {}) {
if (!options.limit) {
options.limit = 10;
}
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;