maestro-server/discovery-api

View on GitHub

Showing 32 of 598 total issues

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

def iterTranslate(conn, conn_id, options, task, result, tlasted):
    if isinstance(result, list):
        return task_translate.delay(conn, conn_id, options, task, result, tlasted)

    if isinstance(result, GeneratorType):
Severity: Minor
Found in app/tasks/scan.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 configure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def configure(self):
        "Write configuration changes to the Linksys."
        if self.actions:
            fields = []
            self.cache_flush()
Severity: Minor
Found in share/doc/pycurl/examples/linksys.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 crawlerFactory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def crawlerFactory(self, instance, task, require):
        connector = ExternalMaestroData()\
                        .list_request(path="connections/%s" % instance)\
                        .get_results()

Severity: Minor
Found in app/controller/crawlerApp.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

Avoid too many return statements within this function.
Open

        return json.JSONEncoder.default(self, obj)
Severity: Major
Found in app/libs/jsonEncoder.py - About 30 mins to fix

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

        def ipv4(obj, conn, len):
            Crawler = HookedAzure.createConn(conn)
            options = {
                "access": "network_interfaces",
                "command": "network",
    Severity: Minor
    Found in app/repository/providers/azure/hooks.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 switch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def switch(source, batch, default=None, capitalize=False):
            fields = source.split('|')
            for field in fields:
                result = get(batch, field)
                if result:
    Severity: Minor
    Found in app/services/rules/ruler.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 task_insert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def task_insert(conn, conn_id, task, result, options, lasted=False):
    
        key_comparer = get(options, 'key_comparer')
        owner_user = get(conn, 'owner_user._id')
    
    
    Severity: Minor
    Found in app/tasks/insert.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 fctPublicIp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def fctPublicIp(source, batch):
            ip = None
            dirts = Ruler.switch(source, batch, {})
    
            if dirts:
    Severity: Minor
    Found in app/repository/providers/openstack/rules.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 arrCatcher has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def arrCatcher(source, batch, cap=True):
            list = get(batch, source['field'], [])
            for item in list:
                if item[source['sKey']].lower() == source['s'].lower():
                    tmp = item[source['catcher']]
    Severity: Minor
    Found in app/services/rules/ruler.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 grouper_it has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def grouper_it(self, n, iterable):
            it = iter(iterable)
            counter = 0
    
            while True:
    Severity: Minor
    Found in app/repository/providers/azure/auth.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 get_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_files(path, type):
        files = []
        for r, d, f in os.walk(path):
            for file in f:
                if '%s.json' % type in file:
    Severity: Minor
    Found in app/libs/providersRules.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 task_translate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def task_translate(conn, conn_id, options, task, result, lasted=False):
    
        if not isinstance(result, list):
            task_notification.delay(msg="[Translate] Empty result", conn_id=conn_id, task=task, status='warning')
            return {'task': task}
    Severity: Minor
    Found in app/tasks/translate.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