Showing 390 of 2,206 total issues
Function j
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
j = function() {
function e(e) {
this.plugins = new Map,
this.context = e
}
Function writeCsvFile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const writeCsvFile = data => {
let csvContents =
'Dependency,Type,Most Recent Version,Most Recent Version Date,Our Version,Our Version Date,Our Version Freshness in Days';
data
Function Image
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Image = props => {
const { children = null, src, useLargeImages = false, ...rest } = props;
const isProgrammeImage = src.startsWith(
'https://ichef.bbci.co.uk/images/ic/',
);
Function animationStory
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const animationStory = (dir, script, service) => {
const isOpen = boolean('Open', false);
return (
<Navigation script={script} service={service} dir={dir}>
<CanonicalDropdown isOpen={isOpen}>
Function inputs
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const inputs = () => {
// capitalization is only for presentation purpose on the knob
const options = Object.keys(svgs)
.filter(key => key !== 'BBC_BLOCKS')
.map(key => key.charAt(0).toUpperCase() + key.slice(1));
Function inputs
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const inputs = (service = 'news') => {
const options = Object.keys(svgs).filter(key => key !== 'BBC_BLOCKS');
const svgChoice = select('Service SVG', options, service).toLowerCase();
const productInput = text('Product', 'BBC News');
const serviceLocalisedNameInput = text('Localised service name', 'Yoruba');
Function getCampaignID
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getCampaignID = (pageType: CampaignPageTypes) => {
const campaignID = {
[ARTICLE_PAGE]: 'article',
[MEDIA_ARTICLE_PAGE]: 'article-sfv',
[FRONT_PAGE]: 'index-home',
Function extractHeaders
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const extractHeaders = (headers: IncomingHttpHeaders) => {
let isUK = null;
let showCookieBannerBasedOnCountry = true;
if (headers['x-bbc-edge-isuk']) {
isUK = headers['x-bbc-edge-isuk'] === 'yes';
Consider simplifying this complex logical expression. Open
if (Array.isArray(group.items)) {
newGroup.items = group.items.filter(item => {
const itemType = item.assetTypeCode || item.cpsType;
const isValidItemType = whitelist.includes(itemType);
const isValidContentType =
Consider simplifying this complex logical expression. Open
if (!F && !(F = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto)))
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
Function isSupportedClickModifier
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const isSupportedClickModifier = (event, functionKey) =>
(functionKey && !event.shiftKey && !event.altKey) || // functionKey
(event.shiftKey && functionKey && !event.altKey) || // shift + functionKey
(event.shiftKey && functionKey && event.altKey) || // shift + functionKey + option/alt
(event.shiftKey && event.altKey && !functionKey) || // shift + option/alt
- 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 extractBundlesForPageType
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
extractBundlesForPageType: pageType => {
if (pageType === 'ArticlePage') {
return [
'modern.ArticlePage-31ecd969.31473c35.js',
'modern.commons-1111.js',
- 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 validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const validate = ({
output,
expectedOutput,
device,
currentPage,
- 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 MetadataContainer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const MetadataContainer = ({
title,
socialHeadline,
lang,
twitterHandle,
- 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 findNthIndex
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const findNthIndex = (n, predicate, inputArray) => {
if (!validateInputs(n, predicate, inputArray)) return -1;
let count = 0;
for (let i = 0; i < inputArray.length; i += 1) {
if (n - count > inputArray.length - i) break;
- 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 isValidFiles
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const isValidFiles: (data: FieldData) => FieldData = (data: FieldData) => {
const { value: files, required, wasInvalid, fileTypes, min, max } = data;
const MAX_PAYLOAD_SIZE = 1288490189;
const RESERVED_FORM_DATA_SIZE = 10000;
// we're making the assumption that each file chooser field is only allowed the max payload size less some for data (estimated maximum size ever needed)
- 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 MediaLoader
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const MediaLoader = ({ blocks, className, embedded }: Props) => {
const { lang, translations } = useContext(ServiceContext);
const { pageIdentifier } = useContext(EventTrackingContext);
const { enabled: adsEnabled } = useToggle('ads');
- 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 OnDemandAudioPage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const OnDemandAudioPage = ({
pageData,
mediaIsAvailable,
MediaError,
}: OnDemandAudioProps) => {
- 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 RelatedContentSection
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const RelatedContentSection = ({ content }: { content: OptimoBlock[] }) => {
const { translations, script, service } = useContext(ServiceContext);
const {
palette: { GREY_2 },
- 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 u
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function u(t, r, n, o, e, i, u) {