gedankenstuecke/twitter-analyser

View on GitHub

Showing 10 of 64 total issues

File new_tweet_subset.js has 540 lines of code (exceeds 250 allowed). Consider refactoring.
Open

window.YTD.tweet.part0 = [ {
  "retweeted" : false,
  "source" : "<a href=\"http://tapbots.com/tweetbot\" rel=\"nofollow\">Tweetbot for iΟS</a>",
  "entities" : {
    "hashtags" : [ ],
Severity: Major
Found in new_tweet_subset.js - About 1 day to fix

    Function complete has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def complete(request):
        """
        Receive user from Open Humans. Store data, start data upload task.
        """
        logger.debug("Received user returning from Open Humans.")
    Severity: Minor
    Found in users/views.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 oh_code_to_member has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def oh_code_to_member(code):
        """
        Exchange code for token, use this to create and return OpenHumansMember.
        If a matching OpenHumansMember already exists in db, update and return it.
        """
    Severity: Minor
    Found in users/views.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 import_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def import_data(oh_user_id):
        url = get_file_url(oh_user_id)
    
        # NOTE: Might want to handle this more gracefully, e.g. prompt file upload.
        if not url:
    Severity: Minor
    Found in tweet_display/tasks.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 create_dataframe has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_dataframe(tweets):
        '''
        create a pandas dataframe from our tweet jsons
        '''
    
    
    Severity: Minor
    Found in tweet_display/read_data.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 grant_access has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def grant_access(request, oh_id):
        if oh_id is None:
            if request.user.is_authenticated:
                return request.user.openhumansmember.oh_id
        else:
    Severity: Minor
    Found in tweet_display/helper.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 write_graph has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def write_graph(dataframe, oh_user, graph_type, graph_desc,
    Severity: Minor
    Found in tweet_display/tasks.py - About 45 mins to fix

      Function check_reply_to has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def check_reply_to(single_tweet):
          '''
          check whether tweet is a reply. If yes:
          return name & user name of the user that's replied to.
          otherwise just return nones
      Severity: Minor
      Found in tweet_display/read_data.py - About 35 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 check_reply_to has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def check_reply_to(single_tweet):
          '''
          check whether tweet is a reply. If yes:
          return name & user name of the user that's replied to.
          otherwise just return nones
      Severity: Minor
      Found in analyser.py - About 35 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 check_retweet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def check_retweet(single_tweet):
          '''
          check whether tweet is a RT. If yes:
          return name & user name of the RT'd user.
          otherwise just return nones
      Severity: Minor
      Found in tweet_display/read_data.py - About 35 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