packages/brookjs-cli/src/webpack/selectors.ts
File selectors.ts
has 510 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// @todo: readd NpmInstallPlugin
// @todo: clean up this file (extra functions, commented out code, etc.)
import path from 'path';
// import address from 'address';
import webpack, { Loader } from 'webpack';
Function selectWebpackConfig
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const selectWebpackConfig = (
state: BuildConfig,
): webpack.Configuration => {
let entry = selectWebpackEntry(state);
Function selectStyleLoaders
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const selectStyleLoaders = (
state: BuildConfig,
cssLoaderOptions: object,
preProcessor?: string,
) => {
Function selectEnvPlugins
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const selectEnvPlugins = (state: BuildConfig) => {
const plugins = state.watch
? [
// If you require a missing module and then `npm install` it, you still have
// to restart the development server for Webpack to discover it. This plugin
Function addHotReload
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
const addHotReload = (
entry: webpack.Configuration['entry'],
): webpack.Configuration['entry'] => {
const client = require.resolve('react-dev-utils/webpackHotDevClient');
- 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"