weareopensource/Vue

View on GitHub

Showing 33 of 37 total issues

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

    signup: async ({ commit, dispatch }, params) => {
      try {
        const res = await app.config.globalProperties.axios.post(`${api}/${config.api.endPoints.auth}/signup`, params);
        localStorage.setItem(`${config.cookie.prefix}UserRoles`, res.data.user.roles);
        localStorage.setItem(`${config.cookie.prefix}CookieExpire`, res.data.tokenExpiresIn);
Severity: Major
Found in src/modules/auth/stores/auth.store.js and 2 other locations - About 1 day to fix
src/modules/auth/stores/auth.store.js on lines 18..29
src/modules/auth/stores/auth.store.js on lines 69..80

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 208.

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

Further Reading

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

    signin: async ({ commit, dispatch }, params) => {
      try {
        const res = await app.config.globalProperties.axios.post(`${api}/${config.api.endPoints.auth}/signin`, params);
        localStorage.setItem(`${config.cookie.prefix}UserRoles`, res.data.user.roles);
        localStorage.setItem(`${config.cookie.prefix}CookieExpire`, res.data.tokenExpiresIn);
Severity: Major
Found in src/modules/auth/stores/auth.store.js and 2 other locations - About 1 day to fix
src/modules/auth/stores/auth.store.js on lines 30..41
src/modules/auth/stores/auth.store.js on lines 69..80

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 208.

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

Further Reading

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

    reset: async ({ commit, dispatch }, params) => {
      try {
        const res = await app.config.globalProperties.axios.post(`${api}/${config.api.endPoints.auth}/reset`, params);
        localStorage.setItem(`${config.cookie.prefix}UserRoles`, res.data.user.roles);
        localStorage.setItem(`${config.cookie.prefix}CookieExpire`, res.data.tokenExpiresIn);
Severity: Major
Found in src/modules/auth/stores/auth.store.js and 2 other locations - About 1 day to fix
src/modules/auth/stores/auth.store.js on lines 18..29
src/modules/auth/stores/auth.store.js on lines 30..41

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 208.

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

Further Reading

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

    updateUser: async ({ commit, state }, params) => {
      try {
        const obj = model.clean(state.user, whitelists);
        const res = await app.config.globalProperties.axios.put(`${api}/${config.api.endPoints.users}/${params.id}`, obj);
        commit('user_update', res.data.data);
Severity: Major
Found in src/modules/users/stores/users.store.js and 1 other location - About 5 hrs to fix
src/modules/tasks/stores/tasks.store.js on lines 50..58

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 144.

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

Further Reading

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

    updateTask: async ({ commit, state }, params) => {
      try {
        const obj = model.clean(state.task, whitelists);
        const res = await app.config.globalProperties.axios.put(`${api}/${config.api.endPoints.tasks}/${params.id}`, obj);
        commit('task_update', res.data.data);
Severity: Major
Found in src/modules/tasks/stores/tasks.store.js and 1 other location - About 5 hrs to fix
src/modules/users/stores/users.store.js on lines 40..48

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 144.

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

Further Reading

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

const mutations = {
  task_error(err) {
    console.log(err);
  },
  tasks_set(state, data) {
Severity: Major
Found in src/modules/tasks/stores/tasks.store.js and 1 other location - About 4 hrs to fix
src/modules/users/stores/users.store.js on lines 77..93

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 121.

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

Further Reading

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

const mutations = {
  user_error(err) {
    console.log(err);
  },
  users_set(state, data) {
Severity: Major
Found in src/modules/users/stores/users.store.js and 1 other location - About 4 hrs to fix
src/modules/tasks/stores/tasks.store.js on lines 73..89

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 121.

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

Further Reading

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

    getUser: async ({ commit }, params) => {
      try {
        const res = await app.config.globalProperties.axios.get(`${api}/${config.api.endPoints.users}/${params.id}`);
        commit('user_set', res.data.data);
      } catch (err) {
Severity: Major
Found in src/modules/users/stores/users.store.js and 1 other location - About 4 hrs to fix
src/modules/tasks/stores/tasks.store.js on lines 33..40

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 118.

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

Further Reading

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

    getTask: async ({ commit }, params) => {
      try {
        const res = await app.config.globalProperties.axios.get(`${api}/${config.api.endPoints.tasks}/${params.id}`);
        commit('task_set', res.data.data);
      } catch (err) {
Severity: Major
Found in src/modules/tasks/stores/tasks.store.js and 1 other location - About 4 hrs to fix
src/modules/users/stores/users.store.js on lines 32..39

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 118.

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

Further Reading

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

    getTasks: async ({ commit }) => {
      try {
        const res = await app.config.globalProperties.axios.get(`${api}/${config.api.endPoints.tasks}/`);
        commit('tasks_set', res.data.data);
      } catch (err) {
Severity: Major
Found in src/modules/tasks/stores/tasks.store.js and 1 other location - About 3 hrs to fix
src/modules/home/stores/home.store.js on lines 26..33

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 109.

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

Further Reading

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

    getTeam: async ({ commit }) => {
      try {
        const team = await app.config.globalProperties.axios.get(`${api}/${config.api.endPoints.home}/team`);
        commit('team_set', team.data.data);
      } catch (err) {
Severity: Major
Found in src/modules/home/stores/home.store.js and 1 other location - About 3 hrs to fix
src/modules/tasks/stores/tasks.store.js on lines 25..32

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 109.

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

Further Reading

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

    deleteUser: async ({ commit }, params) => {
      try {
        await app.config.globalProperties.axios.delete(`${api}/${config.api.endPoints.users}/${params.id}`);
        commit('user_reset');
      } catch (err) {
Severity: Major
Found in src/modules/users/stores/users.store.js and 1 other location - About 3 hrs to fix
src/modules/tasks/stores/tasks.store.js on lines 59..66

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 102.

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

Further Reading

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

    deleteTask: async ({ commit }, params) => {
      try {
        await app.config.globalProperties.axios.delete(`${api}/${config.api.endPoints.tasks}/${params.id}`);
        commit('task_reset');
      } catch (err) {
Severity: Major
Found in src/modules/tasks/stores/tasks.store.js and 1 other location - About 3 hrs to fix
src/modules/users/stores/users.store.js on lines 49..56

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 102.

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

Further Reading

Function actions has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const actions = (app) => {
  const config = app.config.globalProperties.config;
  const api = `${config.api.protocol}://${config.api.host}:${config.api.port}/${config.api.base}`;
  return {
    getTeam: async ({ commit }) => {
Severity: Major
Found in src/modules/home/stores/home.store.js - About 2 hrs to fix

    Function actions has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const actions = (app) => {
      const config = app.config.globalProperties.config;
      const api = `${config.api.protocol}://${config.api.host}:${config.api.port}/${config.api.base}`;
      return {
        signin: async ({ commit, dispatch }, params) => {
    Severity: Major
    Found in src/modules/auth/stores/auth.store.js - About 2 hrs to fix

      Function actions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      const actions = (app) => {
        return {
          refreshNav: ({ commit, rootGetters }) => {
            const userRoles = localStorage.getItem(`${config.cookie.prefix}UserRoles`)
              ? localStorage.getItem(`${config.cookie.prefix}UserRoles`).split(',')
      Severity: Minor
      Found in src/modules/core/stores/core.store.js - About 2 hrs 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

      Function style has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      export const style = (kind, object) => {
        const style = {};
        if (object && object.style && object.style[kind]) {
          // background
          if (object.style[kind].background) {
      Severity: Minor
      Found in src/lib/helpers/theme.js - About 2 hrs 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

      Function actions has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const actions = (app) => {
        const config = app.config.globalProperties.config;
        const api = `${config.api.protocol}://${config.api.host}:${config.api.port}/${config.api.base}`;
      
        return {
      Severity: Minor
      Found in src/modules/tasks/stores/tasks.store.js - About 1 hr to fix

        Function install has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          install: (app) => {
            app.component('v-gravatar', {
              props: {
                email: {
                  type: String,
        Severity: Minor
        Found in src/lib/plugins/gravatar.js - About 1 hr to fix

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

          const actions = (app) => {
            const config = app.config.globalProperties.config;
            const api = `${config.api.protocol}://${config.api.host}:${config.api.port}/${config.api.base}`;
            return {
              getUsers: async ({ commit }, params) => {
          Severity: Minor
          Found in src/modules/users/stores/users.store.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language