aurelia/aurelia

View on GitHub
packages/__tests__/src/validation-i18n/localization.spec.ts

Summary

Maintainability
F
1 wk
Test Coverage

File localization.spec.ts has 338 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { I18N, I18nConfiguration, I18nConfigurationOptions } from '@aurelia/i18n';
import { IContainer, Registration } from '@aurelia/kernel';
import { assert, TestContext } from '@aurelia/testing';
import {
  IValidationMessageProvider,
Severity: Minor
Found in packages/__tests__/src/validation-i18n/localization.spec.ts - About 4 hrs to fix

    Function assertEventHandler has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        async function assertEventHandler(target: HTMLElement, event: 'change' | 'focusout', callCount: number, platform: IPlatform, controllerSpy: Spy, ctx: TestContext) {
    Severity: Minor
    Found in packages/__tests__/src/validation-i18n/localization.spec.ts - About 45 mins to fix

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

          $it('supports registration of default namespace',
            async function ({ app, container, host, platform, ctx }) {
              const controller = app.controller;
              const controllerSpy = app.controllerSpy;
      
      
      Severity: Major
      Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 1 other location - About 1 day to fix
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 345..370

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

      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

          $it('supports registration of default prefix',
            async function ({ app, container, host, platform, ctx }) {
              const controller = app.controller;
              const controllerSpy = app.controllerSpy;
      
      
      Severity: Major
      Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 1 other location - About 1 day to fix
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 318..343

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

      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

          $it('can provides localized validation failure messages from different namespace',
            async function ({ app, container, host, platform, ctx }) {
              const controller = app.controller;
              const controllerSpy = app.controllerSpy;
      
      
      Severity: Major
      Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 2 other locations - About 1 day to fix
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 240..264
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 266..290

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

      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

          $it('provides localized validation failure messages',
            async function ({ app, container, host, platform, ctx }) {
              const controller = app.controller;
              const controllerSpy = app.controllerSpy;
      
      
      Severity: Major
      Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 2 other locations - About 1 day to fix
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 266..290
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 292..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 240.

      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

          $it('provides localized validation failure messages for specific keys',
            async function ({ app, container, host, platform, ctx }) {
              const controller = app.controller;
              const controllerSpy = app.controllerSpy;
      
      
      Severity: Major
      Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 2 other locations - About 1 day to fix
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 240..264
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 292..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 240.

      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

                    en: {
                      translation: {
                        required: `Enter a value for \${$displayName}.`,
                        name: 'Name',
                        age: 'Age',
      Severity: Major
      Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 1 other location - About 2 hrs to fix
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 122..141

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

      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

                    de: {
                      translation: {
                        required: `Geben Sie einen Wert für \${$displayName} ein.`,
                        name: 'Name',
                        age: 'Alter',
      Severity: Major
      Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 1 other location - About 2 hrs to fix
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 102..121

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

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

            public dispose() {
              const controller = this.controller;
              assert.equal(controller.results.length, 0, 'the result should have been removed');
              assert.equal(controller.bindings.size, 0, 'the bindings should have been removed');
              assert.equal(controller.objects.size, 0, 'the objects should have been removed');
      Severity: Major
      Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 3 other locations - About 2 hrs to fix
      packages/__tests__/src/validation-html/subscribers/validation-container-custom-element.spec.ts on lines 49..54
      packages/__tests__/src/validation-html/subscribers/validation-errors-custom-attribute.spec.ts on lines 53..58
      packages/__tests__/src/validation-html/validation-controller.spec.ts on lines 167..172

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

      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

              assert.deepStrictEqual(
                results.filter(r => !r.valid).map((r) => r.toString()),
                ['Name ist notwendig', 'Geben Sie einen Wert für Alter ein.']
              );
      Severity: Minor
      Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 1 other location - About 50 mins to fix
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 224..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 52.

      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

              assert.deepStrictEqual(
                results.filter(r => !r.valid).map((r) => r.toString()),
                ['Name is mandatory', 'Enter a value for Age.']
              );
      Severity: Minor
      Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 1 other location - About 50 mins to fix
      packages/__tests__/src/validation-i18n/localization.spec.ts on lines 232..235

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

      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