mrDoctorWho/vk4xmpp

View on GitHub

Showing 227 of 283 total issues

File auth.py has 372 lines of code (exceeds 250 allowed). Consider refactoring.
Open

##   auth.py
##
##   Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
##
##   This program is free software; you can redistribute it and/or modify
Severity: Minor
Found in library/xmpp/auth.py - About 4 hrs to fix

    Function sendMessages has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        def sendMessages(self, init=False, messages=None, mid=0, uid=0, filter_="unread"):
            """
            Sends messages from vk to xmpp and call message01 handlers
            Args:
                init: needed to know if function called at init (add time or not)
    Severity: Minor
    Found in gateway.py - About 4 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

    Node has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Node(object):
        """
        Node class describes syntax of separate XML Node. It have a constructor that permits node creation
        from set of "namespace name", attributes and payload of text strings and other nodes.
        It does not natively support building node from text string and uses NodeBuilder class for that purpose.
    Severity: Minor
    Found in library/xmpp/simplexml.py - About 4 hrs to fix

      File commands.py has 356 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      ## Ad-Hoc Command manager
      
      ## Mike Albon (c) 5th January 2005
      
      ##   This program is free software; you can redistribute it and/or modify
      Severity: Minor
      Found in library/xmpp/commands.py - About 4 hrs to fix

        Function handleChatErrors has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

        def handleChatErrors(source, prs):
            """
            Handles error presences from groupchats
            Args:
                source: the source jid
        Severity: Minor
        Found in modules/mod_groupchat_prs.py - About 4 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

        File mod_iq_disco.py has 337 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # coding: utf-8
        # This file is a part of VK4XMPP transport
        # © simpleApps, 2014 — 2015.
        # Warning: This module contains not optimal and really ugly code.
        
        
        Severity: Minor
        Found in modules/mod_iq_disco.py - About 4 hrs to fix

          Function method has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              def method(self, method, args=None, force=False, notoken=False):
                  """
                  This is a duplicate function of self.engine.method
                  Needed to handle errors properly exactly in __main__
                  Args:
          Severity: Minor
          Found in gateway.py - About 4 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

          File client.py has 334 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          ##   client.py
          ##
          ##   Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
          ##
          ##   This program is free software; you can redistribute it and/or modify
          Severity: Minor
          Found in library/xmpp/client.py - About 4 hrs to fix

            Function colorizeJSON has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

            def colorizeJSON(data):
                if os.name != "nt":
                    text = ""
                    iter = list(repr(data)).__iter__()
                    for c in iter:
            Severity: Minor
            Found in library/printer.py - About 3 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 interpreter_msg02 has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

            def interpreter_msg02(msg):
                body = msg.getBody()
                destination = msg.getTo().getStripped()
                source = msg.getFrom().getStripped()
                if body:
            Severity: Minor
            Found in extensions/interpreter.py - About 3 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 process has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                def process(cls):
                    """
                    Processes poll sockets by select.select()
                    As soon as socket will be ready for reading,  user.processPollResult() is called
                    Read processPollResult.__doc__ to learn more about status codes
            Severity: Minor
            Found in library/longpoll.py - About 3 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 _DiscoHandler has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                def _DiscoHandler(self, conn, request, typ):
                    """
                    The internal method to process service discovery requests.
                    """
                    # This is the disco manager handler.
            Severity: Minor
            Found in library/xmpp/commands.py - About 3 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 show has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                def show(self, msg, flag=None, prefix=None, sufix=None, lf=0):
                    """
                    flag can be of folowing types:
                        None - this msg will always be shown if any debugging is on
                        flag - will be shown if flag is active
            Severity: Minor
            Found in library/xmpp/debug.py - About 3 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 _DiscoveryHandler has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                def _DiscoveryHandler(self, conn, request):
                    """
                    Servers DISCO iq request from the remote client.
                    Automatically determines the best handler to use and calls it
                    (to handle the request. Used internally.
            Severity: Minor
            Found in library/xmpp/browser.py - About 3 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 stats_handler has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

            def stats_handler(cl, iq):
                destination = iq.getTo()
                iqChildren = iq.getQueryChildren()
                result = iq.buildReply("result")
                if destination == TransportID:
            Severity: Minor
            Found in modules/mod_iq_stats.py - About 3 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

            Dispatcher has 28 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Dispatcher(PlugIn):
                """
                Ancestor of PlugIn class. Handles XMPP stream, i.e. aware of stream headers.
                Can be plugged out/in to restart these headers (used for SASL f.e.).
                """
            Severity: Minor
            Found in library/xmpp/dispatcher.py - About 3 hrs to fix

              Roster has 28 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Roster(PlugIn):
                  """
                  Defines a plenty of methods that will allow you to manage roster.
                  Also automatically track presences from remote JIDs taking into
                  account that every JID can have multiple resources connected. Does not
              Severity: Minor
              Found in library/xmpp/roster.py - About 3 hrs to fix

                File longpoll.py has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # coding: utf-8
                # © simpleApps, 2014 — 2016.
                
                __authors__ = ("Al Korgun <alkorgun@gmail.com>", "John Smith <mrdoctorwho@gmail.com>")
                __version__ = "2.3"
                Severity: Minor
                Found in library/longpoll.py - About 3 hrs to fix

                  Function disco_handler has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def disco_handler(cl, iq):
                      source = iq.getFrom().getStripped()
                      destination = iq.getTo().getStripped()
                      ns = iq.getQueryNS()
                      node = iq.getTagAttr("query", "node")
                  Severity: Minor
                  Found in modules/mod_iq_disco.py - About 3 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 __init__ has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(self, typ=None, data=[], title=None, node=None):
                          """
                          Create new dataform of type "typ"; "data" is the list of DataReported,
                          DataItem and DataField instances that this dataform contains; "title"
                          is the title string.
                  Severity: Minor
                  Found in library/xmpp/protocol.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

                  Severity
                  Category
                  Status
                  Source
                  Language