amancevice/dip

View on GitHub

Showing 20 of 20 total issues

File settings.py has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding=utf-8 -*-
"""
dip contexts.
"""
import contextlib
Severity: Minor
Found in dip/settings.py - About 3 hrs to fix

    File main.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    dip CLI tool main entrypoint
    """
    import json
    import subprocess
    Severity: Minor
    Found in dip/main.py - About 2 hrs to fix

      Function dip_config has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def dip_config(edit, keys):
          """ Show current dip configuration.
      
              \b
              dip config NAME             # Get NAME config dict
      Severity: Minor
      Found in dip/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 dip_install has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def dip_install(name, home, path, remote, dotenv, env, secret, sleep,
      Severity: Major
      Found in dip/main.py - About 1 hr to fix

        Function dip_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def dip_list():
            """ List installed CLIs. """
            with settings.load() as cfg:
                if any(cfg):
                    click.echo()
        Severity: Minor
        Found in dip/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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, skipgit=False):
                """ Validate git repo and compose project. """
                if not skipgit and self.repo:
                    # pylint: disable=no-member
                    try:
        Severity: Minor
        Found in dip/settings.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

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

                if diff and app.git.get('sleep'):
                    warnsleep(app)
                elif diff:
                    warnask(app)
        Severity: Minor
        Found in dip/main.py and 1 other location - About 50 mins to fix
        dip/main.py on lines 284..287

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

        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

                if diff and app.git.get('sleep'):
                    warnsleep(app)
                elif diff:
                    warnask(app)
        Severity: Minor
        Found in dip/main.py and 1 other location - About 50 mins to fix
        dip/main.py on lines 234..237

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

        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 8 locations. Consider refactoring.
        Open

        class NotInstalledError(DipError):
            """ CLI not installed. """
            def __init__(self, name):
                super(NotInstalledError, self).__init__(
                    "'{name}' command is not installed".format(name=name))
        Severity: Major
        Found in dip/errors.py and 7 other locations - About 50 mins to fix
        dip/errors.py on lines 10..14
        dip/errors.py on lines 24..28
        dip/errors.py on lines 31..35
        dip/errors.py on lines 38..42
        dip/errors.py on lines 45..49
        dip/errors.py on lines 52..56
        dip/errors.py on lines 59..63

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

        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 8 locations. Consider refactoring.
        Open

        class NoSuchPathError(DipError):
            """ Invalid git repository directory. """
            def __init__(self, path):
                super(NoSuchPathError, self).__init__(
                    "Path does not exist '{path}'".format(path=path))
        Severity: Major
        Found in dip/errors.py and 7 other locations - About 50 mins to fix
        dip/errors.py on lines 10..14
        dip/errors.py on lines 17..21
        dip/errors.py on lines 24..28
        dip/errors.py on lines 38..42
        dip/errors.py on lines 45..49
        dip/errors.py on lines 52..56
        dip/errors.py on lines 59..63

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

        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 8 locations. Consider refactoring.
        Open

        class GitFetchError(DipError):
            """ Error fetching remote. """
            def __init__(self, remote):
                super(GitFetchError, self).__init__(
                    "Error fetching remote '{remote}'".format(remote=remote))
        Severity: Major
        Found in dip/errors.py and 7 other locations - About 50 mins to fix
        dip/errors.py on lines 10..14
        dip/errors.py on lines 17..21
        dip/errors.py on lines 24..28
        dip/errors.py on lines 31..35
        dip/errors.py on lines 45..49
        dip/errors.py on lines 52..56
        dip/errors.py on lines 59..63

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

        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 8 locations. Consider refactoring.
        Open

        class InvalidGitRepositoryError(DipError):
            """ Invalid git repository directory. """
            def __init__(self, path):
                super(InvalidGitRepositoryError, self).__init__(
                    "No git repository found in '{path}'".format(path=path))
        Severity: Major
        Found in dip/errors.py and 7 other locations - About 50 mins to fix
        dip/errors.py on lines 10..14
        dip/errors.py on lines 17..21
        dip/errors.py on lines 24..28
        dip/errors.py on lines 31..35
        dip/errors.py on lines 38..42
        dip/errors.py on lines 52..56
        dip/errors.py on lines 59..63

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

        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 8 locations. Consider refactoring.
        Open

        class SettingsError(DipError):
            """ Error accessing dip config. """
            def __init__(self, path):
                super(SettingsError, self).__init__(
                    "Unable to access dip settings at '{path}'".format(path=path))
        Severity: Major
        Found in dip/errors.py and 7 other locations - About 50 mins to fix
        dip/errors.py on lines 17..21
        dip/errors.py on lines 24..28
        dip/errors.py on lines 31..35
        dip/errors.py on lines 38..42
        dip/errors.py on lines 45..49
        dip/errors.py on lines 52..56
        dip/errors.py on lines 59..63

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

        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 8 locations. Consider refactoring.
        Open

        class NoSuchService(DipError):
            """ No such docker-compose service defined. """
            def __init__(self, name):
                super(NoSuchService, self).__init__(
                    "No service named '{name}' found in compose file"
        Severity: Major
        Found in dip/errors.py and 7 other locations - About 50 mins to fix
        dip/errors.py on lines 10..14
        dip/errors.py on lines 17..21
        dip/errors.py on lines 24..28
        dip/errors.py on lines 31..35
        dip/errors.py on lines 38..42
        dip/errors.py on lines 45..49
        dip/errors.py on lines 52..56

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

        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 8 locations. Consider refactoring.
        Open

        class NoSuchRemoteError(DipError):
            """ Invalid git repository directory. """
            def __init__(self, name):
                super(NoSuchRemoteError, self).__init__(
                    "Remote does not exist '{name}'".format(name=name))
        Severity: Major
        Found in dip/errors.py and 7 other locations - About 50 mins to fix
        dip/errors.py on lines 10..14
        dip/errors.py on lines 17..21
        dip/errors.py on lines 31..35
        dip/errors.py on lines 38..42
        dip/errors.py on lines 45..49
        dip/errors.py on lines 52..56
        dip/errors.py on lines 59..63

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

        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 8 locations. Consider refactoring.
        Open

        class ComposeFileNotFound(DipError):
            """ No docker-compose file found. """
            def __init__(self, path):
                super(ComposeFileNotFound, self).__init__(
                    "No compose file found in '{path}'".format(path=path))
        Severity: Major
        Found in dip/errors.py and 7 other locations - About 50 mins to fix
        dip/errors.py on lines 10..14
        dip/errors.py on lines 17..21
        dip/errors.py on lines 24..28
        dip/errors.py on lines 31..35
        dip/errors.py on lines 38..42
        dip/errors.py on lines 45..49
        dip/errors.py on lines 59..63

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

        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 install has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def install(self, name, home, path=None, env=None, git=None, dotenv=None):
        Severity: Minor
        Found in dip/settings.py - About 45 mins to fix

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

              def __init__(self, name, home, path=None, env=None, git=None, dotenv=None):
          Severity: Minor
          Found in dip/settings.py - About 45 mins to fix

            Function dip_home has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def dip_home(envvar='DIP_HOME'):
                """ Helper to get path to settings.json file. """
                try:
                    return os.environ[envvar]
                except KeyError:
            Severity: Minor
            Found in dip/utils.py - About 25 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 dip_run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def dip_run(name, quick, args):
                """ Run dip CLI. """
                if quick:
                    with settings.getapp(name) as app:
                        app.run(*args)
            Severity: Minor
            Found in dip/main.py - About 25 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