Showing 3,589 of 10,737 total issues

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

  initialize(): void {
    this.i18nLanguageCodeService.onI18nLanguageCodeChange.subscribe(code => {
      const cookieSetDateMsecs = this.cookieService.get(
        this.COOKIE_NAME_COOKIES_ACKNOWLEDGED
      );
Severity: Minor
Found in core/templates/i18n/i18n.service.ts - About 25 mins 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

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

  onFileChanged(file: Blob): void {
    this.invalidImageWarningIsShown = false;
    let reader = new FileReader();
    reader.onload = e => {
      this.invalidTagsAndAttributes = {

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

  undoReviewAction(): void {
    clearTimeout(this.commitTimeout); // Clear the commit timeout.
    if (this.queuedSuggestion) {
      const indexToRemove = this.resolvedSuggestionIds.indexOf(
        this.queuedSuggestion.suggestion_id

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

  ngOnInit(): void {
    this.contributionSubTypeText =
      this.CONTRIBUTION_SUB_TYPE_TEXTS[this.contributionSubType];

    if (this.contributionCount > 1) {
Severity: Minor
Found in core/templates/pages/contributor-dashboard-page/badge/badge.component.ts - About 25 mins 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

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

  async fetchSuggestionsAsync(
    fetchType: string,
    limit: number | null,
    offset: number,
    sortKey: string,

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 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 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 _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 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 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 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 _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 _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 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 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 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

Severity
Category
Status
Source
Language