Showing 44 of 93 total issues
File test_commands.py
has 844 lines of code (exceeds 250 allowed). Consider refactoring. Open
import contextlib
import os
import os.path
import shutil
import sys
File base_test.py
has 566 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os.path
import warnings
from collections import OrderedDict
from contextlib import contextmanager
from copy import deepcopy
CommandTests
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
class CommandTests(unittest.TestCase):
application = None
basedir = None
pofile = None
mofile = None
Function _make_settings
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def _make_settings(args, application, settings, STATIC_ROOT, MEDIA_ROOT): # NOQA
"""
Setup the Django settings
:param args: docopt arguments
:param application: application module name
- 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
File utils.py
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
import contextlib
import os
import random
import shutil
import string
Function create_pages
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def create_pages(source, languages):
"""
Build pages according to the pages data provided by :py:meth:`get_pages_data`
and returns the list of the draft version of each
"""
- 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 core
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def core(args, application):
from django.conf import settings
# configure django
warnings.filterwarnings(
- 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
File main.py
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
import argparse
import contextlib
import os
import subprocess
Function setup
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def setup(app, helper_module, extra_args=None, use_cms=False):
"""
Setup the Django / django CMS environment and return the environment settings.
:param app: application
- 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_request
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_request(self, request, page, user, lang, use_middlewares, use_toolbar=False, secure=False):
from importlib import import_module
from django.contrib.auth.models import AnonymousUser
- 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 create_user
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_user(
username,
email,
password,
is_staff=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
Function _map_argv
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _map_argv(argv, application_module):
try:
# by default docopt uses sys.argv[1:]; ensure correct args passed
args = docopt(__doc__, argv=argv[1:], version=application_module.__version__)
if argv[2] == "help":
- 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 generate_authors
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def generate_authors():
"""
Updates the authors list
"""
print("Generating AUTHORS")
- 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 towncrier_check
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def towncrier_check(c): # NOQA
"""Check towncrier files."""
output = io.StringIO()
c.run("git branch -a --contains HEAD", out_stream=output)
skipped_branch_prefix = ["pull/", "release/", "develop", "master", "HEAD"]
- 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 _clean_modules_directories
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _clean_modules_directories(self):
"""
Cleanup all the leftover of migration and po files tests.
Executed in setup and teardown for simplicity.
"""
- 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 request
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def request(
Function _make_settings
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _make_settings(args, application, settings, STATIC_ROOT, MEDIA_ROOT): # NOQA
"""
Setup the Django settings
:param args: docopt arguments
:param application: application module name
Function post_request
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def post_request(
Function _test_run_worker
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _test_run_worker(test_labels, test_runner, failfast=False, runner_options=None, verbose=1):
warnings.filterwarnings(
"error",
r"DateTimeField received a naive datetime",
RuntimeWarning,
- 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 create_user
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_user(