Showing 3,604 of 10,782 total issues

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

    def post(self, exploration_id: str) -> None:
        """Handles POST requests.

        Args:
            exploration_id: str. The ID of the exploration.
Severity: Minor
Found in core/controllers/reader.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 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 setMode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  setMode(mode: number): void {
    this.state.currentMode = mode;
    if (this.isMobile) {
      if (this.state.currentMode === this._MODES.ADD_EDGE) {
        this.helpText = 'I18N_INTERACTIONS_GRAPH_EDGE_INITIAL_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 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 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 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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  init(): void {
    this.initButtons();
    this.state.currentMode = this.buttons[0].mode;
    if (this.isMobile) {
      if (this.state.currentMode === this._MODES.ADD_EDGE) {
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, exploration_id: str) -> None:
        """Handles GET requests."""
        assert self.normalized_request is not None
        collection_id = self.normalized_request.get('collection_id')
        include_system_recommendations = self.normalized_request[
Severity: Minor
Found in core/controllers/reader.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 test_story_publish_and_unpublish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def test_story_publish_and_unpublish(self) -> None:
        # Check that admins can publish a story.
        self.login(self.CURRICULUM_ADMIN_EMAIL)
        csrf_token = self.get_new_csrf_token()

Severity: Minor
Found in core/controllers/story_editor_test.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 _generate_dummy_skill_and_questions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _generate_dummy_skill_and_questions(self) -> None:
        """Generate and loads the database with a skill and 15 questions
        linked to the skill.

        Raises:
Severity: Minor
Found in core/controllers/admin.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 get_package_file_contents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_package_file_contents(
    package: str, filepath: str, *, binary_mode: bool = False
) -> Union[str, bytes]:
    """Open file and return its contents. This needs to be used for files that
    are loaded by the Python code directly, like constants.ts or
Severity: Minor
Found in core/constants.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 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 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 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 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 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 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 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

Severity
Category
Status
Source
Language