Showing 3,604 of 10,782 total issues

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

  generateIdForComponent(
    existingComponentIds: string[],
    componentName: string
  ): string {
    let contentIdList = JSON.parse(JSON.stringify(existingComponentIds));
Severity: Minor
Found in core/templates/services/generate-content-id.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 getIssueURL has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  getIssueURL(invalidTagsAndAttributes: {
    tags: string[];
    attrs: string[];
  }): string {
    const invalidTags = invalidTagsAndAttributes.tags;
Severity: Minor
Found in core/templates/services/svg-sanitizer.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 intercept has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  intercept(
    request: HttpRequest<FormData>,
    next: HttpHandler
  ): Observable<HttpEvent<FormData>> {
    var csrf = this.csrf;
Severity: Minor
Found in core/templates/services/request-interceptor.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 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 insertMultiplicationSigns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  insertMultiplicationSigns(expressionString: string): string {
    let greekLetters = Object.keys(AppConstants.GREEK_LETTER_NAMES_TO_SYMBOLS);
    let greekSymbols = Object.values(
      AppConstants.GREEK_LETTER_NAMES_TO_SYMBOLS
    );
Severity: Minor
Found in core/templates/services/math-interactions.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 getFilenameToBase64MappingAsync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async getFilenameToBase64MappingAsync(
    imagesData: ImagesData[]
  ): Promise<Record<string, string>> {
    let filesToBase64Mapping: {[key: string]: string} = {};
    if (imagesData.length > 0) {
Severity: Minor
Found in core/templates/services/image-local-storage.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 evaluate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  evaluate(parsed: Expr | Expr[], envs: EnvDict[]): Expr {
    // The intermediate nodes of the parse tree are arrays. The terminal nodes
    // are JavaScript primitives (as described in the "Parser output" section of
    // parser.pegjs).
    if (parsed instanceof Array) {
Severity: Minor
Found in core/templates/expressions/expression-evaluator.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 updateSearchFieldsBasedOnUrlQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  updateSearchFieldsBasedOnUrlQuery(urlComponent: string): UrlSearchQuery {
    let newSearchQuery: UrlSearchQuery = {
      searchQuery: '',
      selectedTags: [],
    };
Severity: Minor
Found in core/templates/services/blog-search.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 onStateRenamed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  onStateRenamed(oldStateName: string, newStateName: string): void {
    this.expStats = this.expStats.createNewWithStateRenamed(
      oldStateName,
      newStateName
    );

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

  getQueryFieldValuesAsList(fieldName: string): string[] {
    let fieldValues = [];
    if (this.getCurrentQueryString().indexOf('?') > -1) {
      // Each queryItem return one field-value pair in the url.
      let queryItems = this.getCurrentQueryString()
Severity: Minor
Found in core/templates/services/contextual/url.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 subtopicMasteryPosition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  subtopicMasteryPosition(i: number): number {
    if (this.clientWidth > 510) {
      if (this.subtopicMasteryArray[i] <= 89) {
        return 225 - this.subtopicMasteryArray[i] * 2.5;
      }

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

  convertImageDataToImageFile(dataURI: string | null): Blob | null {
    // Convert base64/URLEncoded data component to raw binary data
    // held in a string.
    if (dataURI !== null) {
      let byteString = atob(dataURI.split(',')[1]);
Severity: Minor
Found in core/templates/services/image-upload-helper.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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  save(): void {
    if (!this.newTitle) {
      this.alertsService.addWarning('Please specify a title');
      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 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 saveLearnerGroupInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  saveLearnerGroupInfo(): void {
    if (this.newLearnerGroupTitle || this.newLearnerGroupDescription) {
      this.learnerGroup.title = this.newLearnerGroupTitle
        ? this.newLearnerGroupTitle
        : this.learnerGroup.title;

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

  getSafeReturnUrl(urlString: string): string {
    try {
      // Make sure the URL can be decoded properly.
      urlString = decodeURIComponent(urlString);
    } catch (_) {
Severity: Minor
Found in core/templates/services/utils.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 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 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 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 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

Severity
Category
Status
Source
Language