Showing 1,756 of 3,886 total issues
`` 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;
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 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 PaymentsService.js
has 361 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 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 deliverActivity
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
async deliverActivity(activity: Activity, actor: Actor): Promise<void> {
const recipients = await this.getRecipients(activity);
for (const recipient of recipients) {
const data = await this.fetchForActor(recipient.href, actor);
if ('inbox' in data && typeof data.inbox === 'string') {
- 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"
Further reading
Function ImageUpload
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
const ImageUpload: React.FC<ImageUploadProps> = ({
id,
children,
width = '100%',
height = '120px',
- 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 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
async init() {
if (initialised) {
return;
}
Function init
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
init() {
if (this.repository) {
return;
}
Function doImport
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
doImport: async function doImport(importData, importOptions) {
debug('doImport');
importOptions = importOptions || {};
if (importOptions.importTag && importData?.data?.posts) {
Function OfferPageStyles
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const OfferPageStyles = () => {
return `
.gh-portal-offer {
padding-bottom: 0;
overflow: unset;
Function exports
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = async (model, frame, options = {}) => {
const {tiers: tiersData} = options || {};
// NOTE: `model` is now overloaded and may be a bookshelf model or a POJO
let jsonModel = model;
Function beforeImport
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
beforeImport() {
debug('beforeImport');
const activeTheme = _.find(this.dataToImport, {key: 'active_theme'});
Function sendMagicLink
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
async sendMagicLink(req, res) {
const {email, 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 foreach
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function foreach(items, options) {
if (!options) {
logging.warn(tpl(messages.iteratorNeeded));
}
- 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 updateProfile
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
async function updateProfile({data, state, api}) {
const [dataUpdate, emailUpdate] = await Promise.all([updateMemberData({data, state, api}), updateMemberEmail({data, state, api})]);
if (dataUpdate && emailUpdate) {
if (emailUpdate.success) {
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"