calblueprint/bizworld

View on GitHub

Showing 24 of 102 total issues

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

    _renderQuestionTypeSelecter() {
        let questionTypeSelecter;
        if (this.state.editable) {
            let questionOptions = [];
            for (let category in QuestionType.categoryToName) {
Severity: Minor
Found in app/assets/javascripts/templates/default_question.jsx - 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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        let classrooms;
        let createCourse;

        if (this.state.isLoading) {
Severity: Minor
Found in app/assets/javascripts/components/teachers/teachers.jsx - 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

Method reset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def reset
      password_errors = accumulate_password_errors
      unless password_errors.blank?
        render_json_message(:forbidden, errors: password_errors)
        return
Severity: Minor
Found in app/controllers/api/passwords_controller.rb - 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

Method format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def format
    if question.answer
      answer_text = question.options[question.answer]
      (question.answer == answer.to_i) ? "Correct : #{answer_text}" : "Incorrect : #{answer_text}"
    else
Severity: Minor
Found in app/models/response.rb - 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