Showing 54 of 54 total issues

Function exports has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(config) {
  /**
   * Server listening port.
   */
  config.port = (process.env.PORT || 3000);
Severity: Major
Found in src/config/base.js - About 5 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      _addValidator (def) {
        if (_.isGenFn(def)) {
          return this.validators.push({
            fn: def
          });
    Severity: Major
    Found in src/support/forms/field.js and 1 other location - About 5 hrs to fix
    src/support/forms/field.js on lines 94..112

    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 137.

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      _addSanitizer (def) {
        if (_.isGenFn(def)) {
          return this.sanitizers.push({
            fn: def
          });
    Severity: Major
    Found in src/support/forms/field.js and 1 other location - About 5 hrs to fix
    src/support/forms/field.js on lines 69..87

    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 137.

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      try {
        yield form.process();
    
        yield this.render('index', {
          alert: 'We have emailed you a link to reset your password'
    Severity: Major
    Found in src/controllers/user.js and 1 other location - About 4 hrs to fix
    src/controllers/user.js on lines 207..224

    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 118.

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      try {
        yield form.process();
    
        yield this.render('index', {
          alert: 'Your new password has been saved'
    Severity: Major
    Found in src/controllers/user.js and 1 other location - About 4 hrs to fix
    src/controllers/user.js on lines 154..171

    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 118.

    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

    Further Reading

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

    loader.init = function*(options) {
      if (loader[$FILE]) {
        debug('Waigo was already initialised. Re-initialising...');
    
        loader.reset();
    Severity: Major
    Found in src/loader.js - About 4 hrs to fix

      File user.js has 306 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      "use strict";
      
      const crypto = require('crypto');
      
      const waigo = global.waigo,
      Severity: Minor
      Found in src/models/user.js - About 3 hrs to fix

        Function exports has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function(options) {
          return function*(context, field, value) {
            let fields = field.form.fields,
              otherField = fields[options.field]
        
        
        Severity: Minor
        Found in src/support/forms/validators/compareToField.js - About 3 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 init has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        loader.init = function*(options) {
          if (loader[$FILE]) {
            debug('Waigo was already initialised. Re-initialising...');
        
            loader.reset();
        Severity: Minor
        Found in src/loader.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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          _buildAuthorizeParams () {
            let params = _.extend({}, _.get(this.config, 'authorizeParams'));
        
            let callbackParamName = _.get(this.config, 'callbackParam', 'redirect_uri');
        
        
        Severity: Major
        Found in src/support/oauth/providers/generic.js and 1 other location - About 2 hrs to fix
        src/support/oauth/providers/generic.js on lines 241..249

        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 77.

        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

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          _buildAccessTokenParams () {
            let params = _.extend({}, _.get(this.config, 'accessTokenParams'));
        
            let callbackParamName = _.get(this.config, 'callbackParam', 'redirect_uri');
        
        
        Severity: Major
        Found in src/support/oauth/providers/generic.js and 1 other location - About 2 hrs to fix
        src/support/oauth/providers/generic.js on lines 230..238

        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 77.

        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

        Further Reading

        Function process has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          * process (token, options) {
            options = options || {};
            
            this.logger.debug(`Processing action token: ${token}`);
        
        
        Severity: Major
        Found in src/support/actionTokens.js - About 2 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                yield App.mailer.send({
                  to: user,
                  subject: 'Thanks for signing up!',
                  bodyTemplate: 'signupWelcome',
                  templateVars: {
          Severity: Major
          Found in src/forms/register.js and 1 other location - About 1 hr to fix
          src/forms/forgotPassword.js on lines 47..58

          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 70.

          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

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                yield App.mailer.send({
                  to: user,
                  subject: 'Reset your password',
                  bodyTemplate: 'resetPassword',
                  templateVars: {
          Severity: Major
          Found in src/forms/forgotPassword.js and 1 other location - About 1 hr to fix
          src/forms/register.js on lines 57..68

          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 70.

          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

          Further Reading

          Function exports has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(options) {
            return function*(context, field, value) {
              let fields = field.form.fields,
                otherField = fields[options.field]
          
          
          Severity: Minor
          Found in src/support/forms/validators/compareToField.js - About 1 hr to fix

            Function run has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              * run () {
                if (!this.fileExists('package.json')) {
                  return this.log('Please run "npm init" first');
                }
            
            
            Severity: Minor
            Found in src/cli/init-gulp.js - About 1 hr to fix

              Function exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = function(App, options) {
                return function*(next) {
                  this.App.logger.debug('assertUser is logged in');
              
                  try {
              Severity: Minor
              Found in src/support/middleware/assertUser.js - About 1 hr 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 _buildRoutes has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _buildRoutes (commonMiddleware, urlPath, node, parentConfig) {
                  urlPath = parentConfig.urlPath + urlPath;
              
                  logger.debug('Build route', urlPath);
              
              
              Severity: Minor
              Found in src/support/routeMapper.js - About 1 hr to fix

                Function exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function(App, options) {
                  let enabledFormats = {};
                
                  let formatNames = Object.keys(options.formats);
                
                
                Severity: Minor
                Found in src/support/middleware/outputFormats.js - About 1 hr to fix

                  Function getAccessToken has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    * getAccessToken (code) {
                      let user = this._user();
                  
                      this.logger.info(`Get access token: user=${user ? user.id : 'anon'} code=${code}`);
                  
                  
                  Severity: Minor
                  Found in src/support/oauth/providers/generic.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language