src/frontend/packages/core/src/shared/components/list/data-sources-controllers/list-data-source.ts
File list-data-source.ts
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { DataSource } from '@angular/cdk/table';
import { SortDirection } from '@angular/material/sort';
import { Store } from '@ngrx/store';
import {
BehaviorSubject,
ListDataSource
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export abstract class ListDataSource<T, A = T> extends DataSource<T> implements IListDataSource<T> {
// -------------- Public
// Core observables
public pagination$: Observable<PaginationEntityState>;
Function constructor
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
private config: IListDataSourceConfig<A, T>,
) {
super();
this.init(config);
Function setupAction
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
private setupAction(config: IListDataSourceConfig<A, T>) {
if (config.schema instanceof MultiActionConfig) {
if (!config.isLocal) {
// We cannot do multi action lists for non-local lists
this.action = config.schema[0].paginationAction;
Function selectAllFilteredRows
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
Open
selectAllFilteredRows() {
this.selectAllChecked = !this.selectAllChecked;
const updatedAllRows$ = this.page$.pipe(switchMap((filterEntities) => {
return combineLatest(filterEntities.reduce((obs, row) => {
- 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"