core/templates/domain/topic/topic-update.service.ts

Summary

Maintainability
F
2 wks
Test Coverage

File topic-update.service.ts has 776 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2020 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: Major
Found in core/templates/domain/topic/topic-update.service.ts - About 1 day to fix

    Function deleteSubtopic has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

      deleteSubtopic(topic: Topic, subtopicId: number): void {
        let subtopic = topic.getSubtopicById(subtopicId);
        if (!subtopic) {
          throw new Error(`Subtopic with id ${subtopicId} doesn\'t exist`);
        }
    Severity: Minor
    Found in core/templates/domain/topic/topic-update.service.ts - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    TopicUpdateService has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @Injectable({
      providedIn: 'root',
    })
    export class TopicUpdateService {
      constructor(private undoRedoService: UndoRedoService) {}
    Severity: Minor
    Found in core/templates/domain/topic/topic-update.service.ts - About 4 hrs to fix

      Function deleteSubtopic has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        deleteSubtopic(topic: Topic, subtopicId: number): void {
          let subtopic = topic.getSubtopicById(subtopicId);
          if (!subtopic) {
            throw new Error(`Subtopic with id ${subtopicId} doesn\'t exist`);
          }
      Severity: Major
      Found in core/templates/domain/topic/topic-update.service.ts - About 3 hrs to fix

        Function moveSkillToSubtopic has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          moveSkillToSubtopic(
            topic: Topic,
            oldSubtopicId: number,
            newSubtopicId: number,
            skillSummary: ShortSkillSummary
        Severity: Minor
        Found in core/templates/domain/topic/topic-update.service.ts - About 1 hr to fix

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

            updateDiagnosticTestSkills(
              topic: Topic,
              newSkillSummariesForDiagnosticTest: ShortSkillSummary[]
            ): void {
              let oldSkillSummariesForDiagnosticTest = cloneDeep(
          Severity: Minor
          Found in core/templates/domain/topic/topic-update.service.ts - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                      if (changeDict.subtopic_id === subtopicId) {
                        indicesToDelete.push(i);
                      }
            Severity: Major
            Found in core/templates/domain/topic/topic-update.service.ts - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if (changeDict.old_subtopic_id === null) {
                            indicesToDelete.push(i);
                          } else {
                            // Change the move operation to the deleted subtopic to a
                            // remove operation, to move that skill into the uncategorized
              Severity: Major
              Found in core/templates/domain/topic/topic-update.service.ts - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          } else if (changeDict.old_subtopic_id === subtopicId) {
                            // Any operation where a skill was moved out of this subtopic
                            // would now be equivalent to a move out from the uncategorized
                            // section, as a newly created subtopic wouldn't have any skills
                            // of its own initially, and any skills moved into it have been
                Severity: Major
                Found in core/templates/domain/topic/topic-update.service.ts - About 45 mins to fix

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

                    setSubtopicUrlFragment(
                      topic: Topic,
                      subtopicId: number,
                      urlFragment: string
                    ): void {
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 2 other locations - About 6 hrs to fix
                  core/templates/domain/topic/topic-update.service.ts on lines 656..683
                  core/templates/domain/topic/topic-update.service.ts on lines 722..749

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

                  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

                    setSubtopicThumbnailBgColor(
                      topic: Topic,
                      subtopicId: number,
                      thumbnailBgColor: string
                    ): void {
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 2 other locations - About 6 hrs to fix
                  core/templates/domain/topic/topic-update.service.ts on lines 656..683
                  core/templates/domain/topic/topic-update.service.ts on lines 689..716

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

                  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

                    setSubtopicThumbnailFilename(
                      topic: Topic,
                      subtopicId: number,
                      thumbnailFilename: string
                    ): void {
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 2 other locations - About 6 hrs to fix
                  core/templates/domain/topic/topic-update.service.ts on lines 689..716
                  core/templates/domain/topic/topic-update.service.ts on lines 722..749

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

                  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

                    setTopicName(topic: Topic, name: string): void {
                      let oldName = cloneDeep(topic.getName());
                      this._applyTopicPropertyChange(
                        topic,
                        TopicDomainConstants.TOPIC_PROPERTY_NAME,
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 1 other location - About 4 hrs to fix
                  core/templates/domain/story/story-update.service.ts on lines 230..247

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

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

                    setTopicThumbnailFilename(topic: Topic, thumbnailFilename: string): void {
                      let oldThumbnailFilename = cloneDeep(topic.getThumbnailFilename());
                      this._applyTopicPropertyChange(
                        topic,
                        TopicDomainConstants.TOPIC_PROPERTY_THUMBNAIL_FILENAME,
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 14 other locations - About 4 hrs to fix
                  core/templates/domain/story/story-update.service.ts on lines 253..271
                  core/templates/domain/story/story-update.service.ts on lines 277..295
                  core/templates/domain/story/story-update.service.ts on lines 301..319
                  core/templates/domain/story/story-update.service.ts on lines 325..342
                  core/templates/domain/story/story-update.service.ts on lines 348..365
                  core/templates/domain/story/story-update.service.ts on lines 371..388
                  core/templates/domain/story/story-update.service.ts on lines 394..412
                  core/templates/domain/topic/topic-update.service.ts on lines 184..201
                  core/templates/domain/topic/topic-update.service.ts on lines 207..225
                  core/templates/domain/topic/topic-update.service.ts on lines 260..283
                  core/templates/domain/topic/topic-update.service.ts on lines 289..307
                  core/templates/domain/topic/topic-update.service.ts on lines 337..355
                  core/templates/domain/topic/topic-update.service.ts on lines 361..378
                  core/templates/domain/topic/topic-update.service.ts on lines 384..401

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

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

                    setTopicThumbnailBgColor(topic: Topic, thumbnailBgColor: string): void {
                      let oldThumbnailBgColor = cloneDeep(topic.getThumbnailBgColor());
                      this._applyTopicPropertyChange(
                        topic,
                        TopicDomainConstants.TOPIC_PROPERTY_THUMBNAIL_BG_COLOR,
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 14 other locations - About 4 hrs to fix
                  core/templates/domain/story/story-update.service.ts on lines 253..271
                  core/templates/domain/story/story-update.service.ts on lines 277..295
                  core/templates/domain/story/story-update.service.ts on lines 301..319
                  core/templates/domain/story/story-update.service.ts on lines 325..342
                  core/templates/domain/story/story-update.service.ts on lines 348..365
                  core/templates/domain/story/story-update.service.ts on lines 371..388
                  core/templates/domain/story/story-update.service.ts on lines 394..412
                  core/templates/domain/topic/topic-update.service.ts on lines 184..201
                  core/templates/domain/topic/topic-update.service.ts on lines 207..225
                  core/templates/domain/topic/topic-update.service.ts on lines 260..283
                  core/templates/domain/topic/topic-update.service.ts on lines 289..307
                  core/templates/domain/topic/topic-update.service.ts on lines 313..331
                  core/templates/domain/topic/topic-update.service.ts on lines 361..378
                  core/templates/domain/topic/topic-update.service.ts on lines 384..401

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

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

                    setTopicLanguageCode(topic: Topic, languageCode: string): void {
                      let oldLanguageCode = cloneDeep(topic.getLanguageCode());
                      this._applyTopicPropertyChange(
                        topic,
                        TopicDomainConstants.TOPIC_PROPERTY_LANGUAGE_CODE,
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 14 other locations - About 4 hrs to fix
                  core/templates/domain/story/story-update.service.ts on lines 253..271
                  core/templates/domain/story/story-update.service.ts on lines 277..295
                  core/templates/domain/story/story-update.service.ts on lines 301..319
                  core/templates/domain/story/story-update.service.ts on lines 325..342
                  core/templates/domain/story/story-update.service.ts on lines 348..365
                  core/templates/domain/story/story-update.service.ts on lines 371..388
                  core/templates/domain/story/story-update.service.ts on lines 394..412
                  core/templates/domain/topic/topic-update.service.ts on lines 184..201
                  core/templates/domain/topic/topic-update.service.ts on lines 207..225
                  core/templates/domain/topic/topic-update.service.ts on lines 260..283
                  core/templates/domain/topic/topic-update.service.ts on lines 289..307
                  core/templates/domain/topic/topic-update.service.ts on lines 313..331
                  core/templates/domain/topic/topic-update.service.ts on lines 337..355
                  core/templates/domain/topic/topic-update.service.ts on lines 361..378

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

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

                    setPageTitleFragmentForWeb(
                      topic: Topic,
                      pageTitleFragmentForWeb: string
                    ): void {
                      let oldPageTitleFragmentForWeb = cloneDeep(
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 14 other locations - About 4 hrs to fix
                  core/templates/domain/story/story-update.service.ts on lines 253..271
                  core/templates/domain/story/story-update.service.ts on lines 277..295
                  core/templates/domain/story/story-update.service.ts on lines 301..319
                  core/templates/domain/story/story-update.service.ts on lines 325..342
                  core/templates/domain/story/story-update.service.ts on lines 348..365
                  core/templates/domain/story/story-update.service.ts on lines 371..388
                  core/templates/domain/story/story-update.service.ts on lines 394..412
                  core/templates/domain/topic/topic-update.service.ts on lines 184..201
                  core/templates/domain/topic/topic-update.service.ts on lines 207..225
                  core/templates/domain/topic/topic-update.service.ts on lines 289..307
                  core/templates/domain/topic/topic-update.service.ts on lines 313..331
                  core/templates/domain/topic/topic-update.service.ts on lines 337..355
                  core/templates/domain/topic/topic-update.service.ts on lines 361..378
                  core/templates/domain/topic/topic-update.service.ts on lines 384..401

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

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

                    setTopicUrlFragment(topic: Topic, urlFragment: string): void {
                      let oldUrlFragment = cloneDeep(topic.getUrlFragment());
                      this._applyTopicPropertyChange(
                        topic,
                        TopicDomainConstants.TOPIC_PROPERTY_URL_FRAGMENT,
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 14 other locations - About 4 hrs to fix
                  core/templates/domain/story/story-update.service.ts on lines 253..271
                  core/templates/domain/story/story-update.service.ts on lines 277..295
                  core/templates/domain/story/story-update.service.ts on lines 301..319
                  core/templates/domain/story/story-update.service.ts on lines 325..342
                  core/templates/domain/story/story-update.service.ts on lines 348..365
                  core/templates/domain/story/story-update.service.ts on lines 371..388
                  core/templates/domain/story/story-update.service.ts on lines 394..412
                  core/templates/domain/topic/topic-update.service.ts on lines 184..201
                  core/templates/domain/topic/topic-update.service.ts on lines 207..225
                  core/templates/domain/topic/topic-update.service.ts on lines 260..283
                  core/templates/domain/topic/topic-update.service.ts on lines 313..331
                  core/templates/domain/topic/topic-update.service.ts on lines 337..355
                  core/templates/domain/topic/topic-update.service.ts on lines 361..378
                  core/templates/domain/topic/topic-update.service.ts on lines 384..401

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

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

                    setTopicDescription(topic: Topic, description: string): void {
                      let oldDescription = cloneDeep(topic.getDescription());
                      this._applyTopicPropertyChange(
                        topic,
                        TopicDomainConstants.TOPIC_PROPERTY_DESCRIPTION,
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 14 other locations - About 4 hrs to fix
                  core/templates/domain/story/story-update.service.ts on lines 253..271
                  core/templates/domain/story/story-update.service.ts on lines 277..295
                  core/templates/domain/story/story-update.service.ts on lines 301..319
                  core/templates/domain/story/story-update.service.ts on lines 325..342
                  core/templates/domain/story/story-update.service.ts on lines 348..365
                  core/templates/domain/story/story-update.service.ts on lines 371..388
                  core/templates/domain/story/story-update.service.ts on lines 394..412
                  core/templates/domain/topic/topic-update.service.ts on lines 184..201
                  core/templates/domain/topic/topic-update.service.ts on lines 207..225
                  core/templates/domain/topic/topic-update.service.ts on lines 260..283
                  core/templates/domain/topic/topic-update.service.ts on lines 289..307
                  core/templates/domain/topic/topic-update.service.ts on lines 313..331
                  core/templates/domain/topic/topic-update.service.ts on lines 337..355
                  core/templates/domain/topic/topic-update.service.ts on lines 384..401

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

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

                    setAbbreviatedTopicName(topic: Topic, abbreviatedName: string): void {
                      let oldAbbreviatedName = cloneDeep(topic.getAbbreviatedName());
                      this._applyTopicPropertyChange(
                        topic,
                        TopicDomainConstants.TOPIC_PROPERTY_ABBREVIATED_NAME,
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 14 other locations - About 4 hrs to fix
                  core/templates/domain/story/story-update.service.ts on lines 253..271
                  core/templates/domain/story/story-update.service.ts on lines 277..295
                  core/templates/domain/story/story-update.service.ts on lines 301..319
                  core/templates/domain/story/story-update.service.ts on lines 325..342
                  core/templates/domain/story/story-update.service.ts on lines 348..365
                  core/templates/domain/story/story-update.service.ts on lines 371..388
                  core/templates/domain/story/story-update.service.ts on lines 394..412
                  core/templates/domain/topic/topic-update.service.ts on lines 207..225
                  core/templates/domain/topic/topic-update.service.ts on lines 260..283
                  core/templates/domain/topic/topic-update.service.ts on lines 289..307
                  core/templates/domain/topic/topic-update.service.ts on lines 313..331
                  core/templates/domain/topic/topic-update.service.ts on lines 337..355
                  core/templates/domain/topic/topic-update.service.ts on lines 361..378
                  core/templates/domain/topic/topic-update.service.ts on lines 384..401

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

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

                    setMetaTagContent(topic: Topic, metaTagContent: string): void {
                      let oldMetaTagContent = cloneDeep(topic.getMetaTagContent());
                      this._applyTopicPropertyChange(
                        topic,
                        TopicDomainConstants.TOPIC_PROPERTY_META_TAG_CONTENT,
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 14 other locations - About 4 hrs to fix
                  core/templates/domain/story/story-update.service.ts on lines 253..271
                  core/templates/domain/story/story-update.service.ts on lines 277..295
                  core/templates/domain/story/story-update.service.ts on lines 301..319
                  core/templates/domain/story/story-update.service.ts on lines 325..342
                  core/templates/domain/story/story-update.service.ts on lines 348..365
                  core/templates/domain/story/story-update.service.ts on lines 371..388
                  core/templates/domain/story/story-update.service.ts on lines 394..412
                  core/templates/domain/topic/topic-update.service.ts on lines 184..201
                  core/templates/domain/topic/topic-update.service.ts on lines 260..283
                  core/templates/domain/topic/topic-update.service.ts on lines 289..307
                  core/templates/domain/topic/topic-update.service.ts on lines 313..331
                  core/templates/domain/topic/topic-update.service.ts on lines 337..355
                  core/templates/domain/topic/topic-update.service.ts on lines 361..378
                  core/templates/domain/topic/topic-update.service.ts on lines 384..401

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

                  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

                    setSubtopicPageContentsAudio(
                      subtopicPage: SubtopicPage,
                      subtopicId: number,
                      newRecordedVoiceovers: RecordedVoiceovers
                    ): void {
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 1 other location - About 4 hrs to fix
                  core/templates/domain/topic/topic-update.service.ts on lines 779..802

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

                  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

                    setSubtopicPageContentsHtml(
                      subtopicPage: SubtopicPage,
                      subtopicId: number,
                      newSubtitledHtml: SubtitledHtml
                    ): void {
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 1 other location - About 4 hrs to fix
                  core/templates/domain/topic/topic-update.service.ts on lines 804..831

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

                  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

                    rearrangeSubtopic(topic: Topic, fromIndex: number, toIndex: number): void {
                      this._applyChange(
                        topic,
                        TopicDomainConstants.CMD_REARRANGE_SUBTOPIC,
                        {
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 1 other location - About 3 hrs to fix
                  core/templates/domain/topic/topic-update.service.ts on lines 881..902

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

                  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

                    rearrangeCanonicalStory(
                      topic: Topic,
                      fromIndex: number,
                      toIndex: number
                    ): void {
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 1 other location - About 3 hrs to fix
                  core/templates/domain/topic/topic-update.service.ts on lines 937..954

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

                  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

                    removeAdditionalStory(topic: Topic, storyId: string): void {
                      this._applyChange(
                        topic,
                        TopicDomainConstants.CMD_DELETE_ADDITIONAL_STORY,
                        {
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 1 other location - About 2 hrs to fix
                  core/templates/domain/topic/topic-update.service.ts on lines 859..875

                  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

                    removeCanonicalStory(topic: Topic, storyId: string): void {
                      this._applyChange(
                        topic,
                        TopicDomainConstants.CMD_DELETE_CANONICAL_STORY,
                        {
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 1 other location - About 2 hrs to fix
                  core/templates/domain/topic/topic-update.service.ts on lines 837..853

                  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

                    private _applySubtopicPropertyChange(
                      topic: Topic,
                      propertyName: string,
                      subtopicId: number,
                      newValue: string,
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 2 other locations - About 50 mins to fix
                  core/templates/domain/story/story-update.service.ts on lines 196..217
                  core/templates/domain/topic/topic-update.service.ts on lines 123..144

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

                    private _applySubtopicPagePropertyChange(
                      subtopicPage: SubtopicPage,
                      propertyName: string,
                      subtopicId: number,
                      newValue,
                  Severity: Major
                  Found in core/templates/domain/topic/topic-update.service.ts and 2 other locations - About 50 mins to fix
                  core/templates/domain/story/story-update.service.ts on lines 196..217
                  core/templates/domain/topic/topic-update.service.ts on lines 100..121

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 52.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status