drivet/pylint-server

View on GitHub

Showing 2 of 2 total issues

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

def get_rating_and_colour(report):
    colour = '9d9d9d'
    rating = 0
    match = re.search("Your code has been rated at (.+?)/10", report)
    if match:
Severity: Minor
Found in pylint_server.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 handle_report_post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def handle_report_post():
    current_app.logger.info('handling POST on /reports')
    travis_job_id_str = None
    if 'travis-job-id' in request.form:
        travis_job_id_str = request.form['travis-job-id']
Severity: Minor
Found in pylint_server.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