yuecen/github-email-explorer

View on GitHub

Showing 4 of 6 total issues

Function get_email_from_events has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def get_email_from_events(rsp, name):
    """
    Parses out the email, if available from a user's public events
    """
    rsp = rsp.json()
Severity: Minor
Found in github_email_explorer/github_email.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

Avoid deeply nested control flow statements.
Open

                    if author['name'] == name:
                        return author.get('email')

Severity: Major
Found in github_email_explorer/github_email.py - About 45 mins to fix

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

    def send_sendgrid(sendgrid_api_key=None, github_email_template=None, github_user_emails=None):
    
        assert sendgrid_api_key, "SendGrid API key is required"
    
        sg = SendGridAPIClient(apikey=sendgrid_api_key)
    Severity: Minor
    Found in github_email_explorer/email_handler.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

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

    def format_email(ges):
        """
        John (john2) <John@example.org>; Peter James (pjames) <James@example.org>
        """
        formatted_email = []
    Severity: Minor
    Found in github_email_explorer/github_email.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