Showing 54 of 91 total issues
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { routeLoading, isCodeLoading, appLoaded, locationBeforeTransitions } = this.props;
const isLoading = !appLoaded || isCodeLoading || routeLoading;
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (app) => {
const defaultWhiteList = require(path.resolve('./server/cors/whitelist')).whitelist;
const domainWhiteList = config.domains;
const whiteList = defaultWhiteList.concat(domainWhiteList);
const corsOptionsDelegate = function (req, callback) {
Function app
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function app(state=initialState.app, action={}) {
deepFreeze(state);
switch (action.type) {
Function value
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
value: function(value) {
// Steps 1-2.
if (this == null) {
throw new TypeError('this is null or not defined');
- 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 getEmbed
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.getEmbed = function(req, res, next) {
const url = req.query.url;
const format = req.query.format || 'json';
- 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 track
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.track = ({req, config, agentInfo}) => {
if(config.query) {
if(!config.query.utm_source && !req.query.utm_source) return;
if(!config.query.utm_medium && !req.query.utm_medium) return;
- 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 render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { children, dispatch, appLoaded, netError, appMessage, showNetErrorComponent } = this.props;
return (
<div>
<div className={cx('app')}>
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { opengraph, scrape } = this.props;
let hostname = '';
if(opengraph['og:url']) {
hostname = new URL(opengraph['og:url']).hostname;
Function hanldeCallback
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const hanldeCallback = (req, res) => (err, json, body) => {
if(err) {
return res.status(500).json(err);
}
Function server
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.server = (config) => {
return [
// Order the modules and chunks by occurrence.
// This saves space, because often referenced modules
// and chunks get smaller ids.
Function publish
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.publish = (config, req) => {
/* sample config object
{
action: 'viewed',
- 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 forwardHeaders
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const forwardHeaders = ({req, axios, authenticated, isStaging}) => {
const requestInterceptor = axios.interceptors.request.use( (config) => {
if(req.headers['user-agent']) {
config.headers['user-agent'] = req.headers['user-agent'];
}
- 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 send
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.send = function(subject, template, variables, to, options) {
let _this = this;
if (!options) options = {};
options = _.extend({
- 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 logError
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.logError = (error, req) => {
if(!error instanceof Error) {
if(config.isDev || config.isTest) {
throw Error('err object should be instance of error');
- 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 getDescription
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function getDescription(scrape, cardType, displayType) {
const { json: { opengraph, twittercard, head } } = scrape;
if(cardType === 'twittercard') {
if(twittercard['twitter:description']) {
- 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
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
Function getTitle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function getTitle(scrape, cardType, displayType) {
const { json: { opengraph, twittercard, head } } = scrape;
if(cardType === 'twittercard') {
if(twittercard['twitter:title']) {
return truncateTitle(twittercard['twitter:title'], displayType);
- 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(config.query) {
if(!config.query.utm_source && !req.query.utm_source) return;
if(!config.query.utm_medium && !req.query.utm_medium) return;
if(!config.query.utm_campaign && !req.query.utm_campaign) return;
Function render
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export default function render(req, res, next, assetManifest, chunkManifest) {
Function send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.send = function(subject, template, variables, to, options) {