Showing 287 of 288 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
it("should not cascade delete the 'composite'-type entity that still references additional other entities but remove id", async () => {
const result = await service.deleteEntity(
ENTITIES.ReferencedAsOneOfMultipleComposites1,
);
- Read upRead up
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 116.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
it("should not cascade delete the 'aggregate'-type entity that only references the entity user acts on but remove id", async () => {
const result = await service.deleteEntity(
ENTITIES.ReferencingAggregate_ref,
);
- Read upRead up
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 116.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
{
header: {
label: "Total # of old children",
groupedBy: [],
result: 5,
- Read upRead up
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 114.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
{
header: { label: "Total # of schools", groupedBy: [], result: 3 },
subRows: [
{
header: {
- Read upRead up
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 114.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function transformRawDataToEntities
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
async transformRawDataToEntities(
rawData: any[],
entityType: string,
columnMapping: ColumnMapping[],
): Promise<Entity[]> {
- 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
Entity
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
export class Entity {
/**
* The entity's type.
* In classes extending Entity this is usually overridden by the class annotation `@DatabaseEntity('NewEntity')`.
* The type needs to be used as routing path in lower case. The routing path can be defined in the configuration file.
File ability.service.spec.ts
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { fakeAsync, TestBed, tick, waitForAsync } from "@angular/core/testing";
import { AbilityService } from "./ability.service";
import { BehaviorSubject, Subject } from "rxjs";
import { Child } from "../../../child-dev-project/children/model/child";
Function generate
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
async generate<T extends Entity>(
filterConfigs: FilterConfig[],
entityConstructor: EntityConstructor<T>,
data: T[],
onlyShowUsedOptions = false,
File entities-table.component.ts
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
AfterViewInit,
Component,
EventEmitter,
Input,
BasicAutocompleteComponent
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: "app-basic-autocomplete",
templateUrl: "basic-autocomplete.component.html",
styleUrls: ["./basic-autocomplete.component.scss"],
providers: [
File admin-entity-field.component.ts
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
Component,
Inject,
Input,
OnChanges,
File entity-actions.service.spec.ts
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { fakeAsync, TestBed, tick } from "@angular/core/testing";
import { EntityActionsService } from "./entity-actions.service";
import { EntityMapperService } from "../entity-mapper/entity-mapper.service";
import {
MatSnackBar,
PouchDatabase
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class PouchDatabase extends Database {
/**
* Small helper function which creates a database with in-memory PouchDB initialized
*/
Function delete
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
async delete<E extends Entity>(
entityParam: E | E[],
navigate: boolean = false,
): Promise<boolean> {
let textForDeleteEntity = "";
CustomFormControlDirective
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
@Directive()
export abstract class CustomFormControlDirective<T>
implements ControlValueAccessor, MatFormFieldControl<T>, OnDestroy, DoCheck
{
static nextId = 0;
File entity-list.component.ts
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
Component,
EventEmitter,
Input,
OnChanges,
Similar blocks of code found in 2 locations. Consider refactoring. Open
it("should mark relation with end date in the future as active", () => {
const relation = new TimePeriod();
relation.start = moment().subtract(1, "week").toDate();
relation.end = moment().add(1, "day").toDate();
expect(relation.isActive).toBeTrue();
- Read upRead up
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 101.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
it("should mark relation with end date in the past as inactive", () => {
const relation = new TimePeriod();
relation.start = moment().subtract(1, "week").toDate();
relation.end = moment().subtract(1, "day").toDate();
expect(relation.isActive).toBeFalse();
- Read upRead up
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 101.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function anonymize
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
async anonymize<E extends Entity>(entityParam: E | E[]) {
let entities = Array.isArray(entityParam) ? entityParam : [entityParam];
let textForAnonymizeEntity = "";
if (entities.length > 1) {
QueryService
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable({
providedIn: "root",
})
export class QueryService {
private entities: { [type: string]: { [id: string]: Entity } } = {};