Opetushallitus/eperusteet-opintopolku

View on GitHub
eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts

Summary

Maintainability
F
3 days
Test Coverage

Function rakennaTekstisisalto has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function rakennaTekstisisalto(sisalto) {
            var suunnitelma = [];
            Algoritmit.kaikilleLapsisolmuille(sisalto, "lapset", function(osa, depth) {
                if (
                    osa.perusteenOsa != null &&

    File menubuilder.ts has 278 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

      Function buildOppiaineItem has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              function buildOppiaineItem(arr, oppiaine, vlk, depth, isSisalto) {

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

                function createOppiaineItem(oppiaine, depth, idx = undefined) {
                    return {
                        $id: oppiaine.id,
                        depth: depth,
                        $jnro: oppiaine.jarjestys,
        eperusteet-opintopolku-app/yo/app/scripts/views/ops/lukioopetus.ts on lines 246..257

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

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

                            suunnitelma.push({
                                id: "kasvatus",
                                $osa: osa,
                                label: osa.perusteenOsa.kasvatus ? osa.perusteenOsa.kasvatus.nimi : "",
                                depth: depth + 1,
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 199..206
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 215..222
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 223..230
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 231..238
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 239..246

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

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

                            suunnitelma.push({
                                id: "oppimisenArviointiOpetuksessa",
                                $osa: osa,
                                label: osa.perusteenOsa.oppimisenArviointiOpetuksessa ? osa.perusteenOsa.oppimisenArviointiOpetuksessa.nimi : "",
                                depth: depth + 1,
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 199..206
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 207..214
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 223..230
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 231..238
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 239..246

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

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

                            suunnitelma.push({
                                id: "yhteisetOpinnot",
                                $osa: osa,
                                label: osa.perusteenOsa.yhteisetOpinnot ? osa.perusteenOsa.yhteisetOpinnot.nimi : "",
                                depth: depth + 1,
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 199..206
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 207..214
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 215..222
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 223..230
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 231..238

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

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

                            suunnitelma.push({
                                id: "teemaopinnot",
                                $osa: osa,
                                label: osa.perusteenOsa.teemaopinnot ? osa.perusteenOsa.teemaopinnot.nimi : "",
                                depth: depth + 1,
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 199..206
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 207..214
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 215..222
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 231..238
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 239..246

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

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

                            suunnitelma.push({
                                id: "tyotavatOpetuksessa",
                                $osa: osa,
                                label: osa.perusteenOsa.tyotavatOpetuksessa ? osa.perusteenOsa.tyotavatOpetuksessa.nimi : "",
                                depth: depth + 1,
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 199..206
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 207..214
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 215..222
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 223..230
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 239..246

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

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

                            suunnitelma.push({
                                id: "aikuistenOpetus",
                                $osa: osa,
                                label: osa.perusteenOsa.aikuistenOpetus ? osa.perusteenOsa.aikuistenOpetus.nimi : "",
                                depth: depth + 1,
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 207..214
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 215..222
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 223..230
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 231..238
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 239..246

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

        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

                    _.each(suunnitelma, function(item, index) {
                        levels[item.depth] = index;
                        item.$parent = levels[item.depth - 1] || null;
                    });
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 137..140

        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

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

                                    _.some(oppimaara.vuosiluokkakokonaisuudet, function(omVlk: any) {
                                        return _.some(vlks, function(oneVlk) {
                                            return "" + omVlk._vuosiluokkaKokonaisuus === "" + oneVlk;
                                        });
                                    })
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 149..153
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/views/controllers/perusopetus.ts on lines 147..151

        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

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

                            const oppiaineHasVlk = _.some(oa.vuosiluokkakokonaisuudet, function(oavkl: any) {
                                return _.some(vlks, function(oneVlk) {
                                    return "" + oavkl._vuosiluokkaKokonaisuus === "" + oneVlk;
                                });
                            });
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 39..43
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/views/controllers/perusopetus.ts on lines 147..151

        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

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

                    _.each(menu, function(item, index) {
                        levels[item.depth] = index;
                        item.$parent = levels[item.depth - 1] || null;
                    });
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 257..260

        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

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

                                    if (!_.isEmpty(oppimaara.kurssit)) {
                                        _.each(oppimaara.kurssit, function(kurssi) {
                                            menu.push(createKurssiItem(kurssi, 2));
                                        });
                                    }
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 115..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 59.

        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 (!_.isEmpty(oppiaine.kurssit)) {
                                _.each(oppiaine.kurssit, function(kurssi) {
                                    menu.push(createKurssiItem(kurssi, 1));
                                });
                            }
        eperusteet-opintopolku-app/yo/app/eperusteet-esitys/services/menubuilder.ts on lines 108..112

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

        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