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 = {
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
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):
- Read upRead up
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
WebDriver
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class WebDriver(metaclass=ABCMeta):
driver_version = None
home_path = None
_re = None
_driver = None
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
- Read upRead up
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:
- Read upRead up
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">'
- Read upRead up
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:
- Read upRead up
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(
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:
- Read upRead up
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):
- Read upRead up
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}')
- Read upRead up
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(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function download_file
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def download_file(self, url: str,
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)
- Read upRead up
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:
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'] \
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'] \