yuru-yuri/manga-py

View on GitHub

Showing 32 of 44 total issues

ComicInfo has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

class ComicInfo:
    __slots__ = ('__data', '__pages', '_keys')

    def __init__(self):
        self.__data = {
Severity: Minor
Found in manga_py/base_classes/comic_info_builder.py - About 3 hrs to fix

    File provider.py has 285 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import json
    import os
    import re
    from abc import ABC
    from logging import info, warning
    Severity: Minor
    Found in manga_py/provider.py - About 2 hrs to fix

      Function loop_chapters has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def loop_chapters(self):
              _min, _max = self._min_max_calculate()
              count = 0  # count downloaded chapters
              for idx, __url in enumerate(self.chapters[:_min], start=1):
                  if self._params.get('create_empty_files', False):
      Severity: Minor
      Found in manga_py/provider.py - 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

      Base has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Base(ProviderParams):
          _storage = None
          _params = None
          _image_params = None
          _http_kwargs = None
      Severity: Minor
      Found in manga_py/base_classes/base.py - About 2 hrs to fix

        WebDriver has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class WebDriver(metaclass=ABCMeta):
            driver_version = None
            home_path = None
            _re = None
            _driver = None
        Severity: Minor
        Found in manga_py/base_classes/web_driver/web_driver.py - About 2 hrs to fix

          Function _format_action_invocation has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def _format_action_invocation(self, action):
                  if not action.option_strings:
                      default = self._get_default_metavar_for_positional(action)
                      metavar, = self._metavar_formatter(action, default)(1)
                      return metavar
          Severity: Minor
          Found in manga_py/cli/args.py - About 1 hr 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 _loop_files has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def _loop_files(self):
                  if isinstance(self.files, list):
                      info('Processing {} files'.format(len(self.files)))
          
                      if len(self.files) == 0:
          Severity: Minor
          Found in manga_py/download_methods.py - About 1 hr 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 __str__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def __str__(self):
                  schema = 'http://www.w3.org/2001/XMLSchema'
                  lines = [
                      '<?xml version="1.0"?>',
                      f'<ComicInfo xmlns:xsd="{schema}" xmlns:xsi="{schema}-instance">'
          Severity: Minor
          Found in manga_py/base_classes/comic_info_builder.py - About 1 hr 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 __save_params has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def __save_params(self, params):
                  # issue 400
                  if params.get('auto_skip_deleted', False):
                      with open(self.auto_params_file, 'r') as r:
                          try:
          Severity: Minor
          Found in manga_py/provider.py - About 1 hr 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 requests has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def requests(
          Severity: Major
          Found in manga_py/http/request.py - About 1 hr to fix

            Function __normal_name_dict has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def __normal_name_dict(self, idx: dict) -> str:
                    vol = idx.get('vol', None)
                    ch = idx.get('ch', None)
                    result = ''
                    if vol:
            Severity: Minor
            Found in manga_py/base_classes/arc_name.py - About 55 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 _download_one_file_helper has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _download_one_file_helper(self, url, dst, callback: callable = None, success_callback: callable = None,
                                              callback_args=()):
                    r = 0
                    while r < self.count_retries:
                        if self._safe_downloader(url, dst):
            Severity: Minor
            Found in manga_py/http/__init__.py - About 45 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 prepare_cf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def prepare_cf(self, url):
                    response = self.http().requests(url)
                    if response.status_code != 200:
                        if self._flare_solver_url is None:
                            self.log(f'Found status code {response.status_code}')
            Severity: Minor
            Found in manga_py/provider.py - About 45 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_provider has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def init_provider(
            Severity: Minor
            Found in manga_py/parser.py - About 45 mins to fix

              Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Minor
              Found in manga_py/http/__init__.py - About 45 mins to fix

                Function download_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def download_file(self, url: str,
                Severity: Minor
                Found in manga_py/http/__init__.py - About 45 mins to fix

                  Function prepare_download has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def prepare_download(self, params=None):
                          params = params or {}
                  
                          self._flare_solver_url = params.pop('flare_solver_url', None)
                  
                  
                  Severity: Minor
                  Found in manga_py/provider.py - About 45 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 post has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def post(self, url: str, headers: dict = None, cookies: dict = None, data: dict = (), files=None, **kwargs) -> Response:
                  Severity: Minor
                  Found in manga_py/http/request.py - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if not items_count \
                                    or self.args['no_progress'] \
                                    or self.args['global_progress'] \
                                    or self.args['quiet'] \
                                    or self.args['print_json'] \
                    Severity: Major
                    Found in manga_py/cli/__init__.py - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if not items_count \
                                      or self.args['no_progress'] \
                                      or not self.args['global_progress'] \
                                      or self.args['quiet'] \
                                      or self.args['print_json'] \
                      Severity: Major
                      Found in manga_py/cli/__init__.py - About 40 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language