Showing 26 of 162 total issues
Function ngOnInit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
if (this.editable) {
this.graphTaskService.getAll()
.subscribe(allTasks => {
this.taskInjectableNames = allTasks.map(function (item) {
Function drawNodes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
drawNodes() {
if (!this.workflow) return;
this.graph.clear();
Function createTaskNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public createTaskNode(task: any, position): any {
let waitOnLength = _.keys(task[this.waitOnKey]).length;
let taskNodeName = 'rackhd/task_' + waitOnLength;
let taskNode = global.LiteGraph.createNode(taskNodeName);
taskNode.title = task.label;
- 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 isTaskWaitOnLegal
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
isTaskWaitOnLegal(obj: any): boolean {
let isLegal = true;
if (obj && obj.tasks) {
let taskLables = _.map(obj.tasks, 'label');
let waitOnLables = _.unionBy(_.flatten(_.map(obj.tasks, 'waitOn').map(_.keys)));
- 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 ngOnInit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ngOnInit() {
this.route.queryParams
.subscribe(params => {
this.isDefinition = this.isDefinition || !!params.graphName;
this.graphId = params && (params.graphId || params.graphName);
- 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 onSubmit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
onSubmit(){
let payload = this.modalFormGroup.value;
this.optionsJsonValid = isJsonTextValid(payload.options);
this.tasksJsonValid = isJsonTextValid(payload.tasks);
if (this.optionsJsonValid && this.tasksJsonValid) {
- 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"