Showing 3,604 of 10,782 total issues

Function rejectAndReviewNext has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  rejectAndReviewNext(reviewMessage: string): void {
    if (this.isUndoFeatureEnabled) {
      if (
        this.validatorsService.isValidReviewMessage(
          reviewMessage,

Cognitive Complexity

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

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

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

Further reading

Function saveAsync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async saveAsync(): Promise<void> {
    if (this.nodeTitles.indexOf(this.title) !== -1) {
      this.errorMsg = 'A chapter with this title already exists';
      return;
    }

Cognitive Complexity

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

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

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

Further reading

Function _initializeDirectiveComponents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private _initializeDirectiveComponents(initialCard, focusLabel): void {
    this._addNewCard(initialCard);
    this.nextCard = initialCard;
    if (!this.explorationPlayerStateService.isInDiagnosticTestPlayerMode()) {
      this.explorationPlayerStateService.onPlayerStateChange.emit(

Cognitive Complexity

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

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

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

Further reading

Function getCheckpointMessageI18nKey has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  getCheckpointMessageI18nKey(
    completedCheckpointCount: number,
    totalCheckpointCount: number
  ): string {
    const messageI18nKeyPrefix = 'I18N_CONGRATULATORY_CHECKPOINT_MESSAGE';

Cognitive Complexity

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

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

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

Further reading

Function onFileChanged has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  onFileChanged(file: File): void {
    let originalFilename = file.name;
    // The cropper always returns a jpeg file, thus the extension should be
    // changed to jpeg for the final image type to match the extension.
    this.croppedFilename = originalFilename

Cognitive Complexity

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

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

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

Further reading

Function setNextMilestoneAndCheckIfProgressBarIsShown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  setNextMilestoneAndCheckIfProgressBarIsShown(): boolean {
    if (
      !this.inStoryMode ||
      this.isCompletedChaptersCountGreaterThanLastMilestone() ||
      this.isMilestoneReachedAndMilestoneMessageToBeDisplayed()

Cognitive Complexity

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

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

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

Further reading

Function _updateGroupedSkillSummaries has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private _updateGroupedSkillSummaries(groupedSkillSummaries: {
    [topicName: string]: SkillSummaryBackendDict[];
  }): void {
    this._groupedSkillSummaries.current = [];
    this._groupedSkillSummaries.others = [];

Cognitive Complexity

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

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

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

Further reading

Function generateTopicIdToSuccessorTopicIds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  generateTopicIdToSuccessorTopicIds(): void {
    // The method generates a dict with topic ID as the key and all of its
    // successor topic IDs as value. The successor's list is generated using
    // the prerequisite dependency graph.
    // Example: A -> B -> C, here the topic ID to successor topic IDs dict will

Cognitive Complexity

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

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

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

Further reading

Function recordStateTransition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  recordStateTransition(
    oldStateName: string,
    newStateName: string,
    answer: string,
    oldParams: Object,

Cognitive Complexity

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

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

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

Further reading

Function generateTopicIdToAncestorTopicIds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  generateTopicIdToAncestorTopicIds(): void {
    // The method generates a dict with topic ID as the key and all of its
    // ancestor topic IDs as value. The ancestor's list is generated using the
    // prerequisite dependency graph.
    // Example: A -> B -> C, here the topic ID to ancestor topic IDs dict will

Cognitive Complexity

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

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

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

Further reading

Function _init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  _init(
    allAudioLanguageCodesInExploration: string[],
    preferredAudioLanguageCode: string | null,
    explorationLanguageCode: string,
    automaticTextToSpeechEnabled: boolean

Cognitive Complexity

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

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

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

Further reading

Function setFocusOnActiveTab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  setFocusOnActiveTab(activeTab: string): void {
    if (activeTab === 'history') {
      this.focusManagerService.setFocus('usernameInputField');
    }
    if (activeTab === 'feedback') {

Cognitive Complexity

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

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

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

Further reading

Function onClickExploreBackwardVersionHistory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  onClickExploreBackwardVersionHistory(): void {
    this.yamlStrs.previousVersionStateYaml = '';
    this.yamlStrs.currentVersionStateYaml = '';

    const diffData = this.versionHistoryService.getBackwardStateDiffData();

Cognitive Complexity

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

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

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

Further reading

Function onClickExploreForwardVersionHistory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  onClickExploreForwardVersionHistory(): void {
    this.yamlStrs.previousVersionStateYaml = '';
    this.yamlStrs.currentVersionStateYaml = '';

    const diffData = this.versionHistoryService.getForwardStateDiffData();

Cognitive Complexity

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

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

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

Further reading

Function save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  save(): void {
    if (!this.areRequiredFieldsFilled()) {
      return;
    }

Cognitive Complexity

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

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

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

Further reading

Function onClickExploreVersionHistoryButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  onClickExploreVersionHistoryButton(): void {
    const modalRef: NgbModalRef = this.ngbModal.open(
      StateVersionHistoryModalComponent,
      {
        backdrop: true,

Cognitive Complexity

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

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

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

Further reading

Function summarizeAnswerGroup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  summarizeAnswerGroup(
    answerGroup: AnswerGroup,
    interactionId: string,
    answerChoices: AnswerChoice[],
    shortenRule: boolean

Cognitive Complexity

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

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

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

Further reading

Function onDocumentClick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  @HostListener('document:click', ['$event'])
  onDocumentClick(event: MouseEvent): void {
    const targetElement = event.target as HTMLElement;
    if (this.checkMobileView()) {
      return;

Cognitive Complexity

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

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

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

Further reading

Function handleShowMore has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  handleShowMore(section: string): void {
    this.showMoreInSection[section] = !this.showMoreInSection[section];
    if (
      section === 'incomplete' &&
      this.showMoreInSection.incomplete === true

Cognitive Complexity

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

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

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

Further reading

Function changeCompareVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  changeCompareVersion(): void {
    this.diffData = null;

    let earlierComparedVersion = Math.min(
      this.selectedVersionsArray[0],

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

Severity
Category
Status
Source
Language