Pr0Ger/PyAPNs2

View on GitHub

Showing 13 of 13 total issues

Function send_notification_async has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def send_notification_async(self, token_hex: str, notification: Payload, topic: Optional[str] = None,
                                priority: NotificationPriority = NotificationPriority.Immediate,
                                expiration: Optional[int] = None, collapse_id: Optional[str] = None,
                                push_type: Optional[NotificationType] = None) -> int:
        json_str = json.dumps(notification.dict(), cls=self.__json_encoder, ensure_ascii=False, separators=(',', ':'))
Severity: Minor
Found in apns2/client.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 __init__ has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in apns2/payload.py - About 1 hr to fix

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

        def dict(self) -> Dict[str, Any]:
            result = {}  # type: Dict[str, Any]
    
            if self.title:
                result['title'] = self.title
    Severity: Minor
    Found in apns2/payload.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 dict has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def dict(self) -> Dict[str, Any]:
            result = {
                'aps': {}
            }  # type: Dict[str, Any]
    
    
    Severity: Minor
    Found in apns2/payload.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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self,
    Severity: Major
    Found in apns2/client.py - About 1 hr to fix

      Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in apns2/payload.py - About 1 hr to fix

        Function send_notification_batch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def send_notification_batch(self, notifications: Iterable[Notification], topic: Optional[str] = None,
                                        priority: NotificationPriority = NotificationPriority.Immediate,
                                        expiration: Optional[int] = None, collapse_id: Optional[str] = None,
                                        push_type: Optional[NotificationType] = None) -> Dict[str, Union[str, Tuple[str, str]]]:
                """
        Severity: Minor
        Found in apns2/client.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 send_notification_async has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def send_notification_async(self, token_hex: str, notification: Payload, topic: Optional[str] = None,
        Severity: Major
        Found in apns2/client.py - About 50 mins to fix

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

              def send_notification_batch(self, notifications: Iterable[Notification], topic: Optional[str] = None,
          Severity: Minor
          Found in apns2/client.py - About 45 mins to fix

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

                def send_notification(self, token_hex: str, notification: Payload, topic: Optional[str] = None,
            Severity: Minor
            Found in apns2/client.py - About 45 mins to fix

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

                  def __init__(self, auth_key_path: str, auth_key_id: str, team_id: str,
              Severity: Minor
              Found in apns2/credentials.py - About 35 mins to fix

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

                    def create_connection(self, server: str, port: int, proto: Optional[str], proxy_host: Optional[str] = None,
                Severity: Minor
                Found in apns2/credentials.py - About 35 mins to fix

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

                      def _init_connection(self, use_sandbox: bool, use_alternative_port: bool, proto: Optional[str],
                  Severity: Minor
                  Found in apns2/client.py - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language