um-cseg/chez-betty

View on GitHub

Showing 186 of 349 total issues

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

def admin_event(request):
    try:
        event = Event.from_id(int(request.matchdict['event_id']))

        # Mangers can only see restocks.
Severity: Minor
Found in chezbetty/views_admin.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

Avoid too many return statements within this function.
Open

        return zip(create_x_y_from_group(data,  start, end, period, float, 0.0))
Severity: Major
Found in chezbetty/views_data.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return {'status': 'error'}
    Severity: Major
    Found in chezbetty/views_data.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return {'status': 'error'}
      Severity: Major
      Found in chezbetty/views_data.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return True
        Severity: Major
        Found in chezbetty/utility.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return datetime_to_timestamps(data, float)
          Severity: Major
          Found in chezbetty/views_data.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return {'error': str(e)}
            Severity: Major
            Found in chezbetty/views_terminal.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return '<a href="/admin/pool/{}">{}</a>'.format(obj.id, shorten(obj.name, str_len))
              Severity: Major
              Found in chezbetty/jinja2_filters.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return ["serviceaccount"]
                Severity: Major
                Found in chezbetty/models/user.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return obj.name
                  Severity: Major
                  Found in chezbetty/jinja2_filters.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return HTTPFound(location=request.route_url('user_pool', pool_id=pool.id))
                    Severity: Major
                    Found in chezbetty/views_user.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return HTTPFound(location=request.route_url('user_pools'))
                      Severity: Major
                      Found in chezbetty/views_user.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return '<a href="/admin/vendor/edit/{}">{}</a>'.format(obj.id, shorten(obj.name, str_len))
                        Severity: Major
                        Found in chezbetty/jinja2_filters.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return {'status': 'error'}
                          Severity: Major
                          Found in chezbetty/views_admin.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return HTTPFound(location=request.route_url('admin_events'))
                            Severity: Major
                            Found in chezbetty/views_admin.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return HTTPFound(location=request.route_url('admin_user_balance_edit'))
                              Severity: Major
                              Found in chezbetty/views_admin.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                return HTTPFound(location=request.route_url('admin_event', event_id=event.id))
                                Severity: Major
                                Found in chezbetty/views_admin.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return HTTPFound(location=request.route_url('admin_cash_reconcile'))
                                  Severity: Major
                                  Found in chezbetty/views_admin.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return HTTPFound(location=request.route_url('admin_cash_reconcile'))
                                    Severity: Major
                                    Found in chezbetty/views_admin.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return HTTPFound(location=request.route_url('admin_item_edit', item_id=int(request.POST['item-id'])))
                                      Severity: Major
                                      Found in chezbetty/views_admin.py - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language