aurelia/aurelia

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

Summary

Maintainability
F
2 wks
Test Coverage

File localization.spec.ts has 478 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 7 hrs to fix

    Function constructor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          public constructor(container: IContainer) {
            const factory = this.factory = new LocalizedValidationControllerFactory();
            this.controllerSpy = new Spy();
    
            // mocks LocalizedValidationControllerFactory#createForCurrentScope
    Severity: Minor
    Found in packages/__tests__/src/validation-i18n/localization.spec.ts - About 1 hr 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 translating state rule',
              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 2 days to fix
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 519..565

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

        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 translating state rule with explicit message key',
              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 2 days to fix
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 471..517

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

        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('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 2 other locations - About 1 day to fix
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 388..413
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 416..441

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

        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('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 2 other locations - About 1 day to fix
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 361..386
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 416..441

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

        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('supports registration of default prefix - Discourse 5507',
              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 361..386
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 388..413

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

        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 309..333
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 335..359

        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 283..307
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 335..359

        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('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 283..307
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 309..333

        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

                      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 4 hrs to fix
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 126..154

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

        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 4 hrs to fix
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 155..183

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

        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

                validationRules
                  .on(this.person4)
                  .ensure('name')
                  .satisfiesState<StateError, string>('none', (_v, _o) => this.stateError, { foo: 'stateError.foo', bar: 'stateError.bar' })
        Severity: Major
        Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 1 other location - About 1 hr to fix
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 78..81

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

        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

                validationRules
                  .on(this.person3)
                  .ensure('name')
                  .satisfiesState<StateError, string>('none', (_v, _o) => this.stateError, { foo: 'stateError.foo', bar: 'stateError.bar' });
        Severity: Major
        Found in packages/__tests__/src/validation-i18n/localization.spec.ts and 1 other location - About 1 hr to fix
        packages/__tests__/src/validation-i18n/localization.spec.ts on lines 83..86

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

        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 275..278

        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 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 267..270

        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