Showing 390 of 2,206 total issues
Function getMvtExperiments
has 29 lines of code (exceeds 25 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);
Function e
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function e() {
var e = this;
this.commandHandlerMap = {
setAwsCredentials: function(t) {
e.orchestration.setAwsCredentials(t)
Function f
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function f(e) {
var t,
n,
r = [];
try {
Function e
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function e(e) {
var t = e.applyChecksum,
n = e.credentials,
r = e.region,
o = e.service,
Function useCombinedClickTrackerHandler
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const useCombinedClickTrackerHandler = eventTrackingData => {
const blockData = path(['block'], eventTrackingData);
const linkData = path(['link'], eventTrackingData);
const optimizely = path(['block', 'optimizely'], eventTrackingData);
const handleBlockLevelClick = useClickTrackerHandler({
Function renderContainer
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderContainer = (service: Services, pageData: Article) => {
const toggleState = {
cpsRecommendations: {
enabled: true,
},
Function hashBuffer
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
}, e.prototype.hashBuffer = function() {
for (var e = this.buffer, t = this.state, n = t[0], o = t[1], i = t[2], s = t[3], a = t[4], c = t[5], u = t[6], l = t[7], d = 0; d < r.BLOCK_SIZE; d++) {
if (d < 16)
this.temp[d] = (255 & e[4 * d]) << 24 | (255 & e[4 * d + 1]) << 16 | (255 & e[4 * d + 2]) << 8 | 255 & e[4 * d + 3];
else {
Function getServerSideProps
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getServerSideProps: GetServerSideProps = async context => {
const {
resolvedUrl,
query: { service, variant },
req: { headers: reqHeaders },
Function Component
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Component = () => {
return (
<RequestContextProvider
pathname="/pathname"
pageType="avEmbeds"
Function generateLinks
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const generateLinks = (service, env, domain) => {
const output = [];
const {
frontPage,
- 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 ordinal
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
ordinal: function (number) {
var b = number % 10,
output =
~~((number % 100) / 10) === 1
? 'th'
- 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 withOptimizelyProvider
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const withOptimizelyProvider = Component => {
return props => {
const { service } = useContext(ServiceContext);
const isStoryBook = process.env.STORYBOOK;
const disableOptimizely = isStoryBook;
- 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 avg
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
avg: function (t) {
var n = this.histo;
if (!this._avg || t) {
var o,
i,
Function getCredentialsForIdentity
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.getCredentialsForIdentity = function(e) {
return i(t, void 0, void 0, (function() {
var t,
n;
return s(this, (function(r) {
Function getRouteProps
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getRouteProps = url => {
const matchedRoutes = matchRoutes(routes, url);
const route = path([0, 'route'], matchedRoutes);
const match = path([0, 'match'], matchedRoutes);
Function NielsenAnalytics
has 27 lines of code (exceeds 25 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');
Function buildRSSMarketingString
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const buildRSSMarketingString = href => {
const { query, hash } = new Url(href, true);
const queryWithParams = hash ? parameteriseHash(hash) : query;
Function getType
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getType = (pageType: PageTypes | 'index', shorthand = false) => {
switch (pageType) {
case FRONT_PAGE:
case 'index':
return shorthand ? 'IDX' : 'Index';
Function getArticleTopStoryItem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getArticleTopStoryItem = (item: TopStoryItem) => {
const overtypedHeadline = item?.headlines?.overtyped ?? '';
const mainHeadline = item?.headlines?.headline ?? '';
const headlineBlockText =
// @ts-expect-error - nested block structure
Function dealWithCaretsAndTildes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const dealWithCaretsAndTildes = (versionString, timeJson) => {
const plainVersion = versionString.match(/^[\d.]+$/g);
if (plainVersion) {
return versionString; // if it's just numbers and dots
}