CS-Tao/GTD-Visualization

View on GitHub
src/renderer/store/modules/cachedViews.js

Summary

Maintainability
A
3 hrs
Test Coverage

Showing 4 of 4 total issues

Function DEL_OTHERS_VIEWS has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

DEL_OTHERS_VIEWS: (state, view) => {
for (const [i, v] of state.visitedViews.entries()) {
if (v.path === view.path) {
state.visitedViews = state.visitedViews.slice(i, i + 1)
break
Severity: Minor
Found in src/renderer/store/modules/cachedViews.js - About 25 mins to fix

Function DEL_VISITED_VIEWS has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

DEL_VISITED_VIEWS: (state, view) => {
for (const [i, v] of state.visitedViews.entries()) {
if (v.path === view.path) {
state.visitedViews.splice(i, 1)
break
Severity: Minor
Found in src/renderer/store/modules/cachedViews.js - About 25 mins to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

delOthersViews ({ commit, state }, view) {
return new Promise((resolve) => {
commit('DEL_OTHERS_VIEWS', view)
resolve([...state.visitedViews])
})
Severity: Major
Found in src/renderer/store/modules/cachedViews.js and 1 other location - About 1 hr to fix
src/renderer/store/modules/cachedViews.js on lines 57..62

Similar blocks of code found in 2 locations. Consider refactoring.
Open

delVisitedViews ({ commit, state }, view) {
return new Promise((resolve) => {
commit('DEL_VISITED_VIEWS', view)
resolve([...state.visitedViews])
})
Severity: Major
Found in src/renderer/store/modules/cachedViews.js and 1 other location - About 1 hr to fix
src/renderer/store/modules/cachedViews.js on lines 63..68
Category
Status