Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

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

  def not_late_submission_hash(assessments, not_late_count)
    assessments.each_with_object({}) do |assessment, counts|
      num_late_student = not_late_count[assessment.id] ? @all_students.length - not_late_count[assessment.id] : 0
      counts[assessment.id] = @reference_times_hash[assessment.id] ? num_late_student : 0
    end
Severity: Minor
Found in app/controllers/concerns/course/statistics/counts_concern.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    if @post.update(post_params)
      respond_to do |format|
        # Change post creator from system to updater if it is a codaveri feedback
        # and send notification
Severity: Minor
Found in app/controllers/course/discussion/posts_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_test_cases has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def format_test_cases
    @public_test_cases = []
    @private_test_cases = []
    @evaluation_test_cases = []

Severity: Minor
Found in app/controllers/course/assessment/question/programming_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 get_token_from_bearer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_token_from_bearer
    authorization_header_elements = request.headers['Authorization']&.split

    # render json: REQUIRES_AUTHENTICATION, status: :unauthorized and return unless authorization_header_elements
    return nil unless authorization_header_elements
Severity: Minor
Found in app/controllers/concerns/application_authentication_concern.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 zip_test_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def zip_test_files(test_type, zip) # rubocop:disable Metrics/AbcSize
    tests = @test_params[:test_cases]
    tests[test_type]&.each&.with_index(1) do |test, index|
      # String types should be displayed with quotes, other types will be converted to string
      # with the str method.

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

const AssessmentConditionForm = (
  props: AnyConditionProps<AssessmentConditionData> & {
    assessments: AvailableAssessments;
  },
): JSX.Element => {

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

  def generate_standard_submission_solution_files(zip, submission_files_to_keep, solution_files_to_keep)
    zip.mkdir('submission')
    @test_params[:submission_files].try(:each) do |file|
      next if file.nil?

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

const useDynamicNest = (): UseDynamicNestHook => {
  const matches = useMatches();
  const location = useLocation();

  const [state, setState] = useState<CrumbState>({});
Severity: Minor
Found in client/app/lib/hooks/router/dynamicNest/useDynamicNest.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

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

  def sync_with_koditsu
    is_course_koditsu_enabled = current_course.component_enabled?(Course::KoditsuPlatformComponent)
    is_koditsu_enabled = is_course_koditsu_enabled && @assessment.is_koditsu_enabled

    return head(:bad_request) unless is_koditsu_enabled
Severity: Minor
Found in app/controllers/course/assessment/assessments_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 switch_mcq_mrq_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def switch_mcq_mrq_type(is_mcq, unsubmit)
    grading_scheme = is_mcq ? :any_correct : :all_correct

    result = @multiple_response_question.update(grading_scheme: grading_scheme)
    if result

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

  def generate_nodes_from_conditionals(all_node_relations) # rubocop:disable Metrics/AbcSize
    node_ids_to_children = all_node_relations[:node_ids_to_children]
    node_ids_to_parents = all_node_relations[:node_ids_to_parents]
    node_ids_to_unlock_level = all_node_relations[:node_ids_to_unlock_level]
    students = current_course.course_users.students
Severity: Minor
Found in app/controllers/course/learning_map_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 monitoring_configuration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def monitoring_configuration
    if @assessment.monitor_id
      monitoring = @assessment.monitor
      monitoring_object = {
        heartbeatIntervalMs: monitoring.max_interval_ms,
Severity: Minor
Found in app/controllers/concerns/course/assessment/koditsu_assessment_concern.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 zip_test_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def zip_test_files(test_type, zip) # rubocop:disable Metrics/AbcSize
    tests = @test_params[:test_cases]
    tests[test_type]&.each&.with_index(1) do |test, index|
      # String types should be displayed with quotes, other types will be converted to string
      # with the str method.

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

  def view(data)
    session_id, limit = data['session_id'], data['limit'] || DEFAULT_VIEW_HEARTBEATS_LIMIT
    return unless (session = @monitor.sessions.find(session_id))

    recent_heartbeats = (limit == -1 ? session.heartbeats : session.heartbeats.last(limit)).map do |heartbeat|
Severity: Minor
Found in app/channels/course/monitoring/live_monitoring_channel.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 fetch_all_submissions_from_koditsu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def fetch_all_submissions_from_koditsu(assessment, user)
    @assessment = assessment
    @user = user
    submission_service = Course::Assessment::Submission::KoditsuSubmissionService.new(@assessment)
    status, response = submission_service.run_fetch_all_submissions

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

  def extract_test_cases
    autograde_content = @package.test_files[Pathname.new('autograde.py')]
    test_cases_with_id = preload_question_test_cases
    assertion_types = assertion_types_regex

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

  def closing_reminder(assessment, token)
    email_enabled = assessment.course.email_enabled(:assessments, :closing_reminder, assessment.tab.category.id)
    return unless assessment.closing_reminder_token == token && assessment.published?
    return unless email_enabled.phantom || email_enabled.regular

Severity: Minor
Found in app/services/course/assessment/reminder_service.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

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

const MuiTableToolbar = (props: ToolbarProps): JSX.Element | null => {
  const { t } = useTranslation();

  if (props.alternative?.when())
    return <ToolbarContainer>{props.alternative.render()}</ToolbarContainer>;
Severity: Minor
Found in client/app/lib/components/table/MuiTableAdapter/MuiTableToolbar.tsx - 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 IconRadio has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const IconRadio = (props: IconRadioProps): JSX.Element => (
  <label
    className={`flex cursor-pointer py-2 ${
      props.description ? 'items-start' : 'items-center'
    }`}
Severity: Minor
Found in client/app/lib/components/core/buttons/IconRadio.tsx - 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 MuiTablePagination has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const MuiTablePagination = (props: PaginationProps): JSX.Element => {
  const { t } = useTranslation();

  const rowsPerPageOptions = useMemo(() => {
    const options: RowsPerPageOptions = props.pages?.slice() ?? [];
Severity: Minor
Found in client/app/lib/components/table/MuiTableAdapter/MuiTablePagination.tsx - 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