namchey/linkpreview

View on GitHub

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 = `
Severity: Major
Found in app/Scrape/server.jsx - About 3 hrs to fix

    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
    Severity: Major
    Found in webpack/production/common-loaders.prod.js - About 2 hrs to fix

      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) {
      Severity: Minor
      Found in server/express/translations.js - About 2 hrs to fix

      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({
      Severity: Major
      Found in modules/application/services/mailer.js - About 2 hrs to fix

        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');
                    }
        Severity: Minor
        Found in app/utils/polyfills.js - About 2 hrs to fix

        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;
        Severity: Minor
        Found in modules/application/controllers/errors.js - About 2 hrs to fix

        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;
        Severity: Minor
        Found in modules/application/controllers/errors.js - About 2 hrs to fix

          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);
          Severity: Minor
          Found in app/Scrape/Index/index.js - About 1 hr to fix

            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;
            Severity: Minor
            Found in webpack/production/webpack.base.config.prod.js - About 1 hr to fix

              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';
              Severity: Minor
              Found in modules/application/controllers/oembed.js - About 1 hr to fix

                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) {
                Severity: Minor
                Found in server/express/translations.js - About 1 hr to fix

                  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'
                  Severity: Minor
                  Found in webpack/production/common-plugins.prod.js - About 1 hr to fix

                    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;
                    Severity: Minor
                    Found in webpack/production/webpack.base.config.prod.js - About 1 hr to fix

                      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
                      Severity: Minor
                      Found in webpack/development/webpack.config.dev-server.base.js - About 1 hr to fix

                        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
                        Severity: Minor
                        Found in webpack/production/common-loaders-server.prod.js - About 1 hr to fix

                          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
                          Severity: Minor
                          Found in modules/application/controllers/errors.js - About 1 hr to fix

                            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',
                            Severity: Minor
                            Found in webpack/development/webpack.config.dev-client.base.js - About 1 hr to fix

                              Function init has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              exports.init =  (db) => {
                              
                                // Initialize express app
                                const app = express();
                              
                              
                              Severity: Minor
                              Found in server/express/index.js - About 1 hr to fix

                                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');
                                Severity: Minor
                                Found in modules/application/controllers/errors.js - About 1 hr to fix

                                  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:
                                  
                                  
                                  Severity: Minor
                                  Found in app/Scrape/reducers/scrape.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language