Showing 91 of 91 total issues
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;
Identical blocks of code found in 2 locations. Consider refactoring. Open
{
/*
* TC39 categorises proposals for babel in 4 stages
* Read more http://babeljs.io/docs/usage/experimental/
*/
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 74.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
{
/*
* TC39 categorises proposals for babel in 4 stages
* Read more http://babeljs.io/docs/usage/experimental/
*/
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 74.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
componentDidMount() {
const imageEl = document.getElementById('ogImage');
isImageSmall(imageEl).then((res) => {
if(res.isSmall) {
this.setState({summaryClass: 'summary-column'});
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 72.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
componentDidMount() {
const imageEl = document.getElementById('twImage');
isImageSmall(imageEl).then((res) => {
if(res.isSmall) {
this.setState({summaryClass: 'summary-column'});
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 72.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 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 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 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 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 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 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 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 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:
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;