Showing 7 of 7 total issues
Function getWebpackCommonConfig
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function getWebpackCommonConfig(args) {
const pkgPath = join(args.cwd, 'package.json');
const pkg = existsSync(pkgPath) ? require(pkgPath) : {};
const jsFileName = args.hash ? '[name]-[chunkhash].js' : '[name].js';
Function build
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
export default function build(args, callback) {
// Get config.
let webpackConfig = getWebpackConfig(args);
webpackConfig = Array.isArray(webpackConfig) ? webpackConfig : [webpackConfig];
- 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 build
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function build(args, callback) {
// Get config.
let webpackConfig = getWebpackConfig(args);
webpackConfig = Array.isArray(webpackConfig) ? webpackConfig : [webpackConfig];
Function getWebpackConfig
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getWebpackConfig(args) {
let webpackConfig = getWebpackCommonConfig(args);
webpackConfig.plugins = webpackConfig.plugins || [];
Function doneHandler
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function doneHandler(err, stats) {
if (args.json) {
const filename = typeof args.json === 'boolean' ? 'build-bundle.json' : args.json;
const jsonPath = join(fileOutputPath, filename);
writeFileSync(jsonPath, JSON.stringify(stats.toJson()), 'utf-8');
Function getWebpackConfig
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function getWebpackConfig(args) {
let webpackConfig = getWebpackCommonConfig(args);
webpackConfig.plugins = webpackConfig.plugins || [];
- 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 getWebpackCommonConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function getWebpackCommonConfig(args) {
const pkgPath = join(args.cwd, 'package.json');
const pkg = existsSync(pkgPath) ? require(pkgPath) : {};
const jsFileName = args.hash ? '[name]-[chunkhash].js' : '[name].js';
- 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"