Showing 1,820 of 4,015 total issues
Function getLastEventTimestamp
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
async getLastEventTimestamp(jobName, events = ['delivered', 'opened', 'failed']) {
const startDate = new Date();
let maxOpenedAt;
let maxDeliveredAt;
- 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 trimSameAs
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function trimSameAs(data, context) {
const sameAs = [];
if (context === 'post' || context === 'page') {
if (data[context].primary_author.website) {
- 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 optimiseFilterCacheability
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function optimiseFilterCacheability(resource, options) {
const noOptimisation = {
options,
parseResult(result) {
return result;
- 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 transformApiSiteData
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export function transformApiSiteData({site}) {
try {
if (!site) {
return 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 PortalLinks
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const PortalLinks: React.FC = () => {
const [isDataAttributes, setIsDataAttributes] = useState(false);
const [selectedTier, setSelectedTier] = useState('');
const {siteData} = useGlobalData();
const {data: {tiers: allTiers} = {}} = useBrowseTiers();
- 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 NewsletterDetailModalContent
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const NewsletterDetailModalContent: React.FC<{newsletter: Newsletter; onlyOne: boolean;}> = ({newsletter, onlyOne}) => {
const {config} = useGlobalData();
const {mutateAsync: editNewsletter} = useEditNewsletter();
const {updateRoute} = useRouting();
const handleError = useHandleError();
- 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 URLTextField
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const URLTextField: React.FC<URLTextFieldProps> = ({baseUrl, value, transformPathWithoutSlash, nullable, onChange, ...props}) => {
const [displayedUrl, setDisplayedUrl] = useState('');
const {setFocusState} = useFocusContext();
useEffect(() => {
- 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 ContentBox
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const ContentBox: React.FC<Props> = ({done}) => {
const luminance = (r: number, g: number, b: number) => {
const a = [r, g, b].map(function (v) {
v /= 255;
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
- 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 btnStyles
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function btnStyles(options = {}) {
let button = 'dib midgrey btn-base br3 ba b--lightgrey-l1 pointer glow';
let span = 'f8 fw5 tracked-2 dib pt0 pb0 tc';
// Set style
Function chartOptions
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
get chartOptions() {
return {
cutoutPercentage: 70,
title: {
display: false
Function mockMembersStats
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function mockMembersStats(server) {
server.get('/members/stats/count', withPermissionsCheck(ALLOWED_ROLES, function (db, {queryParams}) {
let {days} = queryParams;
let firstSubscriberDays = faker.datatype.number({min: 30, max: 600});
Function mockThemes
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function mockThemes(server) {
server.get('/themes');
server.get('/themes/active/', function ({themes}) {
const theme = themes.findBy({active: true});
Function getDonationEvents
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getDonationEvents(options = {}, filter) {
options = {
...options,
withRelated: [
'member',
Function sanitizeData
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
sanitizeData: function sanitizeData(data) {
const tableName = _.result(this.prototype, 'tableName');
let date;
_.each(data, (value, property) => {
Function init
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
init() {
if (this.service) {
return;
}
Function constructor
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor({SettingsModel, settingsCache, labsService, mail, singleUseTokenProvider, urlUtils, emailAddressService}) {
this.SettingsModel = SettingsModel;
this.settingsCache = settingsCache;
this.labs = labsService;
this.emailAddressService = emailAddressService;
Function add
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
add({notifications}) {
const defaults = {
dismissible: true,
location: 'bottom',
status: 'alert',
Function addTableColumn
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addTableColumn(tableName, tableBuilder, columnName, columnSpec = schema[tableName][columnName]) {
let column;
// creation distinguishes between text with fieldtype, string with maxlength and all others
if (columnSpec.type === 'text' && Object.prototype.hasOwnProperty.call(columnSpec, 'fieldtype')) {
Function getStructuredData
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getStructuredData(metaData) {
let structuredData;
let card = 'summary';
if (metaData.twitterImage || metaData.coverImage.url) {
Function mockIntegrations
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function mockIntegrations(server) {
server.get('/integrations/', paginatedResponse('integrations'));
server.post('/integrations/', function ({integrations}, {requestBody}) {
let body = JSON.parse(requestBody);