JuroOravec/mini-extract-plugin

View on GitHub

Showing 25 of 84 total issues

Function pitch has 231 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default async function pitch<
  MEP extends MiniExtractPlugin = MiniExtractPlugin
>(
  this: MEP,
  loaderContext: any,
Severity: Major
Found in src/methods/pitch.ts - About 1 day to fix

    Function apply has 225 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function apply<
      MEP extends MiniExtractPlugin = MiniExtractPlugin
    >(this: MEP, compiler: webpack.Compiler) {
      debug('Started apply method');
      type Module = GetModule<MEP>;
    Severity: Major
    Found in src/methods/apply.ts - About 1 day to fix

      Function getDefinitions has 223 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getDefinitions<
        MEP extends AbstractMiniExtractPlugin = AbstractMiniExtractPlugin
      >() {
        type Mod = GetModule<MEP>;
        type DepOpts = GetDependencyOptions<MEP>;
      Severity: Major
      Found in src/lib/hook-definition.ts - About 1 day to fix

        Function renderContentAsset has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function renderContentAsset<
          MEP extends MiniExtractPlugin = MiniExtractPlugin
        >({ context, modules, ignoreOrder }: RenderContentAssetOptions<MEP>): Source {
          debug('Started renderContentAsset');
          type Module = RenderContentAssetOptions<MEP>['modules'][0];
        Severity: Minor
        Found in src/lib/render-content-asset.ts - About 6 hrs 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 compilation has 143 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          compilation: (ctx) => {
            const {
              classOptions: { pluginName, type, moduleType },
              compilation: { mainTemplate },
              options,
        Severity: Major
        Found in test/fixtures/mini-css-extract-plugin/hooks.ts - About 5 hrs to fix

          Function pluginFactory has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function pluginFactory<
            // Allow user to specify the types by passing an object of types as params
            T extends ParamsDefault = {}
          >(classOptions: Required<ClassOptions<T>>) {
            const {
          Severity: Major
          Found in src/factory.ts - About 2 hrs to fix

            File hook-definition.ts has 267 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {
              SyncHook,
              SyncWaterfallHook,
              AsyncParallelHook,
              AsyncSeriesWaterfallHook,
            Severity: Minor
            Found in src/lib/hook-definition.ts - About 2 hrs to fix

              Function merge has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                merge: (ctx, modules) => {
                  const {
                    compilation: { requestShortener },
                  } = ctx;
                  const source = new ConcatSource();
              Severity: Minor
              Found in test/fixtures/mini-css-extract-plugin/hooks.ts - About 2 hrs 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

              File pitch.ts has 259 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import loaderUtils from 'loader-utils';
              import validateOptions from 'schema-utils';
              import webpack, { Compiler } from 'webpack';
              // @ts-ignore
              import NodeTemplatePlugin from 'webpack/lib/node/NodeTemplatePlugin';
              Severity: Minor
              Found in src/methods/pitch.ts - About 2 hrs to fix

                Function create has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function create(
                  stateObject: HookState,
                  hooks: Partial<types.hook.ActiveHooks> = activeHooks,
                ) {
                  const validatorHookOverrides: types.hook.Override[] = Object.keys(hooks).map(
                Severity: Minor
                Found in test/fixtures/tapable/overrides.ts - About 1 hr to fix

                  Function merge has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    merge: (ctx, modules) => {
                      const {
                        compilation: { requestShortener },
                      } = ctx;
                      const source = new ConcatSource();
                  Severity: Minor
                  Found in test/fixtures/mini-css-extract-plugin/hooks.ts - About 1 hr to fix

                    Function renderMain has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      renderMain: (context, moduleGroups) => {
                        const {
                          compilation,
                          renderOptions: { chunk },
                        } = context;
                    Severity: Minor
                    Found in test/fixtures/tapable/hook-functions.ts - About 1 hr to fix

                      Function constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          constructor(
                            options: MEPSubclass['options'] = {} as MEPSubclass['options'],
                          ) {
                            super();
                            // @ts-ignore
                      Severity: Minor
                      Found in src/factory.ts - About 1 hr to fix

                        Function miniExtractPluginFactory has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function miniExtractPluginFactory<
                          // Allow user to specify the types by passing an object of types as params
                          T extends ParamsDefault = {},
                          Params extends ParamsParse<T> = ParamsParse<T>,
                          ClsOpts extends ClassOptions<T> = ClassOptions<T>
                        Severity: Minor
                        Found in src/index.ts - About 1 hr to fix

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

                          export function validateClassOptions(options: ClassOptions) {
                            const {
                              className,
                              displayName,
                              pluginName,
                          Severity: Minor
                          Found in test/fixtures/tapable/validators.ts - About 1 hr to fix

                            Function recordAll has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function recordAll(
                              stateObject: HookState,
                              hooks: Partial<types.hook.ActiveHooks> = activeHooks,
                              overrides: types.hook.Overrides = [],
                            ) {
                            Severity: Minor
                            Found in test/fixtures/tapable/overrides.ts - About 1 hr to fix

                              Function getChunkObject has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export function getChunkObject(
                                chunkType: string,
                                mainChunk: types.webpack.Chunk | compilation.Chunk,
                              ) {
                                const obj: {
                              Severity: Minor
                              Found in test/fixtures/mini-css-extract-plugin/util.ts - About 55 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

                              Avoid deeply nested control flow statements.
                              Open

                                        if (failedDeps.length === 0) {
                                          // use this module and remove it from list
                                          usedModulesSet.add(list.pop() as any);
                                          success = true;
                                          break;
                              Severity: Major
                              Found in src/lib/render-content-asset.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                          if (!bestMatchDeps || bestMatchDeps.length > failedDeps.length) {
                                            bestMatch = list;
                                            bestMatchDeps = failedDeps;
                                          }
                                Severity: Major
                                Found in src/lib/render-content-asset.ts - About 45 mins to fix

                                  Function pitch has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                    this: MEP,
                                    loaderContext: any,
                                    remainingRequest: string,
                                    precedingRequest: string,
                                    data: object,
                                  Severity: Minor
                                  Found in src/methods/pitch.ts - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language