lib/client/bundler/index.js
Function exports
has a Cognitive Complexity of 123 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function(ss,options) {
var proto = require('./proto')(ss, bundlers, bundlerById, options),
compressor = uglifyjs.Compressor({warnings:false});
- Read upRead up
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
Open
module.exports = function(ss,options) {
var proto = require('./proto')(ss, bundlers, bundlerById, options),
compressor = uglifyjs.Compressor({warnings:false});
File index.js
has 424 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// Client-Side Bundler of assets in development and production
'use strict';
var fs = require('fs'),
path = require('path'),
Function entries
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
entries: function entries(client, assetType) {
var _entries = [],
bundler = getBundler(client),
includeType,
Function findEntryPoint
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
findEntryPoint: function(client) {
var firstIndex, // if no entry point, use first index found
firstFile; // if no entry and index, use first file found
Function sourcePaths
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Function getBundler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
function getBundler(client){
if (typeof client === "string") { return bundlers[client]; }
if (client.bundler) { return client.bundler; }
- Read upRead up
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
Open
loadFile: function loadFile(entry, opts, formatter, cb, errCb) {
Avoid too many return
statements within this function. Open
Open
return bundlers[client.name];