JuroOravec/mini-extract-plugin

View on GitHub

Showing 84 of 84 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const hookValidators: Taps = {
  initialize: (instance, options) => {
    validatePlugin(instance);
    validateDefinedObject(options);
  },
Severity: Major
Found in test/fixtures/tapable/validators.ts and 1 other location - About 3 days to fix
test/fixtures/tapable/hook-validators.ts on lines 23..134

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 661.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const hookValidators: Taps = {
  initialize: (instance, options) => {
    validatePlugin(instance);
    validateDefinedObject(options);
  },
Severity: Major
Found in test/fixtures/tapable/hook-validators.ts and 1 other location - About 3 days to fix
test/fixtures/tapable/validators.ts on lines 217..328

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 661.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  ? L extends 1
    ? [NonNullable<T[0]>, ...any[]]
    : L extends 2
    ? [NonNullable<T[0]>, NonNullable<T[1]>, ...any[]]
    : L extends 3
Severity: Major
Found in src/types/util.ts and 1 other location - About 1 day to fix
src/types/util.ts on lines 136..159

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 316.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

> = L extends 1
  ? [NonNullable<T[0]>, ...any[]]
  : L extends 2
  ? [NonNullable<T[0]>, NonNullable<T[1]>, ...any[]]
  : L extends 3
Severity: Major
Found in src/types/util.ts and 1 other location - About 1 day to fix
src/types/util.ts on lines 107..130

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 316.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              beforeRenderChunk: {
                hook: SyncWaterfallHook as SyncWaterfallHookClass,
                args: castTuple(
                  {
                    name: castStrLit('renderContext'),
          Severity: Major
          Found in src/lib/hook-definition.ts and 1 other location - About 3 hrs to fix
          src/lib/hook-definition.ts on lines 73..89

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 113.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              beforeRenderMain: {
                hook: SyncWaterfallHook as SyncWaterfallHookClass,
                args: castTuple(
                  {
                    name: castStrLit('renderContext'),
          Severity: Major
          Found in src/lib/hook-definition.ts and 1 other location - About 3 hrs to fix
          src/lib/hook-definition.ts on lines 118..134

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 113.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              renderChunk: {
                hook: SyncWaterfallHook as SyncWaterfallHookClass,
                args: castTuple(
                  {
                    name: castStrLit('renderContext'),
          Severity: Major
          Found in src/lib/hook-definition.ts and 1 other location - About 3 hrs to fix
          src/lib/hook-definition.ts on lines 91..101

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 106.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              renderMain: {
                hook: SyncWaterfallHook as SyncWaterfallHookClass,
                args: castTuple(
                  {
                    name: castStrLit('renderContext'),
          Severity: Major
          Found in src/lib/hook-definition.ts and 1 other location - About 3 hrs to fix
          src/lib/hook-definition.ts on lines 136..149

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 106.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              afterRenderMain: {
                hook: SyncHook as SyncHookClass,
                args: castTuple(
                  {
                    name: castStrLit('renderContext'),
          Severity: Major
          Found in src/lib/hook-definition.ts and 1 other location - About 3 hrs to fix
          src/lib/hook-definition.ts on lines 151..164

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 99.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              afterRenderChunk: {
                hook: SyncHook as SyncHookClass,
                args: castTuple(
                  {
                    name: castStrLit('renderContext'),
          Severity: Major
          Found in src/lib/hook-definition.ts and 1 other location - About 3 hrs to fix
          src/lib/hook-definition.ts on lines 103..116

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 99.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                    pitch: {
                      hook: AsyncParallelHook as AsyncParallelHookClass,
                      args: castTuple({
                        name: castStrLit('pitchContext'),
                        type: {} as PitchContext<MEP>,
                Severity: Major
                Found in src/lib/hook-definition.ts and 4 other locations - About 1 hr to fix
                src/lib/hook-definition.ts on lines 55..62
                src/lib/hook-definition.ts on lines 64..71
                src/lib/hook-definition.ts on lines 220..227
                src/lib/hook-definition.ts on lines 238..245

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 74.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language