nephila/djangocms-helper

View on GitHub

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
Severity: Major
Found in tests/test_commands.py - About 2 days to fix

    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
    Severity: Major
    Found in app_helper/base_test.py - About 1 day to fix

      CommandTests has 40 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class CommandTests(unittest.TestCase):
          application = None
          basedir = None
          pofile = None
          mofile = None
      Severity: Minor
      Found in tests/test_commands.py - About 5 hrs to fix

        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
        Severity: Minor
        Found in app_helper/utils.py - About 5 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

        File utils.py has 361 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import contextlib
        import os
        import random
        import shutil
        import string
        Severity: Minor
        Found in app_helper/utils.py - About 4 hrs to fix

          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
                  """
          Severity: Minor
          Found in app_helper/base_test.py - About 3 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

          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(
          Severity: Minor
          Found in app_helper/main.py - About 3 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

          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
          Severity: Minor
          Found in app_helper/main.py - About 3 hrs to fix

            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
            Severity: Minor
            Found in app_helper/runner.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

            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
            
            
            Severity: Minor
            Found in app_helper/base_test.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 create_user has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            def create_user(
                username,
                email,
                password,
                is_staff=False,
            Severity: Minor
            Found in app_helper/utils.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 _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":
            Severity: Minor
            Found in app_helper/main.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 generate_authors has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def generate_authors():
                """
                Updates the authors list
                """
                print("Generating AUTHORS")
            Severity: Minor
            Found in app_helper/main.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 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"]
            Severity: Minor
            Found in tasks.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 _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.
                    """
            Severity: Minor
            Found in tests/test_commands.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 request has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def request(
            Severity: Major
            Found in app_helper/base_test.py - About 1 hr to fix

              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
              Severity: Minor
              Found in app_helper/utils.py - About 1 hr to fix

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

                    def post_request(
                Severity: Major
                Found in app_helper/base_test.py - About 1 hr to fix

                  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,
                  Severity: Minor
                  Found in app_helper/main.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 create_user has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def create_user(
                  Severity: Major
                  Found in app_helper/utils.py - About 50 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language