um-cseg/chez-betty

View on GitHub

Showing 186 of 349 total issues

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

def admin_user_archive(request):
    try:
        user = User.from_id(int(request.matchdict['user_id']))

        # Cannot archive already archived user
Severity: Minor
Found in chezbetty/views_admin.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 create_highcharts_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create_highcharts_json(request, metric, period):
    try:
        return admin_data_highcharts_period(metric, period)
    except ValueError:
        return {'status': 'error'}
Severity: Minor
Found in chezbetty/views_data.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 admin_data_period_range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def admin_data_period_range(start, end, metric, period):
    if metric == 'items':
        data = PurchaseLineItem.quantity_by_period(period, start=ftz(start), end=ftz(end))
        return zip(create_x_y_from_group(data, start, end, period))
    elif metric == 'sales':
Severity: Minor
Found in chezbetty/views_data.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 show_correct_purchase_button has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function show_correct_purchase_button () {
    if ($("#purchase-complete:visible").length == 1) {
        // If we are on the purchase complete page, show logout
        $("#purchase-button-purchaselogout").hide();
        $("#purchase-button-purchase").hide();
Severity: Minor
Found in chezbetty/static/js/chezbetty-terminal.js - 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 _get_event_filter_function has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _get_event_filter_function(event_filter):
    fields = event_filter.split(':')
    if fields[0] == 'type':
        def filterfn (*args, **kwargs):
            return Event.get_events_by_type(fields[1], *args, **kwargs)
Severity: Minor
Found in chezbetty/views_admin.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 readGitVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def readGitVersion():
    try:
        proc = subprocess.Popen(('git', 'describe', '--long', '--tags',
                                 '--match', 'v[0-9]*.*'),
                                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Severity: Minor
Found in version.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