classrank/ClassRank

View on GitHub

Showing 9 of 20 total issues

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

    def post(self):
        errors = dict()
        success = False
        form = SettingsForm(self.request.arguments)
        current_user = self.decoded_username()
Severity: Minor
Found in classrank/handlers/settings.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_to_database has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def add_to_database(grouch_output, db):
    """
    Add courses from Grouch's output to a db.

    Keyword arguments:
Severity: Minor
Found in classrank/grouch/grouch_util.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 createLookups has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def createLookups(self):
        instanceCounter = 0
        featureCounter = 0
        for instance in self.dataDict:
            if instance not in self.instanceLookup:
Severity: Minor
Found in classrank/filters/datawrapper.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, data=dict(), numRecommendations=1, db=None, metric="rating", school="gatech"):
Severity: Minor
Found in classrank/filters/collabfilter.py - About 35 mins to fix

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

        def post(self):
            errors = dict()
            form = RegistrationForm(self.request.arguments)
            if form.validate():
                h, s = authenticate.create_password(self.get_argument('password'))
    Severity: Minor
    Found in classrank/handlers/auth.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 getRecommendation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def getRecommendation(self, instances):
            if(self.updated):
                self.sparseifyData()
                self.model = self.svd.inverse_transform(self.svd.fit_transform(self.sparsedata))
                self.updated = False
    Severity: Minor
    Found in classrank/filters/collabfilter.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 post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def post(self):
            errors = dict()
            form = LoginForm(self.request.arguments)
            if form.validate():
                try:
    Severity: Minor
    Found in classrank/handlers/auth.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 optionalLength has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def optionalLength(min, max, message):
      """Ensures a field is either empty, or between min-max characters"""
      def _optionalLength(form, field):
        if len(field.data) > 0:
          if len(field.data) < min or len(field.data) > max:
    Severity: Minor
    Found in classrank/handlers/forms.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 sparseifyData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def sparseifyData(self):
            data = self.dataset.getData()
            sparsematrix = sparse.dok_matrix((len(data), len(data[0])))
            for i in range(len(data)):
                for j in range(len(data[i])):
    Severity: Minor
    Found in classrank/filters/collabfilter.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