Showing 390 of 2,206 total issues
Function didSuppressWarning
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const didSuppressWarning = (message, ...rest) => {
const { expectedWarnings } = window;
if (SUPPRESSED_REGEX.test(message)) {
return 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
Avoid deeply nested control flow statements. Open
for (h = n.b1; h <= n.b2; h++) c += r[e(a, s, h)] || 0;
Avoid deeply nested control flow statements. Open
for (c = 0, s = n.r1; s <= n.r2; s++)
for (h = n.g1; h <= n.g2; h++) c += r[e(s, h, a)] || 0;
Function dealWithNonNumericCharacters
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const dealWithNonNumericCharacters = (versionString, timeJson) => {
const patchVersion = versionString.match(/patch/);
if (patchVersion) {
const possibleVersionStrings = versionString.match(
/@npm:([\d.]+)|@([\d.]+)/,
- 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
Avoid deeply nested control flow statements. Open
for (c = 0, s = n.r1; s <= n.r2; s++)
for (h = n.b1; h <= n.b2; h++) c += r[e(s, a, h)] || 0;
Function getStatsDestination
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getStatsDestination = ({ isUK = true, env = 'test', service }: Props) => {
let destination = '';
switch (service) {
case 'news':
// checks if "news" service is in the UK or not and set apprioprate destination
- 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 ImageWithPlaceholder
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const ImageWithPlaceholder = ({
alt,
children = null,
copyright = null,
fade = 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 getToggles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getToggles = async (service, cache) => {
const environment = getEnvConfig().SIMORGH_APP_ENV || 'local';
const timeout =
parseInt(getEnvConfig().SIMORGH_CONFIG_TIMEOUT_SECONDS, 10) * 1000;
const localToggles = defaultToggles[environment];
- 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 EventTrackingContextProvider
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const EventTrackingContextProvider = ({
children,
data,
atiData,
}: PropsWithChildren<EventTrackingProviderProps>) => {
- 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 BulletinContainer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const BulletinContainer = ({ item, lazyLoadImage = true }) => {
const { script, service, dir, translations } = useContext(ServiceContext);
const headline = pathOr(null, ['name'], item);
const ctaLink = pathOr(null, ['uri'], item);
- 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 Content
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const Content = ({
mediaDuration = '',
headline,
isPhotoGallery = false,
isLive = 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 HealthFactors
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const HealthFactors = ({ metadata }: HealthFactorsProps) => {
const uxAccessibility = path(['uxAccessibilityDoc'], metadata);
const uxSwarm = path(['swarm'], metadata);
const acceptanceCriteria = path(['acceptanceCriteria'], metadata);
- 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 MostRead
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const MostRead = ({
data,
columnLayout = 'multiColumn',
size = 'default',
mobileDivider = 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
Consider simplifying this complex logical expression. Open
if (u = f[n++].exec(e))
for (o = 0; o < p.length; o++)
l = u[++r],
typeof (a = p[o]) === c && a.length > 0 ? 2 == a.length ? typeof a[1] == s ? this[a[0]] = a[1].call(this, l) : this[a[0]] = a[1] : 3 == a.length ? typeof a[1] !== s || a[1].exec && a[1].test ? this[a[0]] = l ? l.replace(a[1], a[2]) : i : this[a[0]] = l ? a[1].call(this, l, a[2]) : i : 4 == a.length && (this[a[0]] = l ? a[3].call(this, l.replace(a[1], a[2])) : i) : this[a] = l || i;
Consider simplifying this complex logical expression. Open
if (
!children ||
children.length === 0 ||
isRoot ||
docsOnly ||
Function J
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
J = function(e, t, n, r, o) {
Function fetch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
}, n.fetch = function(e, t, r, o, i) {
Function fetchEventHandler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const fetchEventHandler = async event => {
if (
/^https:\/\/ichef(\.test)?\.bbci\.co\.uk\/(news|images|ace\/(standard|ws))\/.+.webp$/.test(
event.request.url,
)
- 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 getMvtExperiments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getMvtExperiments = (headers, service, derivedPageType) => {
return Object.entries(headers).reduce((result, [header, content]) => {
if (header.startsWith('mvt-')) {
const noMvtPrefixHeader = header.slice(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 HeadingsContainer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const HeadingsContainer = ({
blocks = [
{
model: {
blocks: [
- 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"