socketstream/socketstream

View on GitHub
lib/client/bundler/index.js

Summary

Maintainability
F
6 days
Test Coverage

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

module.exports = function(ss,options) {

  var proto = require('./proto')(ss, bundlers, bundlerById, options),
      compressor = uglifyjs.Compressor({warnings:false});

Severity: Minor
Found in lib/client/bundler/index.js - About 2 days 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 392 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(ss,options) {

  var proto = require('./proto')(ss, bundlers, bundlerById, options),
      compressor = uglifyjs.Compressor({warnings:false});

Severity: Major
Found in lib/client/bundler/index.js - About 1 day to fix

    File index.js has 424 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Client-Side Bundler of assets in development and production
    'use strict';
    
    var fs = require('fs'),
        path = require('path'),
    Severity: Minor
    Found in lib/client/bundler/index.js - About 6 hrs to fix

      Function entries has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          entries: function entries(client, assetType) {
      
            var _entries = [],
                bundler = getBundler(client),
                includeType,
      Severity: Major
      Found in lib/client/bundler/index.js - About 2 hrs to fix

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

            findEntryPoint: function(client) {
        
              var firstIndex, // if no entry point, use first index found
                  firstFile;  // if no entry and index, use first file found
        
        
        Severity: Minor
        Found in lib/client/bundler/index.js - About 1 hr to fix

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

              sourcePaths: function(paths) {
          
                function relativePath(p, dirType) {
                    var relativeStart = p.indexOf('./') === 0 || p.indexOf('../') === 0;
                    return relativeStart? prefixPath(options.dirs.client,p) : prefixPath(options.dirs[dirType], p);
          Severity: Minor
          Found in lib/client/bundler/index.js - About 1 hr to fix

            Function getBundler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function getBundler(client){
              if (typeof client === "string") { return bundlers[client]; }
            
              if (client.bundler) { return client.bundler; }
            
            
            Severity: Minor
            Found in lib/client/bundler/index.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 loadFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                loadFile: function loadFile(entry, opts, formatter, cb, errCb) {
            Severity: Minor
            Found in lib/client/bundler/index.js - About 35 mins to fix

              Avoid too many return statements within this function.
              Open

                  return bundlers[client.name];
              Severity: Major
              Found in lib/client/bundler/index.js - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status