DaftMonk/fullstack-demo

View on GitHub

Showing 21 of 21 total issues

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

module.exports = function (grunt) {
  var localConfig;
  try {
    localConfig = require('./server/config/local.env');
  } catch(e) {
Severity: Major
Found in Gruntfile.js - About 2 days to fix

    File Gruntfile.js has 541 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Generated on 2014-08-29 using generator-angular-fullstack 2.0.13
    'use strict';
    
    module.exports = function (grunt) {
      var localConfig;
    Severity: Major
    Found in Gruntfile.js - About 1 day to fix

      Function Auth has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        .factory('Auth', function Auth($location, $rootScope, $http, User, $cookieStore, $q) {
          var currentUser = {};
          if($cookieStore.get('token')) {
            currentUser = User.get();
          }
      Severity: Major
      Found in client/components/auth/auth.service.js - About 3 hrs to fix

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

                options: {
                  transform: function(filePath) {
                    filePath = filePath.replace('/client/app/', '');
                    filePath = filePath.replace('/client/components/', '');
                    return '@import \'' + filePath + '\';';
        Severity: Major
        Found in Gruntfile.js and 2 other locations - About 1 hr to fix
        Gruntfile.js on lines 489..497
        Gruntfile.js on lines 529..537

        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 3 locations. Consider refactoring.
        Open

                options: {
                  transform: function(filePath) {
                    filePath = filePath.replace('/client/', '');
                    filePath = filePath.replace('/.tmp/', '');
                    return '<link rel="stylesheet" href="' + filePath + '">';
        Severity: Major
        Found in Gruntfile.js and 2 other locations - About 1 hr to fix
        Gruntfile.js on lines 489..497
        Gruntfile.js on lines 510..518

        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 3 locations. Consider refactoring.
        Open

                options: {
                  transform: function(filePath) {
                    filePath = filePath.replace('/client/', '');
                    filePath = filePath.replace('/.tmp/', '');
                    return '<script src="' + filePath + '"></script>';
        Severity: Major
        Found in Gruntfile.js and 2 other locations - About 1 hr to fix
        Gruntfile.js on lines 510..518
        Gruntfile.js on lines 529..537

        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 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(config) {
          config.set({
            // base path, that will be used to resolve files and exclude
            basePath: '',
        
        
        Severity: Minor
        Found in karma.conf.js - About 1 hr to fix

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

            twitter: {
              clientID:     process.env.TWITTER_ID || 'id',
              clientSecret: process.env.TWITTER_SECRET || 'secret',
              callbackURL:  (process.env.DOMAIN || '') + '/auth/twitter/callback'
            },
          Severity: Major
          Found in server/config/environment/index.js and 1 other location - About 1 hr to fix
          server/config/environment/index.js on lines 50..54

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

          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

            google: {
              clientID:     process.env.GOOGLE_ID || 'id',
              clientSecret: process.env.GOOGLE_SECRET || 'secret',
              callbackURL:  (process.env.DOMAIN || '') + '/auth/google/callback'
            }
          Severity: Major
          Found in server/config/environment/index.js and 1 other location - About 1 hr to fix
          server/config/environment/index.js on lines 44..48

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

          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 setup has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.setup = function (User, config) {
            var passport = require('passport');
            var TwitterStrategy = require('passport-twitter').Strategy;
          
            passport.use(new TwitterStrategy({
          Severity: Minor
          Found in server/auth/twitter/passport.js - About 1 hr to fix

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

            module.exports = function(app) {
              var env = app.get('env');
            
              app.set('views', config.root + '/server/views');
              app.engine('html', require('ejs').renderFile);
            Severity: Minor
            Found in server/config/express.js - About 1 hr to fix

              Function delete has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      delete: function(del) {
                        del = del || angular.noop;
              
                        /**
                         * Open a delete confirmation modal
              Severity: Minor
              Found in client/components/modal/modal.service.js - About 1 hr to fix

                Function setup has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.setup = function (User, config) {
                  passport.use(new GoogleStrategy({
                      clientID: config.google.clientID,
                      clientSecret: config.google.clientSecret,
                      callbackURL: config.google.callbackURL
                Severity: Minor
                Found in server/auth/google/passport.js - About 1 hr to fix

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

                  UserSchema
                    .path('hashedPassword')
                    .validate(function(hashedPassword) {
                      if (authTypes.indexOf(this.provider) !== -1) return true;
                      return hashedPassword.length;
                  Severity: Major
                  Found in server/api/user/user.model.js and 1 other location - About 1 hr to fix
                  server/api/user/user.model.js on lines 62..67

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

                  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

                  UserSchema
                    .path('email')
                    .validate(function(email) {
                      if (authTypes.indexOf(this.provider) !== -1) return true;
                      return email.length;
                  Severity: Major
                  Found in server/api/user/user.model.js and 1 other location - About 1 hr to fix
                  server/api/user/user.model.js on lines 70..75

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

                  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

                  angular.module('demoApp')
                    .config(function ($stateProvider) {
                      $stateProvider
                        .state('admin', {
                          url: '/admin',
                  Severity: Minor
                  Found in client/app/admin/admin.js and 1 other location - About 55 mins to fix
                  client/app/main/main.js on lines 3..11

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

                  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

                  angular.module('demoApp')
                    .config(function ($stateProvider) {
                      $stateProvider
                        .state('main', {
                          url: '/',
                  Severity: Minor
                  Found in client/app/main/main.js and 1 other location - About 55 mins to fix
                  client/app/admin/admin.js on lines 3..11

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

                  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 destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports.destroy = function(req, res) {
                    Thing.findById(req.params.id, function (err, thing) {
                      if(err) { return handleError(res, err); }
                      if(!thing) { return res.send(404); }
                      thing.remove(function(err) {
                  Severity: Minor
                  Found in server/api/thing/thing.controller.js - About 35 mins 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 Auth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    .factory('Auth', function Auth($location, $rootScope, $http, User, $cookieStore, $q) {
                      var currentUser = {};
                      if($cookieStore.get('token')) {
                        currentUser = User.get();
                      }
                  Severity: Minor
                  Found in client/components/auth/auth.service.js - About 35 mins 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

                  UserSchema
                    .virtual('profile')
                    .get(function() {
                      return {
                        'name': this.name,
                  Severity: Minor
                  Found in server/api/user/user.model.js and 1 other location - About 30 mins to fix
                  server/api/user/user.model.js on lines 48..55

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language