Opetushallitus/eperusteet-opintopolku

View on GitHub
eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts

Summary

Maintainability
F
1 wk
Test Coverage

Function setState has 293 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        this.setState = function(navi) {
            this.state = {};
            _.each(navi.sections, function(section) {
                section.$open = false;
                _.each(section.items, function(item) {

    File opssivunaviutils.ts has 312 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright (c) 2013 The Finnish Board of Education - Opetushallitus
     *
     * This program is free software: Licensed under the EUPL, Version 1.1 or - as
     * soon as they will be approved by the European Commission - subsequent versions

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

                      valinainenoppiaine: {
                          index: 1,
                          callback: function(item) {
                              if (item.$oppiaine) {
                                  item.$selected =
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 173..192

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

      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

                      oppiaine: {
                          index: 1,
                          callback: function(item) {
                              if (item.$oppiaine) {
                                  item.$selected =
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 193..212

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

      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 4 locations. Consider refactoring.
      Open

                  if (selected && section) {
                      var menuItems = items || section.items;
                      var parent = selected.$parent;
                      while (_.isNumber(parent)) {
                          menuItems[parent].$header = true;
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 140..150
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/stateservice.ts on lines 166..176
      eperusteet-opintopolku-app/yo/app/scripts/common/services/lukioopsstateservice.ts on lines 144..154

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

      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

                      vaihe: {
                          index: 1,
                          callback: function(item) {
                              if (item.$vaihe != null) {
                                  item.$selected = "" + $stateParams.vaiheId === "" + item.$vaihe.id;
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 228..242

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

      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

                      kurssi: {
                          index: 1,
                          callback: function(item) {
                              if (item.$vaihe != null) {
                                  item.$selected = "" + $stateParams.vaiheId === "" + item.$vaihe.id;
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 213..227

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

      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 7 locations. Consider refactoring.
      Open

                      valinnaisetoppiaineet: {
                          index: 3,
                          callback: function(item) {
                              if (item.$oppiaine) {
                                  item.$selected = "" + $stateParams.oppiaineId === "" + item.$oppiaine.id;
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 101..115
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 116..130
      eperusteet-opintopolku-app/yo/app/scripts/common/services/lukioopsstateservice.ts on lines 102..116
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 243..257
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 287..301
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 302..316

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

      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 7 locations. Consider refactoring.
      Open

                      vlk: {
                          index: 2,
                          callback: function(item) {
                              if (item.$oppiaine) {
                                  item.$selected = "" + $stateParams.oppiaineId === "" + item.$oppiaine.id;
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 101..115
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 116..130
      eperusteet-opintopolku-app/yo/app/scripts/common/services/lukioopsstateservice.ts on lines 102..116
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 243..257
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 272..286
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 302..316

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

      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 7 locations. Consider refactoring.
      Open

                      oppiaineet: {
                          index: 2,
                          callback: function(item) {
                              if (item.$oppiaine) {
                                  item.$selected = "" + $stateParams.oppiaineId === "" + item.$oppiaine.id;
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 101..115
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 116..130
      eperusteet-opintopolku-app/yo/app/scripts/common/services/lukioopsstateservice.ts on lines 102..116
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 272..286
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 287..301
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 302..316

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

      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 7 locations. Consider refactoring.
      Open

                      vuosi: {
                          index: 2,
                          callback: function(item) {
                              if (item.$oppiaine) {
                                  item.$selected = "" + $stateParams.oppiaineId === "" + item.$oppiaine.id;
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 101..115
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 116..130
      eperusteet-opintopolku-app/yo/app/scripts/common/services/lukioopsstateservice.ts on lines 102..116
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 243..257
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 272..286
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 287..301

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

      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

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

                      if (item.$osa) {
                          item.$selected = "" + $stateParams.tekstikappaleId === "" + item.$osa.id;
                          item.$hidden = item.depth > 0;
                      } else if (item.id === "laajaalaiset") {
                          item.$selected = $state.is(epEsitysSettings.perusopetusState + ".laajaalaiset");
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/stateservice.ts on lines 71..76

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

      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

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

                  _.each(navi.sections, function(section) {
                      section.$open = false;
                      _.each(section.items, function(item) {
                          item.$selected = false;
                          item.$header = false;
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 38..47
      eperusteet-opintopolku-app/yo/app/scripts/common/services/lukioopsstateservice.ts on lines 37..46

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

      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 5 locations. Consider refactoring.
      Open

                      laajaalaiset: {
                          index: 0,
                          callback: function(item) {
                              item.$selected =
                                  _.isArray(item.link) &&
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 92..100
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/stateservice.ts on lines 100..108
      eperusteet-opintopolku-app/yo/app/scripts/common/services/lukioopsstateservice.ts on lines 93..101
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 105..113

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

      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 5 locations. Consider refactoring.
      Open

                      tiedot: {
                          index: 0,
                          callback: function(item) {
                              item.$selected =
                                  _.isArray(item.link) &&
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/lukiostateservice.ts on lines 92..100
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/stateservice.ts on lines 100..108
      eperusteet-opintopolku-app/yo/app/scripts/common/services/lukioopsstateservice.ts on lines 93..101
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 114..122

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

      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

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

                      vuosiluokkakokonaisuus: {
                          index: 1,
                          callback: function(item) {
                              if (item.$vkl) {
                                  item.$selected = "" + $stateParams.vlkId === "" + item.$vkl.id;
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/stateservice.ts on lines 109..119

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

      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

                  function setParentOppiaineHeader() {
                      if (selected && selected.$oppiaine) {
                          var found = _.find(items, function(item: any) {
                              return item.$vuosi === "" + selected.$parent_vuosi;
                          });
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 89..98

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

      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

                  function setParent() {
                      if (selected && selected.$oppiaine) {
                          var found = _.find(items, function(item: any) {
                              return item.$vuosi === "" + selected.$parent_vuosi;
                          });
      eperusteet-opintopolku-app/yo/app/scripts/views/ops/opssivunaviutils.ts on lines 53..62

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

      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

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

                              if (item.$oppiaine) {
                                  item.$selected =
                                      "" + $stateParams.oppiaineId === "" + item.$oppiaine.id &&
                                      $stateParams.vlkId === "" + parentVlkId;
                              }
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/stateservice.ts on lines 127..131

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

      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

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

                              if (item.$vkl) {
                                  item.$header = "" + $stateParams.vlkId === "" + item.$vkl.id;
                                  parentVlkId = item.$vkl.id;
                              }
      eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/stateservice.ts on lines 123..126

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

      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

      There are no issues that match your filters.

      Category
      Status