core/templates/services/context.service.spec.ts

Summary

Maintainability
F
1 wk
Test Coverage

File context.service.spec.ts has 474 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2014 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Severity: Minor
Found in core/templates/services/context.service.spec.ts - About 7 hrs to fix

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

        location: {
          _pathname: '/explore/123',
          _href: '',
          get pathname(): string {
            return this._pathname;
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 3 hrs to fix
    core/templates/pages/landing-pages/topic-landing-page/topic-landing-page.component.spec.ts on lines 39..54

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

    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('should correctly set and retrieve the topic id', () => {
          expect(ecs.getEntityId()).toBe('undefined');
    
          spyOn(urlService, 'getPathname').and.returnValue('/topic_editor/123');
          spyOn(urlService, 'getHash').and.returnValue('');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 2 other locations - About 3 hrs to fix
    core/templates/services/context.service.spec.ts on lines 279..286
    core/templates/services/context.service.spec.ts on lines 319..326

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

    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('should correctly retrieve the story id', () => {
          expect(ecs.getEntityId()).toBe('undefined');
    
          spyOn(urlService, 'getPathname').and.returnValue('/story_editor/123');
          spyOn(urlService, 'getHash').and.returnValue('');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 2 other locations - About 3 hrs to fix
    core/templates/services/context.service.spec.ts on lines 192..199
    core/templates/services/context.service.spec.ts on lines 319..326

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

    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('should correctly retrieve the skill id', () => {
          expect(ecs.getEntityId()).toBe('undefined');
    
          spyOn(urlService, 'getPathname').and.returnValue('/skill_editor/123');
          spyOn(urlService, 'getHash').and.returnValue('');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 2 other locations - About 3 hrs to fix
    core/templates/services/context.service.spec.ts on lines 192..199
    core/templates/services/context.service.spec.ts on lines 279..286

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

    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 correctly retrieve the values in topic editor', () => {
          spyOn(urlService, 'getPathname').and.returnValue('/topic_editor/123');
          spyOn(urlService, 'getHash').and.returnValue('#/questions#questionId');
    
          expect(ecs.getEntityType()).toBe('question');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 3 hrs to fix
    core/templates/services/context.service.spec.ts on lines 246..252

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

    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 correctly retrieve the values in skill editor', () => {
          spyOn(urlService, 'getPathname').and.returnValue('/skill_editor/123');
          spyOn(urlService, 'getHash').and.returnValue('#/questions#questionId');
    
          expect(ecs.getEntityType()).toBe('question');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 3 hrs to fix
    core/templates/services/context.service.spec.ts on lines 238..244

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

    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 correctly set and retrieve the entity type', () => {
          expect(ecs.getEntityType()).toBeUndefined();
          spyOn(urlService, 'getPathname').and.returnValue('/topic_editor/123');
          spyOn(urlService, 'getHash').and.returnValue('');
          expect(ecs.getEntityType()).toBe('topic');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 3 hrs to fix
    core/templates/services/context.service.spec.ts on lines 328..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 96.

    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 correctly retrieve the entity type', () => {
          expect(ecs.getEntityType()).toBeUndefined();
          spyOn(urlService, 'getPathname').and.returnValue('/skill_editor/123');
          spyOn(urlService, 'getHash').and.returnValue('');
          expect(ecs.getEntityType()).toBe('skill');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 3 hrs to fix
    core/templates/services/context.service.spec.ts on lines 201..206

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

    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 retrieve the exploration id cached before', () => {
          windowRef.nativeWindow.location.pathname = '/explore/456';
          expect(ecs.getExplorationId()).toBe('456');
          windowRef.nativeWindow.location.pathname = '/explore/789';
          expect(ecs.getExplorationId()).toBe('456');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 3 hrs to fix
    core/templates/services/context.service.spec.ts on lines 453..458

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

    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 retrieve the learner group id cached before', () => {
          windowRef.nativeWindow.location.pathname = '/edit-learner-group/groupId1';
          expect(ecs.getLearnerGroupId()).toBe('groupId1');
          windowRef.nativeWindow.location.pathname = '/edit-learner-group/groupId2';
          expect(ecs.getLearnerGroupId()).toBe('groupId1');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 3 hrs to fix
    core/templates/services/context.service.spec.ts on lines 590..595

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

    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

        beforeEach(() => {
          windowRef = new MockWindowRef();
          TestBed.configureTestingModule({
            providers: [
              UrlInterpolationService,
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 577..588

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

    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

        beforeEach(() => {
          windowRef = new MockWindowRef();
          TestBed.configureTestingModule({
            providers: [
              UrlInterpolationService,
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 426..437

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

    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

        beforeEach(() => {
          ecs = TestBed.get(ContextService);
          urlService = TestBed.get(UrlService);
          spyOn(urlService, 'getPathname').and.returnValue('/explore/123');
          spyOn(urlService, 'getHash').and.returnValue('');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 2 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 108..116
    core/templates/services/context.service.spec.ts on lines 145..151

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

    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

        beforeEach(() => {
          ecs = TestBed.get(ContextService);
          urlService = TestBed.get(UrlService);
          spyOn(urlService, 'getPathname').and.returnValue(
            '/embed/exploration/123'
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 2 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 61..67
    core/templates/services/context.service.spec.ts on lines 145..151

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

    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

        beforeEach(() => {
          ecs = TestBed.get(ContextService);
          urlService = TestBed.get(UrlService);
          spyOn(urlService, 'getPathname').and.returnValue('/create/123');
          spyOn(urlService, 'getHash').and.returnValue('#/gui');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 2 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 61..67
    core/templates/services/context.service.spec.ts on lines 108..116

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

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

        it('should correctly retrieve the page context as question player', () => {
          expect(ecs.getPageContext()).toBe('other');
          spyOn(urlService, 'getPathname').and.returnValue('/session/123');
          expect(ecs.getPageContext()).toBe('question_player');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 8 other locations - About 2 hrs to fix
    core/templates/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.spec.ts on lines 338..344
    core/templates/services/context.service.spec.ts on lines 208..212
    core/templates/services/context.service.spec.ts on lines 294..298
    core/templates/services/context.service.spec.ts on lines 335..339
    core/templates/services/context.service.spec.ts on lines 373..379
    core/templates/services/context.service.spec.ts on lines 483..487
    core/templates/services/context.service.spec.ts on lines 495..501
    core/templates/services/context.service.spec.ts on lines 515..521

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

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

        it('should correctly set and retrieve the page context', () => {
          expect(ecs.getPageContext()).toBe('other');
          spyOn(urlService, 'getPathname').and.returnValue('/topic_editor/123');
          expect(ecs.getPageContext()).toBe('topic_editor');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 8 other locations - About 2 hrs to fix
    core/templates/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.spec.ts on lines 338..344
    core/templates/services/context.service.spec.ts on lines 294..298
    core/templates/services/context.service.spec.ts on lines 335..339
    core/templates/services/context.service.spec.ts on lines 373..379
    core/templates/services/context.service.spec.ts on lines 483..487
    core/templates/services/context.service.spec.ts on lines 489..493
    core/templates/services/context.service.spec.ts on lines 495..501
    core/templates/services/context.service.spec.ts on lines 515..521

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

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

        it('should correctly retrieve the page context as question editor', () => {
          expect(ecs.getPageContext()).toBe('other');
          spyOn(urlService, 'getPathname').and.returnValue('/question_editor/123');
          expect(ecs.getPageContext()).toBe('question_editor');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 8 other locations - About 2 hrs to fix
    core/templates/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.spec.ts on lines 338..344
    core/templates/services/context.service.spec.ts on lines 208..212
    core/templates/services/context.service.spec.ts on lines 294..298
    core/templates/services/context.service.spec.ts on lines 335..339
    core/templates/services/context.service.spec.ts on lines 373..379
    core/templates/services/context.service.spec.ts on lines 489..493
    core/templates/services/context.service.spec.ts on lines 495..501
    core/templates/services/context.service.spec.ts on lines 515..521

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

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

        it('should correctly retrieve the page context', () => {
          expect(ecs.getPageContext()).toBe('other');
          spyOn(urlService, 'getPathname').and.returnValue('/story_editor/123');
          expect(ecs.getPageContext()).toBe('story_editor');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 8 other locations - About 2 hrs to fix
    core/templates/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.spec.ts on lines 338..344
    core/templates/services/context.service.spec.ts on lines 208..212
    core/templates/services/context.service.spec.ts on lines 335..339
    core/templates/services/context.service.spec.ts on lines 373..379
    core/templates/services/context.service.spec.ts on lines 483..487
    core/templates/services/context.service.spec.ts on lines 489..493
    core/templates/services/context.service.spec.ts on lines 495..501
    core/templates/services/context.service.spec.ts on lines 515..521

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

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

        it('should correctly retrieve the page context', () => {
          expect(ecs.getPageContext()).toBe('other');
          spyOn(urlService, 'getPathname').and.returnValue('/skill_editor/123');
          expect(ecs.getPageContext()).toBe('skill_editor');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 8 other locations - About 2 hrs to fix
    core/templates/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.spec.ts on lines 338..344
    core/templates/services/context.service.spec.ts on lines 208..212
    core/templates/services/context.service.spec.ts on lines 294..298
    core/templates/services/context.service.spec.ts on lines 373..379
    core/templates/services/context.service.spec.ts on lines 483..487
    core/templates/services/context.service.spec.ts on lines 489..493
    core/templates/services/context.service.spec.ts on lines 495..501
    core/templates/services/context.service.spec.ts on lines 515..521

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

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

        it('should correctly retrieve the page context as contributor dashboard', () => {
          expect(ecs.getPageContext()).toBe('other');
          spyOn(urlService, 'getPathname').and.returnValue(
            '/contributor-dashboard/123'
          );
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 8 other locations - About 2 hrs to fix
    core/templates/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.spec.ts on lines 338..344
    core/templates/services/context.service.spec.ts on lines 208..212
    core/templates/services/context.service.spec.ts on lines 294..298
    core/templates/services/context.service.spec.ts on lines 335..339
    core/templates/services/context.service.spec.ts on lines 373..379
    core/templates/services/context.service.spec.ts on lines 483..487
    core/templates/services/context.service.spec.ts on lines 489..493
    core/templates/services/context.service.spec.ts on lines 495..501

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

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

        it('should correctly retrieve the page context', () => {
          expect(ecs.getPageContext()).toBe('other');
    
          spyOn(urlService, 'getPathname').and.returnValue('/blog-dashboard');
    
    
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 8 other locations - About 2 hrs to fix
    core/templates/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.spec.ts on lines 338..344
    core/templates/services/context.service.spec.ts on lines 208..212
    core/templates/services/context.service.spec.ts on lines 294..298
    core/templates/services/context.service.spec.ts on lines 335..339
    core/templates/services/context.service.spec.ts on lines 483..487
    core/templates/services/context.service.spec.ts on lines 489..493
    core/templates/services/context.service.spec.ts on lines 495..501
    core/templates/services/context.service.spec.ts on lines 515..521

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

    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

        it('should correctly check that page allows editing of RTE components', () => {
          expect(ecs.canAddOrEditComponents()).toBe(false);
          spyOn(urlService, 'getPathname').and.returnValue('/topic_editor/123');
          expect(ecs.canAddOrEditComponents()).toBe(true);
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 6 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 254..258
    core/templates/services/context.service.spec.ts on lines 260..264
    core/templates/services/context.service.spec.ts on lines 300..304
    core/templates/services/context.service.spec.ts on lines 341..345
    core/templates/services/context.service.spec.ts on lines 381..387
    core/templates/services/context.service.spec.ts on lines 389..395

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

    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

        it('should check if rte is in blog post editor', () => {
          expect(ecs.isInBlogPostEditorPage()).toBe(false);
    
          spyOn(urlService, 'getPathname').and.returnValue('/blog-dashboard');
    
    
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 6 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 214..218
    core/templates/services/context.service.spec.ts on lines 254..258
    core/templates/services/context.service.spec.ts on lines 260..264
    core/templates/services/context.service.spec.ts on lines 300..304
    core/templates/services/context.service.spec.ts on lines 341..345
    core/templates/services/context.service.spec.ts on lines 381..387

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

    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

        it('should affirm the exploration context for exploration editor', () => {
          expect(ecs.isInExplorationContext()).toBe(false);
          spyOn(urlService, 'getPathname').and.returnValue('/create/123');
          expect(ecs.isInExplorationContext()).toBe(true);
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 6 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 214..218
    core/templates/services/context.service.spec.ts on lines 254..258
    core/templates/services/context.service.spec.ts on lines 300..304
    core/templates/services/context.service.spec.ts on lines 341..345
    core/templates/services/context.service.spec.ts on lines 381..387
    core/templates/services/context.service.spec.ts on lines 389..395

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

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

        it('should correctly retrieve the page context as collection editor', () => {
          expect(ecs.getPageContext()).toBe('other');
          spyOn(urlService, 'getPathname').and.returnValue(
            '/collection_editor/123'
          );
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 8 other locations - About 2 hrs to fix
    core/templates/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.spec.ts on lines 338..344
    core/templates/services/context.service.spec.ts on lines 208..212
    core/templates/services/context.service.spec.ts on lines 294..298
    core/templates/services/context.service.spec.ts on lines 335..339
    core/templates/services/context.service.spec.ts on lines 373..379
    core/templates/services/context.service.spec.ts on lines 483..487
    core/templates/services/context.service.spec.ts on lines 489..493
    core/templates/services/context.service.spec.ts on lines 515..521

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

    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

        it('should correctly check that page allows editing of RTE components', () => {
          expect(ecs.canAddOrEditComponents()).toBe(false);
          spyOn(urlService, 'getPathname').and.returnValue('/skill_editor/123');
          expect(ecs.canAddOrEditComponents()).toBe(true);
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 6 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 214..218
    core/templates/services/context.service.spec.ts on lines 254..258
    core/templates/services/context.service.spec.ts on lines 260..264
    core/templates/services/context.service.spec.ts on lines 300..304
    core/templates/services/context.service.spec.ts on lines 381..387
    core/templates/services/context.service.spec.ts on lines 389..395

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

    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

        it('should correctly check that page allows editing of RTE components', () => {
          expect(ecs.canAddOrEditComponents()).toBe(false);
          spyOn(urlService, 'getPathname').and.returnValue('/story_editor/123');
          expect(ecs.canAddOrEditComponents()).toBe(true);
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 6 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 214..218
    core/templates/services/context.service.spec.ts on lines 254..258
    core/templates/services/context.service.spec.ts on lines 260..264
    core/templates/services/context.service.spec.ts on lines 341..345
    core/templates/services/context.service.spec.ts on lines 381..387
    core/templates/services/context.service.spec.ts on lines 389..395

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

    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

        it('should affirm the exploration context for exploration player', () => {
          expect(ecs.isInExplorationContext()).toBe(false);
          spyOn(urlService, 'getPathname').and.returnValue('/explore/123');
          expect(ecs.isInExplorationContext()).toBe(true);
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 6 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 214..218
    core/templates/services/context.service.spec.ts on lines 260..264
    core/templates/services/context.service.spec.ts on lines 300..304
    core/templates/services/context.service.spec.ts on lines 341..345
    core/templates/services/context.service.spec.ts on lines 381..387
    core/templates/services/context.service.spec.ts on lines 389..395

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

    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

        it('should correctly check that page allows editing of RTE components', () => {
          expect(ecs.canAddOrEditComponents()).toBe(false);
    
          spyOn(urlService, 'getPathname').and.returnValue('/blog-dashboard');
    
    
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 6 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 214..218
    core/templates/services/context.service.spec.ts on lines 254..258
    core/templates/services/context.service.spec.ts on lines 260..264
    core/templates/services/context.service.spec.ts on lines 300..304
    core/templates/services/context.service.spec.ts on lines 341..345
    core/templates/services/context.service.spec.ts on lines 389..395

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

    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('should correctly retrieve the entity type', () => {
          expect(ecs.getEntityType()).toBeUndefined();
    
          spyOn(urlService, 'getPathname').and.returnValue('/blog');
    
    
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 2 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 288..292
    core/templates/services/context.service.spec.ts on lines 365..371

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

    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('should correctly retrieve the entity type', () => {
          expect(ecs.getEntityType()).toBeUndefined();
          spyOn(urlService, 'getPathname').and.returnValue('/story_editor/123');
          expect(ecs.getEntityType()).toBe('story');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 2 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 365..371
    core/templates/services/context.service.spec.ts on lines 406..412

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

    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('should correctly retrieve the entity type', () => {
          expect(ecs.getEntityType()).toBeUndefined();
    
          spyOn(urlService, 'getPathname').and.returnValue('/blog-dashboard');
    
    
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 2 other locations - About 2 hrs to fix
    core/templates/services/context.service.spec.ts on lines 288..292
    core/templates/services/context.service.spec.ts on lines 406..412

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

    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

        beforeEach(() => {
          ecs = TestBed.get(ContextService);
          urlService = TestBed.get(UrlService);
          spyOn(urlService, 'getPathname').and.returnValue(
            '/learner-group/groupId'
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 1 hr to fix
    core/templates/services/context.service.spec.ts on lines 525..530

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

    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

        beforeEach(() => {
          ecs = TestBed.inject(ContextService);
          urlService = TestBed.get(UrlService);
          spyOn(urlService, 'getPathname').and.returnValue('/about');
          ecs.removeCustomEntityContext();
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 1 other location - About 1 hr to fix
    core/templates/services/context.service.spec.ts on lines 462..469

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

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

        it('should check if exploration is linked to a story', () => {
          expect(ecs.isExplorationLinkedToStory()).toBe(false);
          ecs.setExplorationIsLinkedToStory();
          expect(ecs.isExplorationLinkedToStory()).toBe(true);
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 3 other locations - About 1 hr to fix
    core/templates/pages/admin-page/services/admin-task-manager.service.spec.ts on lines 39..43
    core/templates/pages/learner-group-pages/edit-group/learner-group-syllabus.component.spec.ts on lines 271..275
    core/templates/services/context.service.spec.ts on lines 161..165

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

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

        it('should correctly retrieve the story context', () => {
          expect(ecs.isExplorationLinkedToStory()).toBe(false);
          ecs.setExplorationIsLinkedToStory();
          expect(ecs.isExplorationLinkedToStory()).toBe(true);
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 3 other locations - About 1 hr to fix
    core/templates/pages/admin-page/services/admin-task-manager.service.spec.ts on lines 39..43
    core/templates/pages/learner-group-pages/edit-group/learner-group-syllabus.component.spec.ts on lines 271..275
    core/templates/services/context.service.spec.ts on lines 100..104

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

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

        it('should correctly retrieve the learner group id', () => {
          spyOn(urlService, 'getPathname').and.returnValue(
            '/edit-learner-group/groupId'
          );
          expect(ecs.getLearnerGroupId()).toBe('groupId');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 11 other locations - About 1 hr to fix
    core/templates/components/summary-tile/topic-summary-tile.component.spec.ts on lines 85..91
    core/templates/pages/exploration-editor-page/editor-navigation/editor-navbar-breadcrumb.component.spec.ts on lines 109..112
    core/templates/pages/exploration-editor-page/editor-navigation/editor-navbar-breadcrumb.component.spec.ts on lines 114..117
    core/templates/pages/exploration-editor-page/editor-tab/graph-directives/exploration-graph.component.spec.ts on lines 103..108
    core/templates/pages/exploration-editor-page/translation-tab/state-translation/state-translation.component.spec.ts on lines 1967..1973
    core/templates/pages/exploration-player-page/learner-experience/learner-answer-info-card.component.spec.ts on lines 116..122
    core/templates/pages/learner-group-pages/create-group/create-learner-group-page.component.spec.ts on lines 231..239
    core/templates/pages/topic-editor-page/navbar/topic-editor-navbar.component.spec.ts on lines 295..301
    core/templates/services/context.service.spec.ts on lines 446..451
    extensions/interactions/ImageClickInput/directives/oppia-interactive-image-click-input.component.spec.ts on lines 578..582
    extensions/interactions/ImageClickInput/directives/oppia-interactive-image-click-input.component.spec.ts on lines 584..588

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

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

        it('should correctly retrieve the page context', () => {
          spyOn(urlService, 'getPathname').and.returnValue(
            '/edit-learner-group/groupId'
          );
          expect(ecs.getPageContext()).toBe('learner_group_editor');
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 11 other locations - About 1 hr to fix
    core/templates/components/summary-tile/topic-summary-tile.component.spec.ts on lines 85..91
    core/templates/pages/exploration-editor-page/editor-navigation/editor-navbar-breadcrumb.component.spec.ts on lines 109..112
    core/templates/pages/exploration-editor-page/editor-navigation/editor-navbar-breadcrumb.component.spec.ts on lines 114..117
    core/templates/pages/exploration-editor-page/editor-tab/graph-directives/exploration-graph.component.spec.ts on lines 103..108
    core/templates/pages/exploration-editor-page/translation-tab/state-translation/state-translation.component.spec.ts on lines 1967..1973
    core/templates/pages/exploration-player-page/learner-experience/learner-answer-info-card.component.spec.ts on lines 116..122
    core/templates/pages/learner-group-pages/create-group/create-learner-group-page.component.spec.ts on lines 231..239
    core/templates/pages/topic-editor-page/navbar/topic-editor-navbar.component.spec.ts on lines 295..301
    core/templates/services/context.service.spec.ts on lines 439..444
    extensions/interactions/ImageClickInput/directives/oppia-interactive-image-click-input.component.spec.ts on lines 578..582
    extensions/interactions/ImageClickInput/directives/oppia-interactive-image-click-input.component.spec.ts on lines 584..588

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

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

        beforeEach(() => {
          ecs = TestBed.get(ContextService);
          urlService = TestBed.get(UrlService);
          ecs.removeCustomEntityContext();
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 5 other locations - About 50 mins to fix
    core/templates/services/context.service.spec.ts on lines 181..185
    core/templates/services/context.service.spec.ts on lines 268..272
    core/templates/services/context.service.spec.ts on lines 308..312
    core/templates/services/context.service.spec.ts on lines 349..353
    core/templates/services/context.service.spec.ts on lines 477..481

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

        beforeEach(() => {
          ecs = TestBed.inject(ContextService);
          urlService = TestBed.get(UrlService);
          ecs.removeCustomEntityContext();
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 5 other locations - About 50 mins to fix
    core/templates/services/context.service.spec.ts on lines 181..185
    core/templates/services/context.service.spec.ts on lines 232..236
    core/templates/services/context.service.spec.ts on lines 268..272
    core/templates/services/context.service.spec.ts on lines 308..312
    core/templates/services/context.service.spec.ts on lines 477..481

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

        beforeEach(() => {
          ecs = TestBed.inject(ContextService);
          urlService = TestBed.get(UrlService);
          ecs.removeCustomEntityContext();
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 5 other locations - About 50 mins to fix
    core/templates/services/context.service.spec.ts on lines 181..185
    core/templates/services/context.service.spec.ts on lines 232..236
    core/templates/services/context.service.spec.ts on lines 308..312
    core/templates/services/context.service.spec.ts on lines 349..353
    core/templates/services/context.service.spec.ts on lines 477..481

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

        beforeEach(() => {
          ecs = TestBed.inject(ContextService);
          urlService = TestBed.get(UrlService);
          ecs.removeCustomEntityContext();
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 5 other locations - About 50 mins to fix
    core/templates/services/context.service.spec.ts on lines 232..236
    core/templates/services/context.service.spec.ts on lines 268..272
    core/templates/services/context.service.spec.ts on lines 308..312
    core/templates/services/context.service.spec.ts on lines 349..353
    core/templates/services/context.service.spec.ts on lines 477..481

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

        beforeEach(() => {
          ecs = TestBed.get(ContextService);
          urlService = TestBed.get(UrlService);
          ecs.removeCustomEntityContext();
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 5 other locations - About 50 mins to fix
    core/templates/services/context.service.spec.ts on lines 181..185
    core/templates/services/context.service.spec.ts on lines 232..236
    core/templates/services/context.service.spec.ts on lines 268..272
    core/templates/services/context.service.spec.ts on lines 308..312
    core/templates/services/context.service.spec.ts on lines 349..353

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

        beforeEach(() => {
          ecs = TestBed.inject(ContextService);
          urlService = TestBed.get(UrlService);
          ecs.removeCustomEntityContext();
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 5 other locations - About 50 mins to fix
    core/templates/services/context.service.spec.ts on lines 181..185
    core/templates/services/context.service.spec.ts on lines 232..236
    core/templates/services/context.service.spec.ts on lines 268..272
    core/templates/services/context.service.spec.ts on lines 349..353
    core/templates/services/context.service.spec.ts on lines 477..481

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

        it('should correctly set editor context to story editor', () => {
          ecs.init('story_editor');
          expect(ecs.getEditorContext()).toBe('story_editor');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 13 other locations - About 35 mins to fix
    core/templates/components/state-editor/state-editor-properties-services/state-editor.service.spec.ts on lines 193..196
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 33..41
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 43..49
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 51..55
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 57..63
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 65..71
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 82..86
    core/templates/pages/exploration-editor-page/translation-tab/services/translation-language.service.spec.ts on lines 45..48
    core/templates/pages/exploration-editor-page/translation-tab/services/translation-language.service.spec.ts on lines 73..78
    core/templates/services/context.service.spec.ts on lines 69..72
    core/templates/services/context.service.spec.ts on lines 118..121
    core/templates/services/context.service.spec.ts on lines 187..190
    core/templates/services/context.service.spec.ts on lines 314..317

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

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

        it('should correctly set editor context to exploration editor', () => {
          ecs.init('exploration_editor');
          expect(ecs.getEditorContext()).toBe('exploration_editor');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 13 other locations - About 35 mins to fix
    core/templates/components/state-editor/state-editor-properties-services/state-editor.service.spec.ts on lines 193..196
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 33..41
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 43..49
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 51..55
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 57..63
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 65..71
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 82..86
    core/templates/pages/exploration-editor-page/translation-tab/services/translation-language.service.spec.ts on lines 45..48
    core/templates/pages/exploration-editor-page/translation-tab/services/translation-language.service.spec.ts on lines 73..78
    core/templates/services/context.service.spec.ts on lines 69..72
    core/templates/services/context.service.spec.ts on lines 187..190
    core/templates/services/context.service.spec.ts on lines 274..277
    core/templates/services/context.service.spec.ts on lines 314..317

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

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

        it('should correctly set editor context to exploration editor', () => {
          ecs.init('exploration_editor');
          expect(ecs.getEditorContext()).toBe('exploration_editor');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 13 other locations - About 35 mins to fix
    core/templates/components/state-editor/state-editor-properties-services/state-editor.service.spec.ts on lines 193..196
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 33..41
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 43..49
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 51..55
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 57..63
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 65..71
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 82..86
    core/templates/pages/exploration-editor-page/translation-tab/services/translation-language.service.spec.ts on lines 45..48
    core/templates/pages/exploration-editor-page/translation-tab/services/translation-language.service.spec.ts on lines 73..78
    core/templates/services/context.service.spec.ts on lines 118..121
    core/templates/services/context.service.spec.ts on lines 187..190
    core/templates/services/context.service.spec.ts on lines 274..277
    core/templates/services/context.service.spec.ts on lines 314..317

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

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

        it('should correctly set editor context to topic editor', () => {
          ecs.init('topic_editor');
          expect(ecs.getEditorContext()).toBe('topic_editor');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 13 other locations - About 35 mins to fix
    core/templates/components/state-editor/state-editor-properties-services/state-editor.service.spec.ts on lines 193..196
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 33..41
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 43..49
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 51..55
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 57..63
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 65..71
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 82..86
    core/templates/pages/exploration-editor-page/translation-tab/services/translation-language.service.spec.ts on lines 45..48
    core/templates/pages/exploration-editor-page/translation-tab/services/translation-language.service.spec.ts on lines 73..78
    core/templates/services/context.service.spec.ts on lines 69..72
    core/templates/services/context.service.spec.ts on lines 118..121
    core/templates/services/context.service.spec.ts on lines 274..277
    core/templates/services/context.service.spec.ts on lines 314..317

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

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

        it('should correctly set editor context to skill editor', () => {
          ecs.init('skill_editor');
          expect(ecs.getEditorContext()).toBe('skill_editor');
        });
    Severity: Major
    Found in core/templates/services/context.service.spec.ts and 13 other locations - About 35 mins to fix
    core/templates/components/state-editor/state-editor-properties-services/state-editor.service.spec.ts on lines 193..196
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 33..41
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 43..49
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 51..55
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 57..63
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 65..71
    core/templates/pages/classroom-admin-page/new-classroom.model.spec.ts on lines 82..86
    core/templates/pages/exploration-editor-page/translation-tab/services/translation-language.service.spec.ts on lines 45..48
    core/templates/pages/exploration-editor-page/translation-tab/services/translation-language.service.spec.ts on lines 73..78
    core/templates/services/context.service.spec.ts on lines 69..72
    core/templates/services/context.service.spec.ts on lines 118..121
    core/templates/services/context.service.spec.ts on lines 187..190
    core/templates/services/context.service.spec.ts on lines 274..277

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

    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