Showing 1,820 of 4,015 total issues
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.pages[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"
Further reading
Function beforeImport
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
beforeImport() {
debug('beforeImport');
const activeTheme = _.find(this.dataToImport, {key: 'active_theme'});
- 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 RecommendationItem
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
const RecommendationItem = (recommendation) => {
const {t, onAction, member, site} = useContext(AppContext);
const {title, url, description, favicon, one_click_subscribe: oneClickSubscribe, featured_image: featuredImage} = recommendation;
const allowOneClickSubscribe = member && oneClickSubscribe;
const [subscribed, setSubscribed] = useState(false);
- 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 NewsletterPreviewContent
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
}> = ({
senderName,
senderEmail,
senderReplyTo,
headerImage,
- 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 permissible
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
permissible: function permissible(postModelOrId, action, context, unsafeAttrs, loadedPermissions, hasUserPermission, hasApiKeyPermission) {
const self = this;
const postModel = postModelOrId;
let origArgs;
let isContributor;
Function AboutModal
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AboutModal = NiceModal.create<RoutingModalProps>(({}) => {
const {updateRoute} = useRouting();
const globalData = useGlobalData();
let config = globalData.config;
const upgradeStatus = useUpgradeStatus();
Function getAction
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
getAction(event, hasMultipleNewsletters) {
if (event.type === 'signup_event' || (event.type === 'subscription_event' && event.data.type === 'created' && event.data.signup)) {
return 'signed up';
}
Function mockPosts
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function mockPosts(server) {
server.post('/posts', function ({posts, users, tags}) {
let attrs = this.normalizedRequestAttrs();
attrs.authors = extractAuthors(attrs, users);
Function onTitleKeydown
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
@action
onTitleKeydown(event) {
if (this.feature.editorExcerpt) {
// move cursor to the excerpt on
// - Tab (handled by browser)
- 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 handleSubscriptionEvent
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
async handleSubscriptionEvent(session) {
const customer = await this.api.getCustomer(session.customer, {
expand: ['subscriptions.data.default_payment_method']
});
- 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 setResponseContext
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function setResponseContext(req, res, data) {
const pageParam = req.params && req.params.page !== undefined ? parseInt(req.params.page, 10) : 1;
res.locals = res.locals || {};
res.locals.context = [];
- 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 unsubscribeController
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
module.exports = async function unsubscribeController(req, res) {
debug('unsubscribeController');
const {query} = url.parse(req.url, 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 fetchOembedDataFromUrl
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
async fetchOembedDataFromUrl(url, type, options = {}) {
try {
const urlObject = new URL(url);
// YouTube has started not returning oembed <link>tags for some live URLs
- 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 UnsubscribePage
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export default function UnsubscribePage() {
const {site, api, pageData, member: loggedInMember, onAction, t} = useContext(AppContext);
// member is the member data fetched from the API based on the uuid and its state is limited to just this modal, not all of Portal
const [member, setMember] = useState();
const [loading, setLoading] = useState(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 Sidebar
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
validate: () => void}> = ({clearError, errors, offer, updateOffer}) => {
const {siteData} = useGlobalData();
const [isCopied, setIsCopied] = useState(false);
const handleError = useHandleError();
const {mutateAsync: editOffer} = useEditOffer();
- 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
File RecommendationsPage.js
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
import AppContext from '../../AppContext';
import {useContext, useState, useEffect, useCallback, useMemo} from 'react';
import CloseButton from '../common/CloseButton';
import {clearURLParams} from '../../utils/notifications';
import LoadingPage from './LoadingPage';
Function replaceIdentifiers
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
replaceIdentifiers() {
const ownerUserId = _.find(this.requiredExistingData.users, (user) => {
if (user.roles[0].name === 'Owner') {
return true;
}
Function foreach
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function foreach(items, options) {
if (!options) {
logging.warn(tpl(messages.iteratorNeeded));
}
Function EmailReceivingPage
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function EmailReceivingPage() {
const {brandColor, onAction, site, lastPage, member, t, pageData} = useContext(AppContext);
const supportAddressEmail = getSupportAddress({site});
const supportAddress = `mailto:${supportAddressEmail}`;
Function render
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {page, pageQuery, site, customSiteUrl} = this.context;
const products = getSiteProducts({site});
const noOfProducts = products.length;