mAAdhaTTah/brookjs

View on GitHub
packages/brookjs-cli/src/webpack/selectors.ts

Summary

Maintainability
D
2 days
Test Coverage

File selectors.ts has 510 lines of code (exceeds 250 allowed). Consider refactoring.
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';
Severity: Major
Found in packages/brookjs-cli/src/webpack/selectors.ts - About 1 day to fix

    Function selectWebpackConfig has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const selectWebpackConfig = (
      state: BuildConfig,
    ): webpack.Configuration => {
      let entry = selectWebpackEntry(state);
    
    
    Severity: Major
    Found in packages/brookjs-cli/src/webpack/selectors.ts - About 2 hrs to fix

      Function selectStyleLoaders has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const selectStyleLoaders = (
        state: BuildConfig,
        cssLoaderOptions: object,
        preProcessor?: string,
      ) => {
      Severity: Minor
      Found in packages/brookjs-cli/src/webpack/selectors.ts - About 1 hr to fix

        Function selectEnvPlugins has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        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
        Severity: Minor
        Found in packages/brookjs-cli/src/webpack/selectors.ts - About 1 hr to fix

          Function addHotReload has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          const addHotReload = (
            entry: webpack.Configuration['entry'],
          ): webpack.Configuration['entry'] => {
            const client = require.resolve('react-dev-utils/webpackHotDevClient');
          
          
          Severity: Minor
          Found in packages/brookjs-cli/src/webpack/selectors.ts - About 1 hr 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

          There are no issues that match your filters.

          Category
          Status