Showing 10,782 of 10,782 total issues

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

  ngOnInit(): void {
    // Reset the component each time the value changes (e.g. if this is
    // part of an editable list).
    this.svgString = '';
    this.numberOfElementsInQueue = 0;
Severity: Minor
Found in extensions/objects/templates/math-expression-content-editor.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 keyDownCallBack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  keyDownCallBack(e: KeyboardEvent): void {
    if (this.isCustomizationArgOpen()) {
      let keyPressed = e.key;
      if (keyPressed === 'Shift') {
        this.lettersAreLowercase = false;
Severity: Minor
Found in extensions/objects/templates/allowed-variables-editor.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 regionLabelSetter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  regionLabelSetter(label: string): void {
    if (this.utilsService.isDefined(label)) {
      if (this.selectedRegion !== null) {
        this.value.labeledRegions[this.selectedRegion].label = label;
      }
Severity: Minor
Found in extensions/objects/templates/image-with-regions-editor.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 getCustomizationArgContents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  static getCustomizationArgContents(
    customizationArgs: InteractionCustomizationArgs
  ): (SubtitledUnicode | SubtitledHtml)[] {
    const contents: (SubtitledUnicode | SubtitledHtml)[] = [];

Severity: Minor
Found in core/templates/domain/exploration/InteractionObjectFactory.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 fromRawInputString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  static fromRawInputString(rawInput: string): Ratio {
    if (rawInput.length === 0) {
      throw new Error(
        ObjectsDomainConstants.RATIO_PARSING_ERROR_I18N_KEYS.EMPTY_STRING
      );
Severity: Minor
Found in core/templates/domain/objects/ratio.model.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  validate(): string[] {
    let issues = [];
    let validTitleRegex: RegExp = new RegExp(
      AppConstants.VALID_BLOG_POST_TITLE_REGEX
    );
Severity: Minor
Found in core/templates/domain/blog/blog-post.model.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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(
    public readonly explorationId: string,
    public readonly explorationVersion: number,
    public readonly improvementsTabIsEnabled: boolean,
    public readonly highBounceRateTaskStateBounceRateCreationThreshold: number,

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

  unitToList(unitsWithMultiplier: [string, number][]): Unit[] {
    var unitDict: UnitsDict = {};
    for (var i = 0; i < unitsWithMultiplier.length; i++) {
      var unit = unitsWithMultiplier[i][0];
      var multiplier = unitsWithMultiplier[i][1];
Severity: Minor
Found in core/templates/domain/objects/UnitsObjectFactory.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 refreshStatus has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public refreshStatus(topStateAnswersStats: readonly AnswerStats[]): void {
    const numUnaddressedTopStateAnswers = topStateAnswersStats.filter(
      a => !a.isAddressed
    ).length;
    if (numUnaddressedTopStateAnswers === 0) {
Severity: Minor
Found in core/templates/domain/improvements/needs-guiding-response-task.model.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 onKeypress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  onKeypress(evt: KeyboardEvent): void {
    if (evt.keyCode === 13) {
      if (
        this.floatForm.form.controls.floatValue.errors !== null &&
        Object.keys(this.floatForm.form.controls.floatValue.errors).length !== 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

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

  ngOnInit(): void {
    if (this.uiConfig && this.uiConfig.coding_mode) {
      // Flag that is flipped each time the codemirror view is
      // shown. (The codemirror instance needs to be refreshed
      // every time it is unhidden.)

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

  transform(input: number): number | string {
    // Nine zeros for billions (e.g. 146008788788 --> 146.0B).
    // Six zeros for millions (e.g. 146008788 --> 146.0M).
    // Three zeros for thousands (e.g. 146008 --> 146.0K).
    // No change for small numbers (e.g. 12 --> 12).
Severity: Minor
Found in core/templates/filters/summarize-nonnegative-number.pipe.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 parseInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  parseInput(): void {
    // If input is empty, the number value should be null.
    if (this.localStringValue === '') {
      this.localValue = null;
      // Clear errors if input is empty.

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(): void {
    this.stateEditorService.setStateNames([]);
    this.stateEditorService.setInQuestionMode(true);
    if (this.question) {
      this.stateEditorService.setInapplicableSkillMisconceptionIds(

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 {
    this.uploadedImageMimeType = file.type;
    this.invalidImageWarningIsShown = false;
    this.invalidFilenameWarningIsShown = false;
    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 transform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  transform(input: string, maxNumberOfCharacters: number): string {
    if (!input) {
      return input;
    }
    // The following regexp match will only return 'null' on an empty input

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

  _onChildFormSubmit(): void {
    if (!this.isAddItemButtonPresent) {
      /**
       * If form submission happens on last element of the set (i.e
       * the add item button is absent) then automatically add the

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

  updateSvgInViewIfSafe(): void {
    // If the SVG image is passed as base64 data.
    if (this.imgSrc.indexOf('data:image/svg+xml;base64') === 0) {
      const safeResourceUrl = this.svgSanitizerService.getTrustedSvgResourceUrl(
        this.imgSrc

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

Severity
Category
Status
Source
Language