cattr-app/frontend-application

View on GitHub
app/core/modules/Dashboard/storeModule.js

Summary

Maintainability
A
2 hrs
Test Coverage

Function timePerProject has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    timePerProject: (state, getters) => {
        return Object.keys(getters.intervals).reduce((result, userID) => {
            const userEvents = getters.intervals[userID];
            if (!userEvents) {
                return result;
Severity: Minor
Found in app/core/modules/Dashboard/storeModule.js - About 1 hr to fix

    Function timePerProject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        timePerProject: (state, getters) => {
            return Object.keys(getters.intervals).reduce((result, userID) => {
                const userEvents = getters.intervals[userID];
                if (!userEvents) {
                    return result;
    Severity: Minor
    Found in app/core/modules/Dashboard/storeModule.js - About 1 hr to fix

    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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Replace '_internal/Dashboard/services/dashboard.service' with "_internal/Dashboard/services/dashboard.service"
    Open

    import DashboardService from '_internal/Dashboard/services/dashboard.service';

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ····timezone:·moment.tz.guess(), with ··timezone:·moment.tz.guess()
    Open

        timezone: moment.tz.guess(),

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ········
    Open

                    if (!projects[event.project_id]) {

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···················· with ··········
    Open

                        projects[event.project_id] = {

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···················· with ··········
    Open

                        };

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ····················projects[event.project_id].tasks[event.task_id].duration·+= with ··········projects[event.project_id].tasks[event.task_id].duration·+=⏎···········
    Open

                        projects[event.project_id].tasks[event.task_id].duration += event.duration;

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ················ with ········
    Open

                    }

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        },

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···· with ··
    Open

        getters,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'moment-timezone' with "moment-timezone"
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···················· with ··········
    Open

                        };

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··········
    Open

                        projects[event.project_id].duration += event.duration;

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ····················projects[event.project_id].tasks[event.task_id with ··········projects[event.project_id].tasks[⏎············event.task_id⏎··········
    Open

                        projects[event.project_id].tasks[event.task_id].durationAtSelectedPeriod +=

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ········
    Open

                    return projects;

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ······
    Open

                const userEvents = getters.intervals[userID];

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ················ with ········
    Open

                    ...result,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ············ with ······
    Open

                };

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ····}, with ··}
    Open

        },

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ················ with ········
    Open

                    } else {

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        },

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        service: null,

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ······
    Open

                if (!userEvents) {

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ······
    Open

                const userTimePerDay = userEvents.reduce((result, event) => {

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ····
    Open

            state.users = users;

    For more information visit Source: http://eslint.org/docs/rules/

    Replace }, with );⏎··}
    Open

        },

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        state,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···· with ··
    Open

        mutations,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···· with ··
    Open

        service: state => state.service,

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        tasks: state => state.tasks,

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ········
    Open

                    return result;

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ············ with ······
    Open

                return {

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ················[userID]:·userTimePerDay, with ········[userID]:·userTimePerDay
    Open

                    [userID]: userTimePerDay,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ········ with ····
    Open

            state.service = service;

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ········ with ····
    Open

            state.intervals = intervals;

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ····················projects[event.project_id].durationAtSelectedPeriod·+= with ··········projects[event.project_id].durationAtSelectedPeriod·+=⏎···········
    Open

                        projects[event.project_id].durationAtSelectedPeriod += event.durationAtSelectedPeriod;

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ······
    Open

                }, {});

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ············ with ······
    Open

                if (!userEvents) {

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ······
    Open

                }

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        init(context) {

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Replace '@/services/resource/task.service' with "@/services/resource/task.service"
    Open

    import TasksService from '@/services/resource/task.service';

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ········ with ····
    Open

            return Object.keys(getters.intervals).reduce((result, userID) => {

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ········
    Open

                    }

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ········
    Open

                    if (!projects[event.project_id].tasks[event.task_id]) {

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ················ with ········
    Open

                    ...result,

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ····
    Open

            state.tasks = tasks;

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···· with ··
    Open

        },

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        tasks: {},

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···· with ··
    Open

        intervals: state => state.intervals,

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ············
    Open

                            duration: event.duration,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···················· with ··········
    Open

                        projects[event.project_id].tasks[event.task_id] = {

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ························ with ············
    Open

                            name: event.task_name,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ························ with ············
    Open

                            duration: event.duration,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ························durationAtSelectedPeriod:·event.durationAtSelectedPeriod, with ············durationAtSelectedPeriod:·event.durationAtSelectedPeriod
    Open

                            durationAtSelectedPeriod: event.durationAtSelectedPeriod,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ················ with ········
    Open

                    } else {

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ················ with ········
    Open

                    return _.mergeWith({}, result, event.durationByDay, _.add);

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···· with ··
    Open

        setService(state, service) {

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ········ with ····
    Open

            state.timezone = timezone;

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        timePerProject: (state, getters) => {

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ············ with ······
    Open

                };

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ········context.commit('setService',·new·DashboardService(context,·new·TasksService(),·new·UserService())); with ····context.commit(⏎······"setService",⏎······new·DashboardService(context,·new·TasksService(),·new·UserService())
    Open

            context.commit('setService', new DashboardService(context, new TasksService(), new UserService()));

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ························ with ············
    Open

                            id: event.task_id,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ········ with ····
    Open

            return Object.keys(getters.intervals).reduce((result, userID) => {

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ············ with ······
    Open

                return {

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        },

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        },

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Replace '@/services/resource/user.service' with "@/services/resource/user.service"
    Open

    import UserService from '@/services/resource/user.service';

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ······
    Open

                }, {});

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        intervals: {},

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···· with ··
    Open

        users: state => state.users,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ············ with ······
    Open

                const projects = userEvents.reduce((projects, event) => {

    For more information visit Source: http://eslint.org/docs/rules/

    Definition for rule 'vue/attributes-order' was not found
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···· with ··
    Open

        users: [],

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ············
    Open

                            event.durationAtSelectedPeriod;

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ················ with ········
    Open

                    return result;

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ··actions, with actions
    Open

        actions,

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ······
    Open

                }

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ························ with ············
    Open

                            name: event.project_name,

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ············
    Open

                            tasks: {},

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ························durationAtSelectedPeriod:·event.durationAtSelectedPeriod, with ············durationAtSelectedPeriod:·event.durationAtSelectedPeriod
    Open

                            durationAtSelectedPeriod: event.durationAtSelectedPeriod,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···· with ··
    Open

        },

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        setIntervals(state, intervals) {

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        setUsers(state, users) {

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ············ with ······
    Open

                const userEvents = getters.intervals[userID];

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ················[userID]:·projects, with ········[userID]:·projects
    Open

                    [userID]: projects,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ········ with ····
    Open

            }, {});

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ····timezone:·state·=>·state.timezone, with ··timezone:·state·=>·state.timezone
    Open

        timezone: state => state.timezone,

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ···· with ··
    Open

        setTasks(state, tasks) {

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        setTimezone(state, timezone) {

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    import moment from 'moment-timezone';

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'lodash' with "lodash"
    Open

    import _ from 'lodash';

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ············
    Open

                            id: event.project_id,

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ··
    Open

        timePerDay: (state, getters) => {

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ········ with ····
    Open

            }, {});

    For more information visit Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status