yuru-yuri/manga-py

View on GitHub

Showing 36 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          Severity: Major
          Found in manga_py/cli/_args_image.py and 1 other location - About 2 hrs to fix
          manga_py/cli/_args_reader.py on lines 0..16

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 51.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          Severity: Major
          Found in manga_py/cli/_args_reader.py and 1 other location - About 2 hrs to fix
          manga_py/cli/_args_image.py on lines 0..16

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 51.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  try:
                      self.provider.http().download_file(chapter_url, '%s.%s' % path)
                  except Exception as e:
                      if self.provider._debug:
                          raise e
          Severity: Major
          Found in manga_py/download_methods.py and 1 other location - About 1 hr to fix
          manga_py/download_methods.py on lines 52..60

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  try:
                      self.files = self.provider.get_files()
                      self._loop_files()
                  except Exception as e:
                      # Main debug here
          Severity: Major
          Found in manga_py/download_methods.py and 1 other location - About 1 hr to fix
          manga_py/download_methods.py on lines 179..185

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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
                  Severity
                  Category
                  Status
                  Source
                  Language