maestro-server/discovery-api

View on GitHub

Showing 32 of 598 total issues

LinksysInterpreter has 73 functions (exceeds 20 allowed). Consider refactoring.
Open

    class LinksysInterpreter(cmd.Cmd):
        """Interpret commands to perform LinkSys programming actions."""
        def __init__(self):
            cmd.Cmd.__init__(self)
            self.session = LinksysSession()
Severity: Major
Found in share/doc/pycurl/examples/linksys.py - About 1 day to fix

    File linksys.py has 443 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #! /usr/bin/env python
    # -*- coding: utf-8 -*-
    # vi:ts=4:et
    #
    # linksys.py -- program settings on a Linkys router
    Severity: Minor
    Found in share/doc/pycurl/examples/linksys.py - About 6 hrs to fix

      LinksysSession has 37 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class LinksysSession:
          months = 'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec'
      
          WAN_CONNECT_AUTO = '1'
          WAN_CONNECT_STATIC = '2'
      Severity: Minor
      Found in share/doc/pycurl/examples/linksys.py - About 4 hrs to fix

        Function merge has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def merge(self, insert):
                if not isinstance(self.content, list) or len(self.content) <= 0:
                    return insert
        
                santinize = []
        Severity: Minor
        Found in app/services/merger.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 cpuAndMemoryByInstanceType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def cpuAndMemoryByInstanceType(obj, conn):
                instance = get(obj, 'datacenters.instance')
        
                if instance:
                    data = CacheMemory.get(instance)
        Severity: Minor
        Found in app/repository/providers/aws/hooks.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 InstanceTypeOpenStack has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def InstanceTypeOpenStack(source, batch, obj={}):
                instance = Ruler.switch(source, batch)
        
                if instance:
                    obj = CacheMemory.get(instance)
        Severity: Minor
        Found in app/repository/providers/openstack/rules.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 getZones has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def getZones(source, batch):
                zones = Ruler.switch(source, batch)
        
                if zones:
                    if isinstance(zones, str):
        Severity: Minor
        Found in app/repository/providers/aws/rules.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 cpuAndMemoryByInstanceType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def cpuAndMemoryByInstanceType(obj, conn):
                instance = get(obj, 'datacenters.instance')
        
                if instance:
                    data = CacheMemory.get(instance)
        Severity: Minor
        Found in app/repository/providers/azure/hooks.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 task_scan has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def task_scan(conn, conn_id, task, options, lasted=False, vars=[]):
            access = decodeConn(conn, conn_id, task)
        
            oVars = Normalize.optionsVarsNormalize(options['vars']),
            vars = sum(oVars, vars)
        Severity: Minor
        Found in app/tasks/scan.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 task_tracker has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def task_tracker(result, dc_id, region, task, accountant, options):
        Severity: Minor
        Found in app/tasks/tracker.py - About 45 mins to fix

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

          def task_insert(conn, conn_id, task, result, options, lasted=False):
          Severity: Minor
          Found in app/tasks/insert.py - About 45 mins to fix

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

            def task_scan(conn, conn_id, task, options, lasted=False, vars=[]):
            Severity: Minor
            Found in app/tasks/scan.py - About 45 mins to fix

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

              def task_translate(conn, conn_id, options, task, result, lasted=False):
              Severity: Minor
              Found in app/tasks/translate.py - About 45 mins to fix

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

                def iterTranslate(conn, conn_id, options, task, result, tlasted):
                Severity: Minor
                Found in app/tasks/scan.py - About 45 mins to fix

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

                  def entity_count(dc_id, owner, region, accountant, resources, options):
                  Severity: Minor
                  Found in app/tasks/helpers/last.py - About 45 mins to fix

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

                        def batch(self, items, Ruler, source={}):
                            for key, item in items:
                                res = getattr(Ruler, item.get('call'))(item.get('source'), source)
                    
                                if isinstance(res, dict):
                    Severity: Minor
                    Found in app/services/iterators/iRuler.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 make_query has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def make_query(dc_id, owner, region, accountant, resources, options):
                    Severity: Minor
                    Found in app/tasks/helpers/last.py - About 45 mins to fix

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

                      def get_data_list(result, key, owner_user, conn_id, entity):
                      Severity: Minor
                      Found in app/tasks/insert.py - About 35 mins to fix

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

                            def spawnScan(self, connector, region, task, commands, lasted):
                        Severity: Minor
                        Found in app/controller/crawlerApp.py - About 35 mins to fix

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

                              def merger_with(self, obj_value, src_value, key, obj, source):
                          Severity: Minor
                          Found in app/services/merge/merge_rules.py - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language