Showing 54 of 91 total issues
Function render
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function render(req, res, next, assetManifest, chunkManifest) {
axios.defaults.baseURL = `http://${req.clientConfig.host}:${req.clientConfig.port}`;
let styles = '';
let scripts = `
Function commonLoaders
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.commonLoaders = (config = {}) => {
return [
{
/*
* TC39 categorises proposals for babel in 4 stages
Function exports
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (app) => {
swig.setFilter('translate', require(path.resolve('./modules/application/services/swig/filter/translate')));
swig.setFilter('moment', require(path.resolve('./modules/application/services/swig/filter/moment')));
/*const mustache = require('i18n/node_modules/mustache');
mustache.escape = function(value) {
- 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 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.send = function(subject, template, variables, to, options) {
let _this = this;
if (!options) options = {};
options = _.extend({
Function assign
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
value: function assign(target, varArgs) { // .length of function is 2
'use strict';
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
- 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 apiErrors
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
exports.apiErrors = (err, req, res, next) => {
// If the error object doesn't exists
if(err === undefined) {
debug('promise breaker');
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 apiErrors
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.apiErrors = (err, req, res, next) => {
// If the error object doesn't exists
if(err === undefined) {
debug('promise breaker');
return;
Function render
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { scrape, isFetching, error, message, authenticated, isCodeLoading, appLoaded } = this.props;
if(scrape && scrape.json) {
/*Easy inpection from console*/
console.log('scrape', scrape);
Function server
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.server = (webpackConfig) => {
/*Server*/
//const serverEntryName = webpackConfig.serverEntryName;
//const serverEntryFile = webpackConfig.serverEntryFile;
Function getEmbed
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.getEmbed = function(req, res, next) {
const url = req.query.url;
const format = req.query.format || 'json';
Function exports
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (app) => {
swig.setFilter('translate', require(path.resolve('./modules/application/services/swig/filter/translate')));
swig.setFilter('moment', require(path.resolve('./modules/application/services/swig/filter/moment')));
/*const mustache = require('i18n/node_modules/mustache');
mustache.escape = function(value) {
Function client
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.client = (config = {}) => {
return [
//new WebpackMd5Hash(),
new ManifestPlugin({
fileName: 'asset-manifest.json'
Function client
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.client = (webpackConfig) => {
const publicPath = webpackConfig.publicPath;
const assetsPath = webpackConfig.assetsPath;
const vendors = webpackConfig.vendors;
Function exports
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (webpackConfig) => {
const { assetsPath, publicPath } = webpackConfig;
return {
// The configuration for the server-side rendering
Function commonLoaders
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.commonLoaders = (config = {}) => {
return [
{
/*
* TC39 categorises proposals for babel in 4 stages
Function logBrowserError
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.logBrowserError = (body = {}, req) => {
if (config.isProd) {
const fileLogContents = { ...body };
//delete screenshot field for loggin in file
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (webpackConfig) => {
const { assetsPath, publicPath } = webpackConfig;
return {
// eval - Each module is executed with eval and //@ sourceURL.
devtool: 'inline-source-map',
Function init
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.init = (db) => {
// Initialize express app
const app = express();
Function logError
has 30 lines of code (exceeds 25 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');
Function scrape
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function scrape(state = initialState.scrape, action) {
//deepFreeze(state);
switch (action.type) {
case types.GET_SCRAPE_REQUEST: