shiwaforce/poco

View on GitHub

Showing 31 of 49 total issues

Function __init__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, target_dir, url, branch, git_ssh_identity_file=None, force=False, silent=False):
        super(GitRepository, self).__init__(target_dir)
        self.branch = branch

        try:
Severity: Minor
Found in poco/services/git_repository.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 get_compose_project has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def get_compose_project(self):
        """Load compose file from repository"""
        if self.compose_project is not None:
            return
        with open(self.compose_file) as stream:
Severity: Minor
Found in poco/services/compose_handler.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 command_interpreter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def command_interpreter(self, command, argv):
        if command == 'help':
            argv.append('-h')
            if len(argv) == 1:
                docopt(self.get_full_doc() + "\n" + CTAUtils.get_cta(), argv=argv)
Severity: Minor
Found in poco/poco.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 parse_environment_dict has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_environment_dict(self, path, env):
        """Compose dictionary from environment variables."""
        file_name = FileUtils.get_compose_file_relative_path(repo_dir=self.repo_dir,
                                                             working_directory=self.working_directory,
                                                             file_name=path)
Severity: Minor
Found in poco/services/command_handler.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 calculate_name_and_work_dir has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def calculate_name_and_work_dir():
        arg = StateHolder.args.get('<project/plan>')
        if arg is None:  # if empty
            StateHolder.work_dir = os.getcwd()
            StateHolder.name = FileUtils.get_directory_name()
Severity: Minor
Found in poco/services/state_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 check_and_print_project has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def check_and_print_project(lst):
        for cat in lst.keys():
            for key in lst[cat].keys():
                msg = key
                if os.path.exists(os.path.join(
Severity: Minor
Found in poco/services/catalog_handler.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 run_checkouts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def run_checkouts():
        for checkout in StateHolder.compose_handler.get_checkouts():
            args = checkout.split(" ")
            if not 2 <= len(args) <= 3:
                ColorPrint.exit_after_print_messages(message="Wrong checkout command: " + checkout
Severity: Minor
Found in poco/services/compose_handler.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 __init__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self):

        self.hierarchy = self.load_hierarchy()
        StateHolder.compose_handler.get_compose_project()
        self.project_compose = StateHolder.compose_handler.compose_project
Severity: Minor
Found in poco/services/command_handler.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self, cmd):
        self.check_command(cmd)
        plan = self.project_compose['plan'][self.plan]
        command_list = self.hierarchy[cmd]

Severity: Minor
Found in poco/services/command_handler.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__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, target_dir, url, branch, git_ssh_identity_file=None, force=False, silent=False):
Severity: Minor
Found in poco/services/git_repository.py - About 45 mins to fix

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

        def get_environment_dict(self, envs):
            """Process environment files. Environment for selected plan will be override the defaults"""
            environment = dict()
            '''First the default, if exists'''
            if "environment" in self.project_compose:
    Severity: Minor
    Found in poco/services/command_handler.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 read_configs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_configs(config_file, check_wd=False):
            if os.path.isdir(config_file):
                os.path.join(config_file, '.poco')
            if not os.path.exists(config_file):
                ColorPrint.print_info("Config file not exists: " + config_file, 1)
    Severity: Minor
    Found in poco/services/config_handler.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 check_version has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_version(current_version, is_beta_tester, is_force_check):
            if (EnvironmentUtils.need_check() or is_force_check):
                # check pip
                p = Popen("pip install poco==", stdout=PIPE, stderr=PIPE, shell=True)
                out, err = p.communicate()
    Severity: Minor
    Found in poco/services/environment_utils.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 collect_commands has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def collect_commands(self):
            try:
                command_packages = importlib.import_module('poco.commands', package='poco')
                for importer, modname, ispkg in pkgutil.iter_modules(command_packages.__path__):
                    if not ispkg:
    Severity: Minor
    Found in poco/poco.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 get_args has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_args(self, command, classes, argv):
            for cls in classes:
                cmd = getattr(cls, 'command')
                if not isinstance(cmd, list):
                    cmd = [cmd]
    Severity: Minor
    Found in poco/poco.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__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, name, user=None, passw=None, url=None, ssh=None):
    Severity: Minor
    Found in poco/services/bitbucket_repository.py - About 35 mins to fix

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

          def __init__(self, name, token=None, user=None, passw=None, url=None):
      Severity: Minor
      Found in poco/services/github_repository.py - About 35 mins to fix

        Function __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, name, token=None, user=None, passw=None, url=None):
                super(GitHubRepository, self).__init__(os.path.join(StateHolder.home_dir, 'gitHub', name))
        
                if sys.version_info[0] < 3:
                    ColorPrint.exit_after_print_messages("Sorry, GitHub repository not supported with Python version below 3")
        Severity: Minor
        Found in poco/services/github_repository.py - About 35 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 get_normalized_dir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_normalized_dir(self):
                target_dir = StateHolder.args.get('<target-dir>')
                if target_dir is not None:
                    if not os.path.exists(target_dir):
                        if os.path.exists(os.path.join(os.getcwd(), target_dir)):
        Severity: Minor
        Found in poco/commands/project_add.py - About 35 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 checkout has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def checkout(dry_run=False):
        
                for catalog in StateHolder.catalogs:
                    lst = StateHolder.catalogs[catalog]
                    if StateHolder.name in lst:
        Severity: Minor
        Found in poco/commands/checkout.py - About 35 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

        Severity
        Category
        Status
        Source
        Language