Showing 112 of 347 total issues
File table-builder.component.ts
has 699 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { CdkDragStart } from '@angular/cdk/drag-drop';
import {
AfterContentInit,
AfterViewChecked,
AfterViewInit,
TableBuilderComponent
has 78 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'ngx-table-builder',
templateUrl: './table-builder.component.html',
styleUrls: ['./table-builder.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
Function filterAllWorker
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
export function filterAllWorker<T>({ source, global, types, columns }: FilterableMessage<T>): T[] {
const INTERVAL_ARRAY_SIZE: number = 2;
const PLAIN_TYPES: Set<string> = new Set(['number', 'string', 'boolean']);
const { value: globalOperand, type: globalFilterType }: FilterGlobalOptions = global;
let result: T[] = source;
- 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 exportExcelByWorkbook
has 206 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async exportExcelByWorkbook<T>(workbook: ExcelWorkbook<T>): Promise<void> {
const preparedWorkbook: PreparedExcelWorkbook<T> = await this.prepareWorkbook(workbook);
this.webWorker
// eslint-disable-next-line max-lines-per-function,sonarjs/cognitive-complexity
Function sortWorker
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
export function sortWorker<T>(message: SortableMessage<T>): T[] {
// eslint-disable-next-line
enum OrderType {
DESC = 'desc',
SKIP = 'skip'
- 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
AbstractTableBuilderApiDirective
has 47 functions (exceeds 20 allowed). Consider refactoring. Open
@Directive()
export abstract class AbstractTableBuilderApiDirective<T>
implements OnChanges, OnInit, AfterViewInit, AfterContentInit, AfterViewChecked, OnDestroy
{
public abstract readonly templateParser: TemplateParserService<T>;
AbstractNgxsDataEntityCollectionsRepository
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export abstract class AbstractNgxsDataEntityCollectionsRepository<
V,
K extends number | string = EntityIdType,
C = Record<string, any>
Function roundOff
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
export function roundOff(input: number | string, n: number = 0, mode = RoundingModes.HALF_EVEN): any {
if (mode === RoundingModes.UNNECESSARY) {
throw new Error('UNNECESSARY Rounding Mode has not yet been implemented');
}
- 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 abstract-table-builder-api.directive.ts
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable @angular-eslint/no-input-rename */
import { CdkDragSortEvent } from '@angular/cdk/drag-drop';
import {
AfterContentInit,
AfterViewChecked,
AmountFormatDirective
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
@Directive({ selector: '[amountFormat]' })
export class AmountFormatDirective implements OnInit, AfterViewInit, OnDestroy {
private readonly subscriptions: Subscription = new Subscription();
private previousLang: Nullable<string> = null;
private readonly maximumFractionDigits: number = 3;
File ngxs-data-entity-collections.repository.ts
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Injectable, isDevMode } from '@angular/core';
import {
EmptyDictionary,
EntityCollections,
EntityComparator,
TooltipDirective
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
@Directive({ selector: '[tooltip]' })
export class TooltipDirective implements OnDestroy {
private readonly delta: number = 2;
private readonly layoutMinDuration: number = 100;
private tooltipDomElement: Nullable<HTMLElement> = null;
Function sortWorker
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function sortWorker<T>(message: SortableMessage<T>): T[] {
// eslint-disable-next-line
enum OrderType {
DESC = 'desc',
SKIP = 'skip'
Function isSatisfying
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
function isSatisfying(
valuesSet: Nullable<PlainValue>[],
operand: PlainValue,
filterType: TableFilterType | string
): boolean {
Function createTsJestConfig
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createTsJestConfig(options: JestConfigOptions): Config.InitialOptions {
const rootDir: string = options.jestConfig?.rootDir ?? path.resolve('.');
const resolvedRootDir: string = path.isAbsolute(rootDir) ? rootDir : path.resolve(rootDir);
const packageJsonPath: string = path.resolve(rootDir, 'package.json');
let displayName: string | Config.DisplayName | null | undefined;
LoggerService
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
@BoundClass
@Injectable()
export class LoggerService {
private readonly DEFAULT_DEPTH: number = 2;
File tooltip.directive.ts
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable @angular-eslint/no-input-rename */
import {
Directive,
ElementRef,
EmbeddedViewRef,
Function compileColumnMetadata
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public compileColumnMetadata(column: NgxColumnComponent<T>): void {
const {
key,
th,
td,
Function divide
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export function divide(
inputDividend: number | string,
inputDivisor: number | string,
inputPrecision: number = DEFAULT_PRECISSION
): string {
- 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
BigDecimal
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
export class BigDecimal {
private readonly value: string;
constructor(num: number | string = '0') {
this.value = BigDecimal.validate(num);