Opetushallitus/eperusteet-frontend-utils

View on GitHub

Showing 71 of 183 total issues

File NavigationBuilder.ts has 775 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { NavigationNodeDto, LokalisoituTekstiDto } from '../tyypit';
import _ from 'lodash';
import { Kielet } from '../stores/kieli';
import { Location } from 'vue-router';

Severity: Major
Found in vue/src/utils/NavigationBuilder.ts - About 1 day to fix

    Function setPerusteData has 307 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function setPerusteData(node: NavigationNode, rawNode: NavigationNodeDto) {
      switch (rawNode.type as string) {
      case 'viite':
      case 'taiteenala':
      case 'liite':
    Severity: Major
    Found in vue/src/utils/NavigationBuilder.ts - About 1 day to fix

      Function setOpetussuunnitelmaData has 271 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function setOpetussuunnitelmaData(node: NavigationNode, rawNode: NavigationNodeDto) {
        switch (rawNode.type as string) {
        case 'viite':
        case 'liite':
          // Route linkki
      Severity: Major
      Found in vue/src/utils/NavigationBuilder.ts - About 1 day to fix

        File perusteet.ts has 562 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Koulutustyyppi, KoulutustyyppiToteutus } from '@shared/tyypit';
        import _ from 'lodash';
        
        export const KoodistoLops2019LaajaAlaiset = 'laajaalainenosaaminenlops2021';
        
        
        Severity: Major
        Found in vue/src/utils/perusteet.ts - About 1 day to fix

          Function link has 212 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  link: (scope: any, element, attrs, ctrl) => {
                      let placeholderText = null;
                      let editingEnabled = (scope.editMode || "true") === "true";
                      let inlineEditor: boolean = true;
          
          
          Severity: Major
          Found in components/ckeditor/ckeditor.ts - About 1 day to fix

            File EditointiStore.ts has 432 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import * as _ from 'lodash';
            import Vue from 'vue';
            import VueScrollTo from 'vue-scrollto';
            import { reactive, computed } from '@vue/composition-api';
            import { Computed } from '../../utils/interfaces';
            Severity: Minor
            Found in vue/src/components/EpEditointi/EditointiStore.ts - About 6 hrs to fix

              Function view has 146 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                get view() {
                  const opsId = this.opsId;
                  const self = this;
                  return Vue.extend({
                    components: {
              Severity: Major
              Found in vue/src/components/EpContent/ImageExtension.ts - About 5 hrs to fix

                File eperusteet.ts has 386 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { axiosHandler, successfulResponseHandler } from './common';
                import { Configuration, DokumentitApiAxiosParamCreator, LiitetiedostotApiAxiosParamCreator } from '../generated/eperusteet';
                import axios, { AxiosInstance } from 'axios';
                import _ from 'lodash';
                import * as EperusteetApi from '../generated/eperusteet';
                Severity: Minor
                Found in vue/src/api/eperusteet.ts - About 5 hrs to fix

                  EditointiStore has 37 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export class EditointiStore {
                    private static allEditingEditors: EditointiStore[] = [];
                    private static router: VueRouter;
                    private static kayttajaProvider: KayttajaProvider;
                    private logger = createLogger(EditointiStore);
                  Severity: Minor
                  Found in vue/src/components/EpEditointi/EditointiStore.ts - About 4 hrs to fix

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

                            controller: ($scope, $timeout, $rootScope) => {
                                $scope.versions = [];
                    
                                const cleanTeksti = (richText: string): string => {
                                    let result = richText;
                    Severity: Major
                    Found in components/history/history.ts - About 4 hrs to fix

                      File ckeditor.ts has 326 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      angular.module("app")
                      .run(() => {
                          CKEDITOR.disableAutoInline = true;
                      })
                      .constant("editorLayouts", {
                      Severity: Minor
                      Found in components/ckeditor/ckeditor.ts - About 3 hrs to fix

                        Function view has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          get view() {
                            const handler = this.handler;
                            return Vue.extend({
                              components: {
                                TermiEditor,
                        Severity: Major
                        Found in vue/src/components/EpContent/TermiExtension.ts - About 3 hrs to fix

                          Function resolveRouterMetaProps has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export async function resolveRouterMetaProps(to) {
                            let props = {};
                          
                            try {
                              for (const record of to.matched) {
                          Severity: Minor
                          Found in vue/src/utils/router.ts - About 3 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 iterateTunnisteelliset has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                          Open

                              export const iterateTunnisteelliset = (obj: Object, cb: (tunniste: string, obj) => boolean | void) => {
                                  const cache = {}; // Cycle detection
                                  const stack = [obj]; // Recursion elimination
                          
                                  while (stack.length > 0) {
                          Severity: Minor
                          Found in components/history/history.ts - 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

                          File editointikontrollit.ts has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          interface IEditointikontrollitCallbacks {
                              start?: (val?) => Promise<any>,
                              preStart?: () => Promise<any>,
                              preSave?: () => Promise<any>,
                              save?: (kommentti?, preSavedObject?) => Promise<any>,
                          Severity: Minor
                          Found in components/editointikontrollit/editointikontrollit.ts - About 2 hrs to fix

                            Function link has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                        link: function (scope: any, element) {
                                            scope.popovers = [];
                            
                                            function destroy() {
                                                element.find(TERMI_MATCHER).each(function () {
                            Severity: Major
                            Found in components/termisto/termisto.ts - About 2 hrs to fix

                              Function createRestangular has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  export const createRestangular = (
                                      scope,
                                      field: string,
                                      resolvedObj: Restangular.IElement,
                                      callbacks: IEditointikontrollitCallbacks = {}) => {
                              Severity: Major
                              Found in components/editointikontrollit/editointikontrollit.ts - About 2 hrs to fix

                                Function directive has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    export const directive = ($parse, $timeout) => {
                                
                                        const checkInputType = (scope) => {
                                
                                            scope.datePicker = {
                                Severity: Major
                                Found in components/datepicker/datepicker.ts - About 2 hrs to fix

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

                                    get view() {
                                      const opsId = this.opsId;
                                      const self = this;
                                      return Vue.extend({
                                        components: {
                                  Severity: Minor
                                  Found in vue/src/components/EpContent/ImageExtension.ts - 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 kaanna has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    public kaanna(value?: LokalisoituTeksti | undefined | null, emptyWhenNotFound = false, squareBrackets = true, forcedLang = null): string {
                                      if (!value) {
                                        return '';
                                      }
                                      else if (_.isObject(value)) {
                                  Severity: Minor
                                  Found in vue/src/stores/kieli.ts - 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language