Showing 11 of 11 total issues

Proxy has 67 functions (exceeds 20 allowed). Consider refactoring.
Open

class Proxy(object):
    """Proxy to another object."""

    # Code stolen from werkzeug.local.Proxy.
    __slots__ = ('__local', '__args', '__kwargs', '__dict__')
Severity: Major
Found in sea/local.py - About 1 day to fix

    Function new has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def new(project, **extra):
        PACKAGE_DIR = os.path.dirname(__file__)
        TMPLPATH = os.path.join(PACKAGE_DIR, "template")
        IGNORED_FILES = {
            "git": ["gitignore"],
    Severity: Minor
    Found in sea/cmds.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 _handle_default_value_fields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def _handle_default_value_fields(pb, keys, result_dict):
        for field in pb.DESCRIPTOR.fields:
            if keys and field.name not in keys:
                continue
            # Singular message fields and oneof fields will not be affected.
    Severity: Minor
    Found in sea/format.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 _stop_handler has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def _stop_handler(self, signum, frame):
            grace = max(self.app.config.get("GRPC_GRACE", 0), 5)
    
            if self._stopped:
                self.app.logger.debug(
    Severity: Minor
    Found in sea/server/multiprocessing.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 _load_jobs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _load_jobs():
        path = os.getcwd()
        sys.path.append(path)
    
        # load builtin
    Severity: Minor
    Found in sea/cli.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 _handle_field_values has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _handle_field_values(pb, field_values,
                             use_enum_labels, including_default_value_fields):
        result_dict = {}
        extensions = {}
        for field, value in field_values:
    Severity: Minor
    Found in sea/format.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 job has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def job(
    Severity: Minor
    Found in sea/cli.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              with open(r, "w") as f:
                                  tmpl = env.get_template(relfn)
                                  f.write(tmpl.render(**ctx))
                          else:
      Severity: Major
      Found in sea/cmds.py - About 45 mins to fix

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

            def get_namespace(self, namespace, lowercase=True, trim_namespace=True):
                rv = {}
                for k, v in self.items():
                    if not k.startswith(namespace):
                        continue
        Severity: Minor
        Found in sea/config.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 load_config_from_env has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def load_config_from_env(self):
                """
                read environment variables and overwrite same name key's values.
                only bool/str/numbers.Number could be overwritten
                `True` will be converted to python's bool `True`.
        Severity: Minor
        Found in sea/config.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 _reserve_address_port has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def _reserve_address_port(host, port):
            """Find and reserve a port for all subprocesses to use."""
        
            from ipaddress import IPv6Address, ip_address
        
        
        Severity: Minor
        Found in sea/server/multiprocessing.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