emotionLoop/jsCode

View on GitHub

Showing 19 of 55 total issues

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

exports = module.exports = function() {

  var settings = [];

  settings.push({
Severity: Major
Found in app/models/settings.js - About 5 days to fix

    File settings.js has 1097 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    
    // # settings
    
    var _ = require( 'underscore' );
    
    
    Severity: Major
    Found in app/models/settings.js - About 2 days to fix

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

      exports = module.exports = function( mongoose, iglooMongoosePlugin, settings ) {
      
        var Package = new mongoose.Schema({
          slug: {
            type: String
      Severity: Minor
      Found in app/models/package.js - About 1 day 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 exports has 234 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports = module.exports = function( mongoose, iglooMongoosePlugin, settings ) {
      
        var Package = new mongoose.Schema({
          slug: {
            type: String
      Severity: Major
      Found in app/models/package.js - About 1 day to fix

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

        exports = module.exports = function() {
        
          return {
        
            defaults: {
        Severity: Major
        Found in boot/config.js - About 5 hrs to fix

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

          exports = module.exports = function( Package ) {
          
            // Get 5 most popular packages
            function popular( req, res, next ) {
              req.query.limit = 5;
          Severity: Major
          Found in app/controllers/packages.js - About 5 hrs to fix

            Function getSampleCode has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function getSampleCode( convertedSettings ) {
                // If there are no settings, return an empty string
                if ( convertedSettings.length === 0 ) {
                  return '';
                }
            Severity: Major
            Found in app/models/package.js - About 3 hrs to fix

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

              exports = module.exports = function( Package, settings ) {
              
                function home( req, res, next ) {
                  var popularPackages = [];
                  var latestPackages = [];
              Severity: Major
              Found in app/controllers/home.js - About 2 hrs to fix

                Function getJSHintCode has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function getJSHintCode( convertedSettings ) {
                    // If there are no settings, return an empty string
                    if ( convertedSettings.length === 0 ) {
                      return '';
                    }
                Severity: Minor
                Found in app/models/package.js - About 1 hr to fix

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

                  exports = module.exports = function( settings ) {
                  
                    function index( req, res, next ) {
                        res.format({
                          html: function() {
                  Severity: Minor
                  Found in app/controllers/settings.js - About 1 hr to fix

                    Function home has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function home( req, res, next ) {
                        var popularPackages = [];
                        var latestPackages = [];
                    
                        async.waterfall([
                    Severity: Minor
                    Found in app/controllers/home.js - About 1 hr to fix

                      Function create has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function create( req, res, next ) {
                          if ( ! req.body.settings ) {
                            return next({
                              param: 'settings',
                              message: 'Settings is missing or blank'
                      Severity: Minor
                      Found in app/controllers/packages.js - About 1 hr to fix

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

                        exports = module.exports = function( IoC ) {
                        
                          var app = this;
                          var router = express.Router();
                          var controller = IoC.create( 'controllers/packages' );
                        Severity: Minor
                        Found in routes/packages.js - About 1 hr to fix

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

                          exports = module.exports = function(IoC, settings) {
                          
                            var app = this;
                          
                            // set the default views directory
                          Severity: Minor
                          Found in etc/init/06-views.js - About 1 hr to fix

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

                              function show( req, res, next ) {
                                async.waterfall([
                                  // Find package and increment the number of views
                                  function findPackageAndIncrementViews( callback ) {
                                    Package.findOne( { slug: req.params.slug }, function( err, _package ) {
                            Severity: Minor
                            Found in app/controllers/packages.js - About 1 hr to fix

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

                              exports = module.exports = function(IoC, logger, settings) {
                              
                                var app = this;
                              
                                // adds X-Response-Time header
                              Severity: Minor
                              Found in etc/init/02-middleware.js - About 1 hr to fix

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

                                exports = module.exports = function( Package ) {
                                
                                  // Get 5 most popular packages
                                  function popular( req, res, next ) {
                                    req.query.limit = 5;
                                Severity: Minor
                                Found in app/controllers/packages.js - About 55 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 exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                exports = module.exports = function( Package, settings ) {
                                
                                  function home( req, res, next ) {
                                    var popularPackages = [];
                                    var latestPackages = [];
                                Severity: Minor
                                Found in app/controllers/home.js - About 45 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 listPaginated has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  function listPaginated( req, res, next, findOptions, extraOptions ) {
                                Severity: Minor
                                Found in app/controllers/packages.js - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language