Showing 1,813 of 3,998 total issues
Function ghost_foot
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function ghost_foot(options) { // eslint-disable-line camelcase
const foot = [];
const globalCodeinjection = settingsCache.get('codeinjection_foot');
const postCodeinjection = options.data.root && options.data.root.post ? options.data.root.post.codeinjection_foot : null;
- 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 getRssUrl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getRssUrl(options) {
let rssUrl = null;
const collectionIndexRouter = _.find(routers, {name: 'CollectionRouter', routerName: 'index'});
- 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 getMembersHelper
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getMembersHelper(data, frontendKey) {
// Do not load Portal if both Memberships and Tips & Donations are disabled
if (!settingsCache.get('members_enabled') && !settingsCache.get('donations_enabled')) {
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 makePathsAbsolute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const makePathsAbsolute = function makePathsAbsolute(nconf, obj, parent) {
_.each(obj, function (configValue, pathsKey) {
if (_.isObject(configValue)) {
makePathsAbsolute(nconf, configValue, parent + ':' + pathsKey);
} else if (
- 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 excerpt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function excerpt(options) {
let truncateOptions = (options || {}).hash || {};
let excerptText;
- 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 getUrl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getUrl(data, absolute) {
if (checks.isPost(data)) {
/**
* @NOTE
*
- 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 buildLinkClasses
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports.buildLinkClasses = function buildLinkClasses(siteUrl, href, options) {
let relativeHref = href.replace(siteUrl, '');
let location = options.data.root.relativeUrl;
let classes = options.hash.class ? options.hash.class.toString().split(' ') : [];
let activeClass = _.has(options.hash, 'activeClass') ? options.hash.activeClass : 'nav-current';
- 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 HighlightedSection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function HighlightedSection({text = '', highlight = '', isExcerpt}) {
text = text || '';
highlight = highlight || '';
let {parts, highlightIndexes} = getHighlightParts({text, highlight});
if (isExcerpt && highlightIndexes?.[0]) {
- 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 fromApiResponse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static async fromApiResponse(res) {
// Bad request + Too many requests
if (res.status === 400 || res.status === 429) {
try {
const json = await res.json();
- 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 InputField
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function InputField({
name,
id,
hidden,
label,
- 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 getActiveInterval
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getActiveInterval({portalPlans, portalDefaultPlan, selectedInterval}) {
if (selectedInterval === 'month' && portalPlans.includes('monthly')) {
return 'month';
}
- 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 fetchData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function fetchData(pathOptions, routerOptions, locals) {
pathOptions = pathOptions || {};
routerOptions = routerOptions || {};
let postQuery = _.cloneDeep(defaultPostQuery);
- 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 getUpdatedOfferPrice
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const getUpdatedOfferPrice = ({offer, price, useFormatted = false}) => {
const originalAmount = price.amount;
let updatedAmount;
if (offer.type === 'fixed' && isSameCurrency(offer.currency, price.currency)) {
updatedAmount = ((originalAmount - offer.amount)) / 100;
- 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 handleStripeActions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const handleStripeActions = ({status, billingOnly}) => {
if (!billingOnly && ['success'].includes(status)) {
const statusVal = ['success'].includes(status) ? 'success' : 'warning';
return {
type: 'stripe:checkout',
- 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 fetchNotificationData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
fetchNotificationData() {
const {type, status, duration, autoHide, closeable} = NotificationParser({billingOnly: true}) || {};
if (['stripe:billing-update'].includes(type)) {
if (status === 'success') {
const popupNotification = createPopupNotification({
- 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 FeedbackPage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function FeedbackPage() {
const {site, pageData, member, t, api} = useContext(AppContext);
const {uuid, key, postId, score: initialScore} = pageData;
const [score, setScore] = useState(initialScore);
const positive = score === 1;
- 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 getContextPage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getContextPage({site, page, member}) {
/**Set default page based on logged-in status */
if (!page || page === 'default') {
const loggedOutPage = isInviteOnlySite({site}) ? 'signin' : 'signup';
page = member ? 'accountHome' : loggedOutPage;
- 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 processPayload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async processPayload(payload: Payload) {
if (this.labs.isSet(MailEventService.LABS_KEY) === false) {
throw new errors.NotFoundError();
}
- 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 constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(protected attr: Data & Optional<BaseEntityData>, actor?: Actor) {
this.attr = attr;
if (!this.attr.id) {
this.attr.id = new ObjectID();
}
- 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 scrollSidebarNav
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const scrollSidebarNav = (navElement: HTMLLIElement, doneInitialScroll: boolean) => {
// const sidebar = document.getElementById('admin-x-settings-sidebar')!;
const sidebar = document.getElementById('admin-x-settings-sidebar-scroller')!;
const bounds = navElement.getBoundingClientRect();
- 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"