Contrast-Security-OSS/DjanGoat

View on GitHub

Showing 20 of 76 total issues

File seed.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import binascii
import datetime

import pytz
from Crypto import Random
Severity: Minor
Found in app/management/commands/seed.py - About 4 hrs to fix

    Function searchFunction has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function searchFunction() {
        var input, filter, table, tr;
        input = document.getElementById("searchInput");
        filter = input.value;
    
    
    Severity: Minor
    Found in static/app/javascript/users/pay/index.js - About 4 hrs 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 sessions_index has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def sessions_index(request, email=None, password=None, path='/dashboard/home'):
        if request.method == "POST":
            # Set path variable
            if 'path' in request.POST:
                path = request.POST['path']
    Severity: Minor
    Found in app/views/sessions/views.py - About 2 hrs 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 drawChart has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function drawChart() {
        var pto_taken = parseInt(document.getElementById('pto_taken').value);
        var pto_remain = parseInt(document.getElementById('pto_remain').value);
        var sick_taken = parseInt(document.getElementById('sick_taken').value);
        var sick_remain = parseInt(document.getElementById('sick_remain').value);
    Severity: Major
    Found in static/app/javascript/dashboard/home.js - About 2 hrs to fix

      Function user_view has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def user_view(request, user_id):
          if request.method == "POST":
              form = request.POST
              if not form:
                  return HttpResponse("User " + str(user_id) + "POST")
      Severity: Minor
      Found in app/views/users/views.py - About 2 hrs 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 validate_update_form has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_update_form(form, user, update):
              err_list = []
              if form["password_new"] != form["confirm"]:
                  err_list.append("Password and Confirm Password does not match")
              elif len(form["password_new"]) != 0:
      Severity: Minor
      Found in app/models/User/user.py - About 2 hrs 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 validation has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function validation() {
          $("form").validate({
              rules: {
                  "password": {
                      required: false,
      Severity: Minor
      Found in static/app/javascript/admin/validation.js - About 1 hr to fix

        Function searchFunction has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function searchFunction() {
            var input, filter, table, tr;
            input = document.getElementById("searchInput");
            filter = input.value;
        
        
        Severity: Minor
        Found in static/app/javascript/users/pay/index.js - About 1 hr to fix

          Function drawChart has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function drawChart() {
              // console.log(document.all)
          
              // Create the data table.
              var sick_days_taken = parseInt(document.getElementById('sick_days_taken').value);
          Severity: Minor
          Found in static/app/javascript/users/paid_time_off/paid_time_off.js - About 1 hr to fix

            Function index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def index(request):
                if request.method == "POST":
                    form = request.POST
                    if not form:
                        return HttpResponse("Users index")
            Severity: Minor
            Found in app/views/users/views.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 simulate_simple_authentication has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def simulate_simple_authentication(factory, client, email, password, path, add_messages_middleware, views):
            Severity: Major
            Found in app/views/utils.py - About 50 mins to fix

              Function check_if_valid_token has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def check_if_valid_token(request):
                  if 'HTTP_AUTHORIZATION' not in request.META:
                      return False
                  else:
                      token = urlparse.unquote(request.META['HTTP_AUTHORIZATION'])
              Severity: Minor
              Found in app/views/api/users/views.py - About 45 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 getCookie has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function getCookie(name) {
                  var cookieValue = null;
                  if (document.cookie && document.cookie != '') {
                      var cookies = document.cookie.split(';');
                      for (var i = 0; i < cookies.length; i++) {
              Severity: Minor
              Found in static/app/javascript/admin/modal.js - 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 getCookie has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function getCookie(name) {
                  var cookieValue = null;
                  if (document.cookie && document.cookie !== '') {
                      var cookies = document.cookie.split(';');
                      for (var i = 0; i < cookies.length; i++) {
              Severity: Minor
              Found in static/app/javascript/users/pay/index.js - 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 api_index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              def api_index(request):
                  if check_if_valid_token(request):
                      try:
                          token = urlparse.unquote(request.META['HTTP_AUTHORIZATION'])
                          user_id = extrapolate_user(token)
              Severity: Minor
              Found in app/views/api/users/views.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 admin_analytics has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              def admin_analytics(request, selected_id):  # pylint: disable=unused-argument
                  current_user = utils.current_user(request)
                  data = request.GET.dict().copy()
                  col = []
                  for key in data:
              Severity: Minor
              Found in app/views/admin/views.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 getCookie has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function getCookie(name) {
                  var cookieValue = null;
                  if (document.cookie && document.cookie != '') {
                      var cookies = document.cookie.split(';');
                      for (var i = 0; i < cookies.length; i++) {
              Severity: Minor
              Found in static/app/javascript/delete_button.js - 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 HttpResponse("Invalid HTTP method")
              Severity: Major
              Found in app/views/users/paid_time_off/views.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return HttpResponse("Sessions Index")
                Severity: Major
                Found in app/views/sessions/views.py - About 30 mins to fix

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

                  def user_is_authenticated(function):
                  
                      def wrap(request, *args, **kwargs):
                          if 'auth_token' in request.COOKIES:
                              try:
                  Severity: Minor
                  Found in app/decorators.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