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,
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>;
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>;
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];
- 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"
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,
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 {
File hook-definition.ts
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
SyncHook,
SyncWaterfallHook,
AsyncParallelHook,
AsyncSeriesWaterfallHook,
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();
- 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"
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';
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(
Function merge
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
merge: (ctx, modules) => {
const {
compilation: { requestShortener },
} = ctx;
const source = new ConcatSource();
Function renderMain
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderMain: (context, moduleGroups) => {
const {
compilation,
renderOptions: { chunk },
} = context;
Function constructor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
options: MEPSubclass['options'] = {} as MEPSubclass['options'],
) {
super();
// @ts-ignore
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>
Function validateClassOptions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function validateClassOptions(options: ClassOptions) {
const {
className,
displayName,
pluginName,
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 = [],
) {
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: {
- 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"
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;
Avoid deeply nested control flow statements. Open
if (!bestMatchDeps || bestMatchDeps.length > failedDeps.length) {
bestMatch = list;
bestMatchDeps = failedDeps;
}
Function pitch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
this: MEP,
loaderContext: any,
remainingRequest: string,
precedingRequest: string,
data: object,