Opetushallitus/eperusteet-opintopolku

View on GitHub
eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts

Summary

Maintainability
F
5 days
Test Coverage

Function controller has 147 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                controller: (
                    $q,
                    $rootScope,
                    $scope,
                    $state,
Severity: Major
Found in eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts - About 5 hrs to fix

    File state.ts has 337 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
    Severity: Minor
    Found in eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts - About 4 hrs to fix

      Function controller has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      controller: ($q, $scope, ops, peruste, arviointiAsteikot, koodisto, koulutustoimija, pTosaViite) => {
                          $scope.pTosaViite = pTosaViite;
                          $scope.st = _.find(peruste.suoritustavat, st => st.suoritustapakoodi === ops.suoritustapa);
                          const isPaikallinen = _.property("tosa.tyyppi")($scope.osa) === "oma",
                              osaamisalaKoodit = peruste.osaamisalat,
      Severity: Major
      Found in eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts - About 3 hrs to fix

        Function update has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                                update = () => {
                                    const spRivit: any = _.indexBy($scope.osa.suorituspolku.rivit, "rakennemoduuli");
                                    Algoritmit.traverse($scope.perusteRakenne, "osat", node => {
                                        node.pakollinen = Suorituspolku.pakollinen(node);
                                        node.$$poistettu = spRivit[node.tunniste] && spRivit[node.tunniste].piilotettu;
        Severity: Major
        Found in eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts - About 2 hrs to fix

          Function pTosaViite has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      pTosaViite: async (Api, osa, ops) => {
                          if (osa.tyyppi === "tutkinnonosa") {
                              let perusteId = null;
                              let tosaId = null;
                              if (osa.tosa.tyyppi === "perusteesta") {
          Severity: Minor
          Found in eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts - About 1 hr to fix

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

                                if (osa.tosa.tyyppi === "perusteesta") {
                                    if (osa.peruste) {
                                        // Tuotu toisesta perusteesta
                                        perusteId = osa.peruste.id;
                                    } else {
            eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts on lines 60..73

            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

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

                                if (osa.tosa.tyyppi === "perusteesta") {
                                    if (osa.peruste) {
                                        // Tuotu toisesta perusteesta
                                        perusteId = osa.peruste.id;
                                    } else {
            eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts on lines 38..51

            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

                                                    if (_.size(opskohtaiset) === 1) {
                                                        $scope.misc.koodinimet[koodi.route].nimi =
                                                            opskohtaiset[0].tekstiKappale.nimi;
                                                        $scope.misc.koodinimet[koodi.route].url = $state.href("root.amops.osa", {
                                                            opsId: opskohtaiset[0].owner.id,
            eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts on lines 173..206

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

            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

                                                if (_.size(koodi) === 1) {
                                                    $scope.misc.koodinimet[koodi.route].nimi = koodi[0].tekstiKappale.nimi;
                                                    $scope.misc.koodinimet[koodi.route].url = $state.href("root.amops.osa", {
                                                        opsId: koodi[0].owner.id,
                                                        osaId: koodi[0].id
            eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts on lines 184..203

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

            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

                        pTosat: (Api, osa, ops) =>
                            (osa.tyyppi === "suorituspolku" || osa.tyyppi === "osasuorituspolku") && Api.all("perusteet/" + ops.peruste.id + "/tutkinnonosat").getList(),
            eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts on lines 96..97

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

            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

                        pSuoritustavat: (Api, osa, ops) =>
                            (osa.tyyppi === "suorituspolku" || osa.tyyppi === "osasuorituspolku") && Api.one("perusteet/" + ops.peruste.id + "/suoritustavat").get(),
            eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts on lines 32..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 66.

            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

                                        $q
                                            .all(_.map(kkoodit, koodi => koodisto.one("uri/" + koodi).get()))
                                            .then(Koodisto.parseRawKoodisto)
            eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts on lines 305..307

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

            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

                                        $q
                                            .all(_.map(koodiUrit, uri => koodisto.one("uri/" + uri).get()))
                                            .then(Koodisto.parseRawKoodisto),
            eperusteet-opintopolku-app/yo/app/scripts/views/amops/osa/state.ts on lines 157..159

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

            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