Showing 10,737 of 10,737 total issues

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

  getEdgeColor(index: number): string {
    if (!this.interactionIsActive) {
      return this.DEFAULT_COLOR;
    }
    if (
Severity: Minor
Found in extensions/interactions/GraphInput/directives/graph-viz.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 getCustomizationArgsWarnings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  getCustomizationArgsWarnings(
    customizationArgs: RatioExpressionInputCustomizationArgs
  ): Warning[] {
    var isNonNegativeInt = function (number: number) {
      return number % 1 === 0 && number >= 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 onTouchInitialVertex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  onTouchInitialVertex(index: number): void {
    if (this.state.currentMode === this._MODES.ADD_EDGE) {
      if (this.canAddEdge) {
        this.beginAddEdge(index);
        this.helpText = 'I18N_INTERACTIONS_GRAPH_EDGE_FINAL_HELPTEXT';
Severity: Minor
Found in extensions/interactions/GraphInput/directives/graph-viz.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self) -> None:
        """Handles GET requests."""
        assert self.normalized_request is not None
        exp_ids = self.normalized_request['stringified_exp_ids']
        include_private_exps = self.normalized_request.get(
Severity: Minor
Found in core/controllers/library.py - 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 areAdjacencyMatricesEqualWithPermutation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  areAdjacencyMatricesEqualWithPermutation(
    adj1: AdjacencyMatrix,
    adj2: AdjacencyMatrix,
    permutation: number[]
  ): boolean {
Severity: Minor
Found in extensions/interactions/GraphInput/directives/graph-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 validateNumericString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  validateNumericString(
    value: string,
    decimalSeparator: string
  ): string | undefined {
    value = value.toString().trim();

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

  getCustomizationArgsWarnings(
    customizationArgs: EndExplorationCustomizationArgs
  ): Warning[] {
    var warningsList = [];
    this.baseInteractionValidationServiceInstance.requireCustomizationArguments(

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

  private isAcyclic(graph: GraphAnswer): boolean {
    // Uses depth first search to ensure that we never have an edge to an
    // ancestor in the search tree.
    var nodeStatus = graph.vertices.map(() => {
      return this.gus.DFS_STATUS.UNVISITED;

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

  onToggleCheckbox(): void {
    this.newQuestion = false;
    this.selectionCount = Object.keys(this.userSelections).filter(
      obj => this.userSelections[obj]
    ).length;

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

  private initMarkers(editor) {
    var doc = editor.getDoc();

    // The -1 here is because prepended code ends with a newline.
    var preCodeNumLines = this.preCode.split('\n').length - 1;

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

  private hasDuplicates(answer: SetInputAnswer): boolean {
    for (var i = 0; i < answer.length; i++) {
      for (var j = 0; j < i; j++) {
        if (eq(answer[i], answer[j])) {
          return 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 submitAnswer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  submitAnswer(): void {
    try {
      if (
        this.answer.trim() === '' &&
        this.currentInteractionService.showNoResponseError()

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

  predict(classifierBuffer: ArrayBuffer, textInput: InteractionAnswer): number {
    // The model_json attribute in TextClassifierFrozenModel class can't be
    // changed to camelcase since the class definition is automatically compiled
    // with the help of protoc.
    const classifierData = JSON.parse(
Severity: Minor
Found in extensions/interactions/TextInput/text-input-prediction.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 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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

  getPreviewUrl(imageUrl: string): string {
    const entityType: string = this.contextService.getEntityType() as string;
    if (
      this.contextService.getImageSaveDestination() ===
        AppConstants.IMAGE_SAVE_DESTINATION_LOCAL_STORAGE &&
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 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 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

Severity
Category
Status
Source
Language