Showing 13 of 19 total issues
File ngx-dhis2-http-client.service.ts
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
HttpClient,
HttpErrorResponse,
HttpHeaders,
} from '@angular/common/http';
Function _getFromIndexDb
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private _getFromIndexDb(url, httpConfig: HttpConfig, httpOptions: any) {
const urlContent = deduceUrlContent(url);
const schemaName =
urlContent && urlContent.schema
? urlContent.schema.name
Function _getTableSchema
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
private _getTableSchema(schemaName: string, params: IndexDBParams) {
const tableSchema = this.table(schemaName);
if (!params) {
return tableSchema;
}
- 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 filterDataItem
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function filterDataItem(dataItem: any, filterList: any[]) {
return (filterList || []).some((filterItem: any) => {
const { attribute, condition, filterValue } = filterItem;
switch (condition) {
case 'ilike': {
Function init
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init() {
this.manifestService
.getManifest(this.httpClient)
.pipe(
switchMap((manifest: Manifest) => {
Function _getTableSchema
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private _getTableSchema(schemaName: string, params: IndexDBParams) {
const tableSchema = this.table(schemaName);
if (!params) {
return tableSchema;
}
Function _getFromIndexDb
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
private _getFromIndexDb(url, httpConfig: HttpConfig, httpOptions: any) {
const urlContent = deduceUrlContent(url);
const schemaName =
urlContent && urlContent.schema
? urlContent.schema.name
- 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 too many return
statements within this function. Open
Open
return (
parseInt(dataItem[attribute], 10) >=
parseInt(filterValue, 10)
);
Avoid too many return
statements within this function. Open
Open
return (
parseInt(dataItem[attribute], 10) >
parseInt(filterValue, 10)
);
Avoid too many return
statements within this function. Open
Open
return tableSchema;
Avoid too many return
statements within this function. Open
Open
return tableSchema.orderBy(orderByColumns[0]);
Avoid too many return
statements within this function. Open
Open
return (filterValue || '').indexOf(dataItem[attribute]) !== -1;
Avoid too many return
statements within this function. Open
Open
return tableSchema;