maestro-server/scheduler-app

View on GitHub

Showing 9 of 232 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 spawn has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def spawn(self, queue, scheduler):
                for spawn in queue:
                    spawnId = spawn.get('_id')
        
                    if spawnId:
        Severity: Minor
        Found in app/services/spawn.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_reports has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def task_reports(name, _id, endpoint, method="GET", source='report', args={}, chain=[]):
        Severity: Major
        Found in app/tasks/reports.py - About 50 mins to fix

          Function task_webhook has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def task_webhook(name, _id, endpoint, source=None, method="GET", args={}, chain=[]):
          Severity: Major
          Found in app/tasks/webhook.py - About 50 mins to fix

            Function task_connections has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def task_connections(name, _id, endpoint, source='discovery', method="GET", args={}, chain=[]):
            Severity: Major
            Found in app/tasks/connections.py - About 50 mins to fix

              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 task_connections has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def task_connections(name, _id, endpoint, source='discovery', method="GET", args={}, chain=[]):
                  msg = "Task Connection - %s" % _id
              
                  try:
                      connType = re.search(r'/[a-zA-Z0-9]{24,24}/([a-z-]*)$', endpoint).group(1)
              Severity: Minor
              Found in app/tasks/connections.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