coursera-dl/coursera-dl

View on GitHub
coursera/extractors.py

Summary

Maintainability
D
2 days
Test Coverage

Function _parse_on_demand_syllabus has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

    def _parse_on_demand_syllabus(self, course_name, page, reverse=False,
                                  unrestricted_filenames=False,
                                  subtitle_language='en',
                                  video_resolution=None,
                                  download_quizzes=False,
Severity: Minor
Found in coursera/extractors.py - About 1 day 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 _parse_on_demand_syllabus has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _parse_on_demand_syllabus(self, course_name, page, reverse=False,
Severity: Major
Found in coursera/extractors.py - About 1 hr to fix

    Function get_modules has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def get_modules(self, class_name,
    Severity: Major
    Found in coursera/extractors.py - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                              if download_quizzes:
                                  links = course.extract_links_from_programming_immediate_instructions(
                                      lecture.id)
      
      
      Severity: Major
      Found in coursera/extractors.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if download_quizzes:
                                    links = course.extract_links_from_exam(
                                        lecture.id)
        
        
        Severity: Major
        Found in coursera/extractors.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if download_quizzes:
                                      links = course.extract_links_from_quiz(
                                          lecture.id)
          
          
          Severity: Major
          Found in coursera/extractors.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if download_notebooks and not self._notebook_downloaded:
                                        logging.warning(
                                            'According to notebooks platform, content will be downloaded first')
                                        links = course.extract_links_from_notebook(
                                            lecture.id)
            Severity: Major
            Found in coursera/extractors.py - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status