Opetushallitus/eperusteet-frontend-utils

View on GitHub

Showing 71 of 183 total issues

Avoid too many return statements within this function.
Open

      return ColorMap.valinnainen;
Severity: Major
Found in vue/src/utils/perusterakenne.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return '';
    Severity: Major
    Found in vue/src/stores/kieli.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return ColorMap.valinnainen;
      Severity: Major
      Found in vue/src/utils/perusterakenne.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return value;
        Severity: Major
        Found in vue/src/stores/kieli.ts - About 30 mins to fix

          Function install has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            public install(vue: typeof Vue) {
              function aikaleimaFnFactory(this: void, format: string) {
                const self: any = this;
                return function(this: void, value: number) {
                  if (!Kielet.i18n.locale) {
          Severity: Minor
          Found in vue/src/plugins/aikaleima.ts - About 25 mins 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 directive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              export const directive = ($stateParams) => {
                  return {
                      restrict: "A",
                      controller: controller,
                      scope: {
          Severity: Minor
          Found in components/oikeustarkastus/oikeustarkastelu.ts - About 25 mins 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 restore has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            public async restore(event: EditointiKontrolliRestore) {
              try {
                await this.config.restore!(event.numero);
                this.logger.success('Palautettu onnistuneesti');
          
          
          Severity: Minor
          Found in vue/src/components/EpEditointi/EditointiStore.ts - About 25 mins 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 install has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            public install(vue: typeof Vue, options) {
              // Sisällön kääntäminen
              vue.prototype.$suodatin = (str: string) => Kielet.searchFn(str);
          
              vue.prototype.$filterBy = function(field: string, query: string) {
          Severity: Minor
          Found in vue/src/plugins/kaannos.ts - About 25 mins 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              export const update = (item) => i.$q((resolve, reject) => {
                  if (item.restangularized) {
                      return (item.restangularCollection ? item.getList() : item.get())
                          .then(res => {
                              return resolve(_.merge(item, res))
          Severity: Minor
          Found in components/reresolver/reresolver.ts - About 25 mins 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 requiredLokalisoituTeksti has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export function requiredLokalisoituTeksti(kielet?: readonly Kieli[]) {
            return {
              required(value: any) {
                if (!value) {
                  return false;
          Severity: Minor
          Found in vue/src/validators/required.ts - About 25 mins 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 directive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              export const directive = ($compile, $templateCache, $timeout, $animate) => {
                  let renderAmount = 0;
          
                  return {
                      template: "<div></div>",
          Severity: Minor
          Found in components/dynamic/dynamic.ts - About 25 mins 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