JuroOravec/mini-extract-plugin

View on GitHub
src/lib/hook-definition.ts

Summary

Maintainability
F
5 days
Test Coverage

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

    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

      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

      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

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

          childCompiler: {
            hook: AsyncParallelHook as AsyncParallelHookClass,
            args: castTuple({
              name: castStrLit('pitchCompilerContext'),
              type: {} as PitchCompilerContext<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 211..218
      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

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

          compiler: {
            hook: SyncHook as SyncHookClass,
            args: castTuple({
              name: castStrLit('compilerContext'),
              type: {} as CompilerContext<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 64..71
      src/lib/hook-definition.ts on lines 211..218
      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

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

          childCompilation: {
            hook: SyncHook as SyncHookClass,
            args: castTuple({
              name: castStrLit('pitchCompilationContext'),
              type: {} as PitchCompilationContext<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 211..218
      src/lib/hook-definition.ts on lines 220..227

      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

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

          compilation: {
            hook: SyncHook as SyncHookClass,
            args: castTuple({
              name: castStrLit('compilationContext'),
              type: {} as CompilationContext<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 211..218
      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

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

            args: castTuple(
              {
                name: castStrLit('renderContext'),
                type: {} as RenderContext<MEP>,
              },
      Severity: Major
      Found in src/lib/hook-definition.ts and 1 other location - About 1 hr to fix
      src/lib/hook-definition.ts on lines 249..258

      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 60.

      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

            args: castTuple(
              {
                name: castStrLit('pitchCompilationContext'),
                type: {} as PitchCompilationContext<MEP>,
              },
      Severity: Major
      Found in src/lib/hook-definition.ts and 1 other location - About 1 hr to fix
      src/lib/hook-definition.ts on lines 198..207

      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 60.

      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

      There are no issues that match your filters.

      Category
      Status