Showing 1,820 of 4,015 total issues
Function configure
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function configure(dbConfig) {
const client = dbConfig.client;
if (client === 'sqlite3') {
// Backwards compatibility with old knex behaviour
- 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 has
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function has(options) {
options = options || {};
options.hash = options.hash || {};
options.data = options.data || {};
- 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 handleImageSizes
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function handleImageSizes(req, res, next) {
// In admin we need to read images and calculate the average color (blocked by CORS otherwise)
res.setHeader('Access-Control-Allow-Origin', '*');
if (!SIZE_PATH_REGEX.test(req.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 FreeProductCard
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function FreeProductCard({products, handleChooseSignup, error}) {
const {site, action, t} = useContext(AppContext);
const {selectedProduct, setSelectedProduct} = useContext(ProductsContext);
let cardClass = selectedProduct === 'free' ? 'gh-portal-product-card free checked' : 'gh-portal-product-card free';
- 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 createPublicFileMiddleware
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function createPublicFileMiddleware(location, file, mime, maxAge, options = {}) {
let cache;
// These files are provided by Ghost, and therefore live inside of the core folder
const staticFilePath = config.get('paths').publicFilePath;
// These files are built on the fly, and must be saved in the content folder
- 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 fetchOfferQueryStrData
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
fetchOfferQueryStrData(qs = '') {
const qsParams = new URLSearchParams(qs);
const data = {};
// Handle the query params key/value pairs
for (let pair of qsParams.entries()) {
- 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 Sidebar
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const Sidebar: React.FC<SidebarProps> = ({tierOptions,
handleTierChange,
selectedTier,
// handleTextInput,
typeOptions,
- 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 Recommendations
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const Recommendations: React.FC<{ keywords: string[] }> = ({keywords}) => {
const {
saveState,
handleSave
} = useSettingGroup();
- 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 Table
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const Table: React.FC<TableProps> = ({
header,
children,
borderTop,
hint,
- 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 Select
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const Select: React.FC<SelectProps> = ({
async,
title,
hideTitle,
size = 'md',
- 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 ColorPickerField
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const ColorPickerField: React.FC<ColorPickerFieldProps> = ({testId, title, direction, value, hint, error, eyedropper, clearButtonValue, onChange, swatches = [], alwaysOpen = false, debounceMs}) => {
const [isExpanded, setExpanded] = useState(false);
const [localValue, setLocalValue] = useState(value);
const context = useContext(ColorPickerContext);
const id = useId();
- 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 handleResponse
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const handleResponse = async (response: Response) => {
if (response.status === 0) {
throw new ServerUnreachableError();
} else if (response.status === 503) {
throw new MaintenanceError(response, await response.text());
- 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 generate
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
generate() {
const source = this.generateSource();
// We need to add all properties here already otherwise CSV imports won't know all the columns
let attribution = {
Function handleSetupEvent
has 56 lines of code (exceeds 25 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({
Function getMetaData
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getMetaData(data, root) {
const metaData = {
url: getUrl(data, true),
canonicalUrl: getCanonicalUrl(data),
ampUrl: getAmpUrl(data),
Function chooseBestErrorMessage
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function chooseBestErrorMessage(error, alreadyTranslatedDefaultMessage, t) {
// helper functions
const translateMessage = (message, number = null) => {
if (number) {
return t(message, {number});
Function handleSendInvitation
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleSendInvitation = async () => {
if (saveState === 'saving') {
return;
}
File StripeConnectModal.tsx
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
import BookmarkThumb from '../../../../assets/images/stripe-thumb.jpg';
import GhostLogo from '../../../../assets/images/orb-squircle.png';
import GhostLogoPink from '../../../../assets/images/orb-pink.png';
import NiceModal, {useModal} from '@ebay/nice-modal-react';
import React, {useState} from 'react';
Function getSentryConfig
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getSentryConfig(dsn, environment, appVersion, transport) {
const extraIntegrations = [];
const config = {
dsn,
Function chartData
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
get chartData() {
let stats;
let labels;
let data;