richtier/alexa-voice-service-client

View on GitHub

Showing 5 of 5 total issues

Function main has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def main(client_id, secret, refresh_token):
    alexa_client = AlexaClient(
        client_id=client_id,
        secret=secret,
        refresh_token=refresh_token,
Severity: Minor
Found in alexa_client/demo/streaming_microphone.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 directives has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def directives(self):
        audio_attachments = self.audio_attachments
        for part in self.parts:
            if part.headers[b'Content-Type'].startswith(b'application/json'):
                name = Directive.parse_multipart(part)['header']['name']
Severity: Minor
Found in alexa_client/alexa_client/helpers.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Minor
Found in alexa_client/refreshtoken/http_server.py - About 45 mins to fix

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

        def send_audio_file(
    Severity: Minor
    Found in alexa_client/alexa_client/connection.py - About 45 mins to fix

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

      def serve_forever(address, port, client_id, client_secret, device_type_id):
      Severity: Minor
      Found in alexa_client/refreshtoken/serve.py - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language