iranzo/stampython

View on GitHub

Showing 97 of 154 total issues

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

def remove_from_memberid(type=False, id=0, name=False, date=False, memberid=None):
    """
    Remove memberID from memberid
    :param type: user or chat
    :param id: ID to update
Severity: Minor
Found in stampy/plugin/stats.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 loglevel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def loglevel():
    """
    This functions stores or sets the proper log level based on the
    database configuration
    """
Severity: Minor
Found in stampy/stampy.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 getPlugins has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def getPlugins():
    """
    Gets list of plugins in the plugins folder
    :return: list of plugins available
    """
Severity: Minor
Found in stampy/plugins.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 basecommands has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def basecommands(message):
    """
    Processes link commands in the message
    :param message: message to process
    :return:
Severity: Minor
Found in stampy/plugin/base.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 hilightcommands has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def hilightcommands(message):
    """
    Processes hilight commands in the message texts
    :return:
    """
Severity: Minor
Found in stampy/plugin/highlight.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 dbsql has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def dbsql(sql=False):
    """
    Performs SQL operation on database
    :param sql: sql command to execute
    :return:
Severity: Minor
Found in stampy/stampy.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 getoutcommands has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def getoutcommands(message):
    """
    Processes getout commands in the messages
    :param message: message to process
    :return:
Severity: Minor
Found in stampy/plugin/stats.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 replacevowels has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def replacevowels(message):
    """
    Finds vowels in messages and replaces by 'i'
    :param message: message to process
    :return:
Severity: Minor
Found in stampy/plugin/remedar.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 comicfromrss has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def comicfromrss(url):
    """
    Returns title, img and post url
    :param url: url to process
    :return:
Severity: Minor
Found in stampy/plugin/comic.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 kick has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def kick(chat_id=False, user_id=False, ban=False):
    """
    Use API call to have the bot kick out of chat
    :param chat_id:  chat id to locate user into
    :param user_id:  user id to kick out of chat
Severity: Minor
Found in stampy/plugin/irccommands.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 dokarmacleanup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def dokarmacleanup(word=False, maxage=int(stampy.plugin.config.config("maxage", default=180))):
    """
    Checks on the karma database the date of the last update in the word
    :param word: word to query in database
    :param maxage: defines maximum number of days to allow karma to be inactive
Severity: Minor
Found in stampy/plugin/karma.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 forwardmessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def forwardmessage(message):
    """
    Forwards a message based on id/chatid to target chatid
    :param message: Message to process (contaning all details)
    :return:
Severity: Minor
Found in stampy/plugin/forward.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 shouldrun has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def shouldrun(name):
    """
    Checks name on database to see if it should run or not and updates as executed
    :param name: Name to check on database
    :return: Bool
Severity: Minor
Found in stampy/stampy.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 getitems has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def getitems(var):
    """
    Returns list of items even if provided args are lists of lists
    :param var: list or value to pass
    :return: unique list of values
Severity: Minor
Found in stampy/stampy.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

Avoid deeply nested control flow statements.
Open

                    if result['ok'] is True or result['ok'] == 'True':
                        text = _("User %s kicked out of chat %s") % (user_id, chat_id)
                    else:
                        text = _("Error kicking user %s from chat %s: %s") % (user_id, chat_id, result)

Severity: Major
Found in stampy/plugin/irccommands.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if hilight in gethilightwords(uid=uid):
                            logger.debug(msg=_L('Word %s is in text and forwarding for user') % hilight)
                            forward = True
            else:
    Severity: Major
    Found in stampy/plugin/highlight.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if "@" in each:
                              username = each[1:-1]
                  if username and username != "@":
      Severity: Major
      Found in stampy/plugin/stats.py - About 45 mins to fix

        Function topic has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def topic(chat_id=False, title=False):
            """
            Use API call to have the bot change topic
            :param chat_id:  chat id to locate user into
            :param title: new title to set
        Severity: Minor
        Found in stampy/plugin/irccommands.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

        Avoid deeply nested control flow statements.
        Open

                            if stampy.plugin.alias.getalias(word, gid=gid):
                                word = stampy.plugin.alias.getalias(word, gid=gid).split(" ")
                            for item in word:
        Severity: Major
        Found in stampy/plugin/karma.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if result['ok'] is True or result['ok'] == 'True':
                                  text = _("User %s kicked and banned out of chat %s") % (user_id, chat_id)
                              else:
                                  text = _("Error kick+ban user %s from chat %s: %s") % (user_id, chat_id, result['description'])
                              stampy.stampy.sendmessage(chat_id=chat_id, text=text, reply_to_message_id=message_id, disable_web_page_preview=True, parse_mode="Markdown")
          Severity: Major
          Found in stampy/plugin/irccommands.py - About 45 mins to fix
            Severity
            Category
            Status
            Source
            Language