Showing 1,820 of 4,015 total issues
Function exports
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (path, headerMapping, defaultLabels = []) => {
return new Promise(function (resolve, reject) {
const csvFileStream = fs.createReadStream(path);
const csvParserStream = papaparse.parse(papaparse.NODE_STREAM_INPUT, {
header: 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 onUpdated
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
onUpdated: function onUpdated(model, options) {
ghostBookshelf.Model.prototype.onUpdated.apply(this, arguments);
model.statusChanging = model.get('status') !== model.previous('status');
model.isPublished = model.get('status') === 'published';
- 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 ping
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
function ping(post) {
let message;
let title;
let author;
let description;
- 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 121 lines of code (exceeds 25 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));
GhPostSettingsMenu
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
@classic
@tagName('')
export default class GhPostSettingsMenu extends Component {
@service feature;
@service store;
`` has 37 functions (exceeds 20 allowed). Consider refactoring. Open
Post = ghostBookshelf.Model.extend({
tableName: 'posts',
actionsCollectCRUD: true,
Function updateSubscription
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
async updateSubscription(req, res) {
try {
const identity = req.body.identity;
const subscriptionId = req.params.id;
const cancelAtPeriodEnd = req.body.cancel_at_period_end;
File PaymentsService.js
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
const logging = require('@tryghost/logging');
const DomainEvents = require('@tryghost/domain-events');
const {TierCreatedEvent, TierPriceChangeEvent, TierNameChangeEvent} = require('@tryghost/tiers');
const OfferCreatedEvent = require('@tryghost/members-offers').events.OfferCreatedEvent;
const {BadRequestError} = require('@tryghost/errors');
Function handleAudioPlayer
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleAudioPlayer = function (audioElementContainer) {
const audioPlayerContainer = audioElementContainer.querySelector('.kg-audio-player-container');
const playIconContainer = audioElementContainer.querySelector('.kg-audio-play-icon');
const pauseIconContainer = audioElementContainer.querySelector('.kg-audio-pause-icon');
const seekSlider = audioElementContainer.querySelector('.kg-audio-seek-slider');
Function create
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
async create(data, options) {
if (!options) {
options = {};
}
- 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 Connect
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
const Connect: React.FC = () => {
const [submitEnabled, setSubmitEnabled] = useState(false);
const [token, setToken] = useState('');
const [testMode, setTestMode] = useState(false);
const [error, setError] = useState('');
- 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 ViewContainer
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
const ViewContainer: React.FC<ViewContainerProps> = ({
type,
title,
firstOnPage = true,
headerContent,
- 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 validateData
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
_private.validateData = function validateData(object) {
if (!Object.prototype.hasOwnProperty.call(object, 'data')) {
return object;
}
File activitypub.ts
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Actor = any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Activity = any;
Function OfferPageStyles
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const OfferPageStyles = () => {
return `
.gh-portal-offer {
padding-bottom: 0;
overflow: unset;
File middleware.js
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
const crypto = require('crypto');
const _ = require('lodash');
const logging = require('@tryghost/logging');
const membersService = require('./service');
const emailSuppressionList = require('../email-suppression-list');
Function createSessionService
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function createSessionService({
getSession,
findUserById,
getOriginOfRequest,
getSettingsCache,
- 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 sendMagicLink
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
async sendMagicLink(req, res) {
const {email, honeypot, autoRedirect} = req.body;
let {emailType, redirect} = req.body;
let referer = req.get('referer');
- 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 edit
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
edit: function (data, unfilteredOptions) {
const options = this.filterOptions(unfilteredOptions, 'edit');
const self = this;
if (!Array.isArray(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 DesignModal
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
const DesignModal: React.FC = () => {
const {settings, siteData} = useGlobalData();
const {mutateAsync: editSettings} = useEditSettings();
const {data: {posts: [latestPost]} = {posts: []}} = useBrowsePosts({
searchParams: {
- 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"