Showing 1,820 of 4,015 total issues
Function renderForm
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderForm() {
const fields = this.getInputFields({state: this.state});
const {site, pageQuery, t} = this.context;
if (this.state.showNewsletterSelection) {
Function Connect
has 90 lines of code (exceeds 25 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('');
Function Search
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Search: React.FC<SearchProps> = ({}) => {
// Initialise suggested profiles
const {suggestedProfilesQuery, updateSuggestedProfile} = useSuggestedProfiles('index', ['@index@activitypub.ghost.org', '@index@john.onolan.org', '@index@coffeecomplex.ghost.io', '@index@codename-jimmy.ghost.io', '@index@syphoncontinuity.ghost.io']);
const {data: suggested = [], isLoading: isLoadingSuggested} = suggestedProfilesQuery;
Function generatePassword
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export default function generatePassword(length, memorable, pattern, prefix) {
var char = '', n, i, validChars = [];
if (length === null || typeof (length) === 'undefined') {
length = 10;
}
- 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 a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
get chartOptions() {
const that = this;
let activeDays = this.dashboardStats.chartDays;
let barColor = this.feature.nightShift ? 'rgba(200, 204, 217, 0.25)' : 'rgba(200, 204, 217, 0.65)';
- 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 willTransition
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
@action
willTransition(transition) {
let isExploreTransition = false;
if (transition) {
- 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 getAdapter
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
getAdapter(adapterName, adapterClassName, config) {
if (!adapterName || !adapterClassName) {
throw new errors.IncorrectUsageError({
message: 'getAdapter must be called with a adapterName and a adapterClassName.'
});
- 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 replace
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
async replace(html, replaceLink, options = {}) {
const {tokenize} = require('html5parser');
const entities = require('entities');
try {
- 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 SessionMiddleware
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function SessionMiddleware({sessionService}) {
async function createSession(req, res, next) {
try {
await sessionService.createSessionForUser(req, res, req.user);
- 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 http
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
const http = (apiImpl) => {
/**
* @param {import('express').Request} req - Express request object.
* @param {import('express').Response} res - Express response object.
* @param {import('express').NextFunction} next - Express next function.
Function generateCustomFontCss
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function generateCustomFontCss(fonts: FontSelection) {
let fontImports: string = '';
let fontCSS: string = '';
const importStrings = {
Function chartData
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
get chartData() {
const totalCadence = this.dashboardStats.paidMembersByCadence.month + this.dashboardStats.paidMembersByCadence.year;
const monthlyPercentage = Math.round(this.dashboardStats.paidMembersByCadence.month / totalCadence * 100);
const annualPercentage = Math.round(this.dashboardStats.paidMembersByCadence.year / totalCadence * 100);
const barThickness = 5;
ModalPostPreviewSocialComponent
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export default class ModalPostPreviewSocialComponent extends Component {
@service settings;
@service ghostPaths;
@inject config;
exports
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
module.exports = class MemberRepository {
/**
* @param {object} deps
* @param {any} deps.Member
* @param {any} deps.MemberNewsletter
Function Http
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
return async function Http(req, res, next) {
debug(`External API request to ${req.url}`);
let apiKey = null;
let integration = null;
let user = null;
File posts.js
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
const urlUtils = require('../../../shared/url-utils');
const models = require('../../models');
const getPostServiceInstance = require('../../services/posts/posts-service');
const allowedIncludes = [
'tags',
Function getAggregatedClickEvents
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getAggregatedClickEvents(options = {}, filter) {
let postId = '';
if (filter && filter.$and) {
// Case when there is an $and condition
File OEmbedService.js
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const logging = require('@tryghost/logging');
const _ = require('lodash');
const charset = require('charset');
Function fetchLinkData
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
fetchLinkData(site, member) {
const qParams = new URLSearchParams(window.location.search);
if (qParams.get('action') === 'unsubscribe') {
// if the user is unsubscribing from a newsletter with an old unsubscribe link that we can't validate, push them to newsletter mgmt where they have to log in
if (qParams.get('key') && qParams.get('uuid')) {
Function add
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
add(apiConfig, frame, options = {add: true}) {
debug('add');
if (_.get(frame,'options.source')) {
const html = frame.data.posts[0].html;
- 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"