Nekmo/amazon-dash

View on GitHub

Showing 9 of 44 total issues

File execute.py has 327 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import logging

import getpass

Severity: Minor
Found in amazon_dash/execute.py - About 3 hrs to fix

    File test_execute.py has 275 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import base64
    import json
    import unittest
    from threading import Thread
    
    
    Severity: Minor
    Found in amazon_dash/tests/test_execute.py - About 2 hrs to fix

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

      def retry(exceptions=(Exception,), tries=5):
          def wrap(fn):
              @wraps(fn)
              def f_retry(*args, **kwargs):
                  for i in range(1, tries + 1):
      Severity: Minor
      Found in amazon_dash/wifi.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 catch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def catch(fn, exception_cls=None, raises=True):
          exception_cls = exception_cls or AmazonDashException
      
          def wrap(*args, **kwargs):
              try:
      Severity: Minor
      Found in amazon_dash/exceptions.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 all has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def all():
          click.echo('Executing all install scripts for Amazon-Dash')
          catch(InstallConfig().install)() and install_success('config')
          has_service = False
          for service in SERVICES:
      Severity: Minor
      Found in amazon_dash/install/__init__.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate(self):
              """Check self.data. Raise InvalidConfig on error
      
              :return: None
              """
      Severity: Minor
      Found in amazon_dash/execute.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, file, ignore_perms=False, **kwargs):
              """Set the config file and validate file permissions
      
              :param str file: path to file
              :param kwargs: default values in dict
      Severity: Minor
      Found in amazon_dash/config.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def execute(self, root_allowed=False):
              """Execute using self.data
      
              :param bool root_allowed: Allow execute as root commands
              :return:
      Severity: Minor
      Found in amazon_dash/execute.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def execute(self, root_allowed=False):
              """Execute using self.data
      
              :param bool root_allowed: Only used for ExecuteCmd
              :return:
      Severity: Minor
      Found in amazon_dash/execute.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