Ks89/angular-modal-gallery

View on GitHub

Showing 513 of 513 total issues

Identical blocks of code found in 4 locations. Consider refactoring.
Open

export const LIBCONFIG_501: ModalLibConfig = {
  buttonsConfig: {
    visible: false,
    strategy: ButtonsStrategy.DEFAULT
  },
examples/angular-cli-18/src/app/modal-gallery/libconfigs.ts on lines 63..74
examples/universal/src/app/modal-gallery/libconfigs.ts on lines 63..74
src/app/modal-gallery/libconfigs.ts on lines 63..74

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

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

export class AppModule {}
Severity: Major
Found in examples/angular-cli-18/src/app/app.module.ts and 1 other location - About 1 hr to fix
src/app/app.module.ts on lines 71..71

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

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

export class AppModule {}
Severity: Major
Found in src/app/app.module.ts and 1 other location - About 1 hr to fix
examples/angular-cli-18/src/app/app.module.ts on lines 71..71

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

Function handleBoundaries has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private handleBoundaries(currentIndex: number): void {
    if (this.images.length === 1) {
      this.isFirstImage = true;
      this.isLastImage = true;
      this.ref.markForCheck();

    Function onFullScreen has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      onFullScreen(event: ButtonEvent): void {
        const eventToEmit: ButtonEvent = this.getButtonEventToEmit(event);
        this.modalGalleryService.emitButtonBeforeHook(eventToEmit);
    
        // tslint:disable-next-line:no-any

      Function checkPreview has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function checkPreview(previewElement: DebugElement, previewImage: InternalLibImage, isActive: boolean, size: Size = DEFAULT_PREVIEW_SIZE): void {
        const currentPlainImg: PlainImage | undefined = previewImage.plain;
        const currentModalImg: ModalImage | undefined = previewImage.modal;
        expect(previewElement.name).toBe('img');
        expect(previewElement.attributes.role).toBe('img');

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

              it(`should call close without calling open before with clickOutside=true`,
                inject([ModalGalleryService], (service: ModalGalleryService) => {
                  const ID: number = 1;
                  // the close
                  service.close(ID, true);
        projects/ks89/angular-modal-gallery/src/lib/components/modal-gallery/modal-gallery.service.spec.ts on lines 212..218

        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

              it(`should call close without calling open before with clickOutside=false`,
                inject([ModalGalleryService], (service: ModalGalleryService) => {
                  const ID: number = 1;
                  // the close
                  service.close(ID, false);
        projects/ks89/angular-modal-gallery/src/lib/components/modal-gallery/modal-gallery.service.spec.ts on lines 222..228

        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

        Function initTestBed has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function initTestBed(): void {
          TestBed.configureTestingModule({
            imports: [OverlayModule],
            declarations: [
              ClickOutsideDirective,

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

                  comp.ngOnChanges({
                    currentImage: {
                      previousValue: IMAGES[0],
                      currentValue: IMAGES[1],
                      firstChange: false,
          projects/ks89/angular-modal-gallery/src/lib/components/previews/previews.component.spec.ts on lines 761..768
          projects/ks89/angular-modal-gallery/src/lib/components/previews/previews.component.spec.ts on lines 774..781

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

          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

                  comp.ngOnChanges({
                    currentImage: {
                      previousValue: IMAGES[1],
                      currentValue: IMAGES[2],
                      firstChange: false,
          projects/ks89/angular-modal-gallery/src/lib/components/previews/previews.component.spec.ts on lines 741..748
          projects/ks89/angular-modal-gallery/src/lib/components/previews/previews.component.spec.ts on lines 774..781

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

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

              switch (configCurrentImageCarousel.description.strategy) {
                case DescriptionStrategy.HIDE_IF_EMPTY:
                  return imageWithoutDescription ? '' : image.modal.description + '';
                case DescriptionStrategy.ALWAYS_HIDDEN:
                  return '';
          projects/ks89/angular-modal-gallery/src/lib/components/current-image/current-image.component.ts on lines 328..336

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

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

              switch (this.currentImageConfig.description.strategy) {
                case DescriptionStrategy.HIDE_IF_EMPTY:
                  return imageWithoutDescription ? '' : image.modal.description + '';
                case DescriptionStrategy.ALWAYS_HIDDEN:
                  return '';
          projects/ks89/angular-modal-gallery/src/lib/components/carousel/carousel.component.ts on lines 444..452

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

          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

                  comp.ngOnChanges({
                    currentImage: {
                      previousValue: IMAGES[3],
                      currentValue: IMAGES[4],
                      firstChange: false,
          projects/ks89/angular-modal-gallery/src/lib/components/previews/previews.component.spec.ts on lines 741..748
          projects/ks89/angular-modal-gallery/src/lib/components/previews/previews.component.spec.ts on lines 761..768

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

          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

          export const DEFAULT_CAROUSEL_PREVIEWS_CONFIG: CarouselPreviewConfig = {
            visible: true,
            number: 4,
            arrows: true,
            clickable: true,
          projects/ks89/angular-modal-gallery/src/lib/components/carousel/carousel-previews/carousel-previews.component.spec.ts on lines 262..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 57.

          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

          const DEFAULT_PREVIEW_CONFIG: CarouselPreviewConfig = {
            visible: true,
            number: 4,
            arrows: true,
            clickable: true,
          projects/ks89/angular-modal-gallery/src/lib/services/config.service.ts on lines 98..106

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

          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

          Function ngOnInit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            ngOnInit(): void {
              const libConfig: LibConfig | undefined = this.configService.getConfig(this.id);
              if (!libConfig) {
                throw new Error('Internal library error - libConfig must be defined');
              }

          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 buildTextDescription has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private buildTextDescription(image: Image | undefined, imageWithoutDescription: boolean): string {
              if (this.id === null || this.id === undefined) {
                throw new Error('Internal library error - id must be defined');
              }
              const libConfig: LibConfig | undefined = this.configService.getConfig(this.id);

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

                  if (this.description.style.height) {
                    this.renderer.setStyle(this.el.nativeElement, 'height', this.description.style.height);
                  }
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 73..75
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 79..81
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 82..84
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 85..87
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 88..90
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 91..93

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

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

                  if (this.description.style.bottom) {
                    this.renderer.setStyle(this.el.nativeElement, 'bottom', this.description.style.bottom);
                  }
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 73..75
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 76..78
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 79..81
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 82..84
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 88..90
            projects/ks89/angular-modal-gallery/src/lib/directives/description.directive.ts on lines 91..93

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

            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

            Severity
            Category
            Status
            Source
            Language