Ks89/angular-modal-gallery

View on GitHub

Showing 513 of 513 total issues

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

      expect(des[10].nativeElement.style.background).toContain(`url("${expectedModalBase64[0].image.modal.img as string}")`.trim());
projects/ks89/angular-modal-gallery/src/lib/directives/a-tag-bg-image.directive.spec.ts on lines 193..193

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

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

function initTestBed(): void {
  TestBed.configureTestingModule({
    declarations: [DotsComponent, AccessibleComponent]
  }).overrideComponent(DotsComponent, {
    set: {
projects/ks89/angular-modal-gallery/src/lib/components/upper-buttons/upper-buttons.component.spec.ts on lines 337..350

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

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

function initTestBed(): void {
  TestBed.configureTestingModule({
    declarations: [UpperButtonsComponent, SizeDirective]
  }).overrideComponent(UpperButtonsComponent, {
    set: {
projects/ks89/angular-modal-gallery/src/lib/components/dots/dots.component.spec.ts on lines 87..100

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

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

  openModalWithOutputs(id: number, imagesArrayToUse: Image[], imageIndex: number, libConfig?: ModalLibConfig): void {
    const imageToShow: Image = imagesArrayToUse[imageIndex];
    const dialogRef: ModalGalleryRef = this.modalGalleryService.open({
      id,
      images: imagesArrayToUse,

    Function openModalWithOutputs has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      openModalWithOutputs(id: number, imagesArrayToUse: Image[], imageIndex: number, libConfig?: ModalLibConfig): void {
        const imageToShow: Image = imagesArrayToUse[imageIndex];
        const dialogRef: ModalGalleryRef = this.modalGalleryService.open({
          id,
          images: imagesArrayToUse,
    Severity: Minor
    Found in src/app/modal-gallery/modal-gallery.component.ts - About 1 hr to fix

      Function openModalWithOutputs has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        openModalWithOutputs(id: number, imagesArrayToUse: Image[], imageIndex: number, libConfig?: ModalLibConfig): void {
          const imageToShow: Image = imagesArrayToUse[imageIndex];
          const dialogRef: ModalGalleryRef = this.modalGalleryService.open({
            id,
            images: imagesArrayToUse,
      Severity: Minor
      Found in examples/universal/src/app/modal-gallery/modal-gallery.component.ts - About 1 hr to fix

        Function openModalWithOutputs has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          openModalWithOutputs(id: number, imagesArrayToUse: Image[], imageIndex: number, libConfig?: ModalLibConfig): void {
            const imageToShow: Image = imagesArrayToUse[imageIndex];
            const dialogRef: ModalGalleryRef = this.modalGalleryService.open({
              id,
              images: imagesArrayToUse,

          Function initImageGrid has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private initImageGrid(): void {
              if (!this.plainGalleryConfig) {
                throw new Error('Internal library error - plainGalleryConfig must be defined');
              }
          
          

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

            interface NavigationTestData {
              initial: {
                start: number,
                end: number,
                activeIndex: number
            projects/ks89/angular-modal-gallery/src/lib/components/previews/previews.component.spec.ts on lines 37..48

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

            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

            interface NavigationTestData {
              initial: {
                start: number,
                end: number,
                activeIndex: number
            projects/ks89/angular-modal-gallery/src/lib/components/carousel/carousel-previews/carousel-previews.component.spec.ts on lines 37..48

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

            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 imagesMockEqualIds: Image[] = [
              new Image(1, {
                img: '../assets/images/gallery/img1.jpg'
              }),
              new Image(1, {
            projects/ks89/angular-modal-gallery/src/lib/utils/image.util.spec.ts on lines 28..41

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

            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 imagesMock: Image[] = [
              new Image(0, {
                img: '../assets/images/gallery/img1.jpg'
              }),
              new Image(2, {
            projects/ks89/angular-modal-gallery/src/lib/utils/image.util.spec.ts on lines 43..56

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

            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 initPlainGalleryConfig has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function initPlainGalleryConfig(plainGalleryConfig: PlainGalleryConfig): PlainGalleryConfig {
              const newPlayGalleryConfig: PlainGalleryConfig = Object.assign({}, DEFAULT_CONFIG.plainGalleryConfig, plainGalleryConfig);
            
              if (newPlayGalleryConfig.layout instanceof LineLayout) {
                if (newPlayGalleryConfig.strategy !== PlainGalleryStrategy.ROW && newPlayGalleryConfig.strategy !== PlainGalleryStrategy.COLUMN) {

            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 checkSidePreviews has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function checkSidePreviews(prevImage: InternalLibImage, nextImage: InternalLibImage,
                                       isFirstImage: boolean, isLastImage: boolean, val: TestModel, size: Size = DEFAULT_SIZE): void {
              const element: DebugElement = fixture.debugElement;
              const leftPreviewImage: DebugElement = element.query(By.css(isFirstImage
                ? 'div.current-image-previous.hidden'

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

            function checkCurrentImage(currentImage: Image, val: TestModel, withDots: boolean = true, withArrows: boolean = true, accessibilityConfig: AccessibilityConfig = KS_DEFAULT_ACCESSIBILITY_CONFIG): void  {
              const element: DebugElement = fixture.debugElement;
              const currentFigure: DebugElement = element.query(By.css('figure.current-figure'));
              expect(currentFigure.name).toBe('figure');
              const currentPictureElement: DebugElement = currentFigure.children[withArrows ? 1 : 0]; // 0 and 2 are the arrows

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

              function initTestBed(): void {
                TestBed.configureTestingModule({
                  imports: [OverlayModule],
                  declarations: [ModalGalleryComponent,
                    UpperButtonsComponent, CurrentImageComponent, DotsComponent, PreviewsComponent, LoadingSpinnerComponent,

                Function onEvent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  onEvent(button: InternalButtonConfig, event: KeyboardEvent | MouseEvent, action: Action = Action.CLICK): void {
                    if (!event) {
                      return;
                    }
                    const dataToEmit: ButtonEvent = {

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

                  const routes: Routes = [
                    { path: '', component: HomeComponent },
                    { path: 'carousel', component: CarouselExampleComponent },
                    { path: 'modal', component: ModalGalleryExampleComponent },
                    { path: 'plain', component: PlainGalleryExampleComponent }
                  Severity: Major
                  Found in examples/universal/src/app/app-routing.module.ts and 3 other locations - About 1 hr to fix
                  examples/angular-cli-18/src/app/app-routing.module.ts on lines 9..14
                  examples/angular-cli-material/src/app/app-routing.module.ts on lines 9..14
                  src/app/app-routing.module.ts on lines 9..14

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

                  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

                  const routes: Routes = [
                    { path: '', component: HomeComponent },
                    { path: 'carousel', component: CarouselExampleComponent },
                    { path: 'modal', component: ModalGalleryExampleComponent },
                    { path: 'plain', component: PlainGalleryExampleComponent }
                  Severity: Major
                  Found in src/app/app-routing.module.ts and 3 other locations - About 1 hr to fix
                  examples/angular-cli-18/src/app/app-routing.module.ts on lines 9..14
                  examples/angular-cli-material/src/app/app-routing.module.ts on lines 9..14
                  examples/universal/src/app/app-routing.module.ts on lines 9..14

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

                  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

                  const routes: Routes = [
                    { path: '', component: HomeComponent },
                    { path: 'carousel', component: CarouselExampleComponent },
                    { path: 'modal', component: ModalGalleryExampleComponent },
                    { path: 'plain', component: PlainGalleryExampleComponent }
                  examples/angular-cli-18/src/app/app-routing.module.ts on lines 9..14
                  examples/universal/src/app/app-routing.module.ts on lines 9..14
                  src/app/app-routing.module.ts on lines 9..14

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

                  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