mrDoctorWho/vk4xmpp

View on GitHub

Showing 283 of 283 total issues

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    def setField(self, name, value=None, typ=None, desc=None, options=[]):
        """
        Create if nessessary or get the existing datafield object with name "name" and return it.
        """
        field = self.getField(name)
Severity: Major
Found in library/xmpp/protocol.py and 1 other location - About 3 hrs to fix
library/xmpp/protocol.py on lines 1391..1398

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    def setField(self, name, value=None, typ=None, desc=None, options=[]):
        """
        Create if nessessary or get the existing datafield object with name "name" and return it.
        """
        field = self.getField(name)
Severity: Major
Found in library/xmpp/protocol.py and 1 other location - About 3 hrs to fix
library/xmpp/protocol.py on lines 1244..1251

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if "version" in self.Dispatcher.Stream._document_attrs and self.Dispatcher.Stream._document_attrs["version"] == "1.0":
                    while not self.Dispatcher.Stream.features and self.Process(1):
        Severity: Major
        Found in library/xmpp/client.py and 1 other location - About 3 hrs to fix
        library/xmpp/client.py on lines 242..243

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 65.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if "version" in self.Dispatcher.Stream._document_attrs and self.Dispatcher.Stream._document_attrs["version"] == "1.0":
                    while not self.Dispatcher.Stream.features and self.Process(1):
        Severity: Major
        Found in library/xmpp/client.py and 1 other location - About 3 hrs to fix
        library/xmpp/client.py on lines 195..196

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 65.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                if self._owner.Dispatcher.Stream.features:
                    try:
                        self.FeaturesHandler(self._owner.Dispatcher, self._owner.Dispatcher.Stream.features)
                    except NodeProcessed:
                        pass
        Severity: Major
        Found in library/xmpp/auth.py and 2 other locations - About 2 hrs to fix
        library/xmpp/auth.py on lines 149..157
        library/xmpp/transports.py on lines 410..416

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 61.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                if self.startsasl:
                    pass
                elif self._owner.Dispatcher.Stream.features:
                    try:
                        self.FeaturesHandler(self._owner.Dispatcher, self._owner.Dispatcher.Stream.features)
        Severity: Major
        Found in library/xmpp/auth.py and 2 other locations - About 2 hrs to fix
        library/xmpp/auth.py on lines 278..284
        library/xmpp/transports.py on lines 410..416

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 61.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                    if stream["syn_id"] == syn_id:
                        if stream["direction"][0] == "<":
                            conn.Event(self.DBG_LINE, "ERROR ON RECEIVE", stream)
                        else:
                            conn.Event(self.DBG_LINE, "ERROR ON SEND", stream)
        Severity: Major
        Found in library/xmpp/filetransfer.py and 1 other location - About 2 hrs to fix
        library/xmpp/filetransfer.py on lines 215..220

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 61.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                if self._owner.Dispatcher.Stream.features:
                    try:
                        self.FeaturesHandler(self._owner.Dispatcher, self._owner.Dispatcher.Stream.features)
                    except NodeProcessed:
                        pass
        Severity: Major
        Found in library/xmpp/transports.py and 2 other locations - About 2 hrs to fix
        library/xmpp/auth.py on lines 149..157
        library/xmpp/auth.py on lines 278..284

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 61.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                        if stanza.getType() == "error":
                            if stream["direction"][0] == "<":
                                conn.Event(self.DBG_LINE, "ERROR ON RECEIVE", stream)
                            else:
                                conn.Event(self.DBG_LINE, "ERROR ON SEND", stream)
        Severity: Major
        Found in library/xmpp/filetransfer.py and 1 other location - About 2 hrs to fix
        library/xmpp/filetransfer.py on lines 198..203

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 61.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function getTags has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def getTags(self, name, attrs={}, namespace=None, one=0):
                """
                Filters all child nodes using specified arguments as filter.
                Returns the list of nodes found.
                """
        Severity: Minor
        Found in library/xmpp/simplexml.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

        Function discoverInfo has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        def discoverInfo(disp, jid, node=None):
            """
            Query remote object about info that it publishes. Returns identities and features lists.
            """
            identities, features = [], []
        Severity: Minor
        Found in library/xmpp/features.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