Showing 417 of 2,650 total issues
Avoid too many return
statements within this function. Open
return <EmbedHtml embeddableContent={html} />;
Function getCert
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getCert = async () => {
const caPath = process.env.CA_PATH || '/etc/pki/tls/certs/ca-bundle.crt';
const certChainPath =
process.env.CERT_CHAIN_PATH || '/etc/pki/tls/certs/client.crt';
const keyPath = process.env.KEY_PATH || '/etc/pki/tls/private/client.key';
- 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 getRouteProps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getRouteProps = url => {
const matchedRoutes = matchRoutes(routes, url);
const route = path([0, 'route'], matchedRoutes);
const match = path([0, 'match'], matchedRoutes);
- 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 processBlock
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const processBlock = _block => {
const block = { ..._block };
if (path(['text'], block)) {
// catch plain_text ARES response for legacy MAPs with <link> elements
- 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 convertToBlocks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const convertToBlocks = (node, attributes = []) =>
pathOr([], ['children'], node).reduce((acc, childNode) => {
if (isXmlNodeSupported(childNode, attributes)) {
return handleSupportedNodes(childNode, attributes, acc);
}
- 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 xmlNodeToBlock
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const xmlNodeToBlock = (node, attributes) => {
if (!is(Object, node)) return undefined;
if (node.type === 'text') {
return fragment(node.text, attributes);
- 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 RecentAudioEpisodes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const RecentAudioEpisodes = ({
masterBrand,
episodes,
brandId = '',
pageType,
- 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 getProviderFromSource
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getProviderFromSource = source => {
if (source.match(/^https:\/\/twitter\.com/)) {
return PROVIDERS.TWITTER;
}
if (source.match(/^https:\/\/www\.instagram\.com/)) {
- 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 IndexPageSection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const IndexPageSection = ({
bar = true,
group,
sectionNumber,
showAllPromos = 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 CpsOnwardJourney
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const CpsOnwardJourney = ({
className = '',
LabelComponent = StyledSectionLabel,
labelId,
title = '',
- 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 getImageBlock
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getImageBlock = (type, blockData, isAmp) => {
const supportedImageTypes = ['idt2'];
const imageData = blockData[type];
- 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 squashTopStories
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const squashTopStories = jsonRaw => {
const json = jsonRaw;
let groups = pathOr(null, ['content', 'groups'], json);
let collectedItems = [];
let collectedStrapline;
- 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 NielsenAnalytics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const NielsenAnalytics = () => {
const { service, isAmp, pathname } = useContext(RequestContext);
// nielsenAnalytics toggle only set up as local toggle at the moment...
const { enabled } = useToggle('nielsenAnalytics');
- 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 enrichBlocks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const enrichBlocks = (accumulator, block, index, blocks) => {
const embedUrl = getEmbedUrl(block);
const embedProvider = getEmbedProvider(block);
const source = getSource(block);
- 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 IncludeContainer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const IncludeContainer = props => {
const { isAmp, isLite, canonicalLink } = useContext(RequestContext);
const { translations } = useContext(ServiceContext);
const { enabled } = useToggle('include');
- 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 CpsRecommendations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const CpsRecommendations = ({ items = [] }) => {
const { recommendations, translations, script, service, dir } =
useContext(ServiceContext);
const { pageType } = useContext(RequestContext);
const { enabled } = useToggle('cpsRecommendations');
- 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 getVariantRedirectUrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getVariantRedirectUrl = ({ path, params, service, variant }) => {
if (!path) return null;
const cookieVariant = getPreferredVariant(service);
const defaultVariant = getVariant({
- 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 Header
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Header = ({ brandRef, borderBottom, skipLink, scriptLink, linkId }) => {
const [showConsentBanner, setShowConsentBanner] = useState(true);
const handleBannerBlur = event => {
const isRejectButton =
- 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 convertInclude
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const convertInclude = async (includeBlock, pageData, ...restParams) => {
const { href, type } = includeBlock;
if (!href) {
logger.error(INCLUDE_MISSING_URL, includeBlock);
- 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 ScrollablePromo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const ScrollablePromo = ({ blocks, blockGroupIndex = null }) => {
const { script, service, dir, translations } = useContext(ServiceContext);
const eventTrackingData = {
componentName: `edoj${blockGroupIndex}`,
- 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"