ZeroCater/python-mailgun2

View on GitHub

Showing 4 of 4 total issues

Function send_message has 13 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def send_message(self, from_email, to, cc=None, bcc=None,
Severity: Major
Found in mailgun2/mailgun.py - About 1 hr to fix

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

        def send_message(self, from_email, to, cc=None, bcc=None,
                         subject=None, text=None, html=None, tags=None,
                         reply_to=None, headers=None, inlines=None, attachments=None, campaign_id=None):
            # sanity checks
            assert (text or html)
    Severity: Minor
    Found in mailgun2/mailgun.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 add_list_member has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def add_list_member(self, list_name, address, name=None, params=None,
    Severity: Minor
    Found in mailgun2/mailgun.py - About 45 mins to fix

      Function add_list_member has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_list_member(self, list_name, address, name=None, params=None,
                              subscribed=True, upsert=False):
              data = {'address': address}
              if name:
                  data['name'] = name
      Severity: Minor
      Found in mailgun2/mailgun.py - About 25 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

      Severity
      Category
      Status
      Source
      Language