tranlyvu/recommender

View on GitHub

Showing 5 of 13 total issues

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

def user_based(person_to_recommend, preference_space, number_of_items_to_recommend=10, similarity_measure='euclidean_distance'):

    """ return list of recommended items using user_based approach
    
    Args
Severity: Minor
Found in recommender_engine/recommender.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 cosine has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def cosine(preference_space, person1, person2):
    
    """ return cosine similarity measure @ https://en.wikipedia.org/wiki/Cosine_similarity
    
    Args
Severity: Minor
Found in recommender_engine/similarity_measure/cosine.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 make_recommendation has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def make_recommendation(person_to_recommend,
Severity: Minor
Found in recommender_engine/recommender.py - About 35 mins to fix

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

    def make_preference_space(raw_data, start):
        
        """ create preference_space from raw data
    
            Args:
    Severity: Minor
    Found in sample_jester.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

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

    def pearson_correlation(prefs, person1, person2):
        
        """ Return pearson correlation measure 
            
        Args
    Severity: Minor
    Found in recommender_engine/similarity_measure/pearson_correlation.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