testmycode/tmc-server

View on GitHub
lib/rust_langs_cli_executor.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method refresh has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def self.refresh(course_template_refresh_task)
    course_template = course_template_refresh_task.course_template
    command = "#{self.langs_executable_path}/current refresh-course"\
    " --cache-path #{course_template.cache_path}"\
    " --cache-root #{Course.cache_root}"\
Severity: Minor
Found in lib/rust_langs_cli_executor.rb - About 2 hrs 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 refresh has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.refresh(course_template_refresh_task)
    course_template = course_template_refresh_task.course_template
    command = "#{self.langs_executable_path}/current refresh-course"\
    " --cache-path #{course_template.cache_path}"\
    " --cache-root #{Course.cache_root}"\
Severity: Minor
Found in lib/rust_langs_cli_executor.rb - About 1 hr to fix

    Method prepare_submission has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def self.prepare_submission(clone_path, output_path, submission_path, extra_params = {}, config = {})
    Severity: Minor
    Found in lib/rust_langs_cli_executor.rb - About 35 mins to fix

      Method prepare_submission has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.prepare_submission(clone_path, output_path, submission_path, extra_params = {}, config = {})
          command = "#{self.langs_executable_path}/current prepare-submission --clone-path #{clone_path} --output-path #{output_path} --submission-path #{submission_path}"
          command = command + " --top-level-dir-name #{config[:toplevel_dir_name]}" if !!config[:toplevel_dir_name]
          command = command + " --stub-zip-path #{config[:tests_from_stub]}" if !!config[:tests_from_stub]
          command = command + " --output-format #{config[:format]}" if !!config[:format]
      Severity: Minor
      Found in lib/rust_langs_cli_executor.rb - About 35 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 process_refresh_command_output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.process_refresh_command_output(command_output)
            data = command_output['data']
            if command_output['status'] == 'crashed'
              raise "TMC-langs-rust crashed: \n#{data}"
            elsif command_output['output-kind'] == 'status-update'
      Severity: Minor
      Found in lib/rust_langs_cli_executor.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

      There are no issues that match your filters.

      Category
      Status