fga-gpp-mds/2016.2-SME_UnB

View on GitHub

Showing 16 of 50 total issues

File views.py has 305 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib.auth import authenticate
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User, Permission
Severity: Minor
Found in src/users/views.py - About 3 hrs to fix

    Function draw_base_chart has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function draw_base_chart(data){
          data = google.visualization.arrayToDataTable(data);
    
          var options = {
              title: 'Gráficos do transdutor ',
    Severity: Major
    Found in src/report/static/js/chart.js - About 2 hrs to fix

      File views.py has 285 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from django.shortcuts import render
      from django.contrib.auth.decorators import login_required
      
      from django.core.urlresolvers import reverse_lazy, reverse
      from django.core import serializers
      Severity: Minor
      Found in src/report/views.py - About 2 hrs to fix

        Function report has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def report(request, transductor_id):
            now = datetime.datetime.now()
            delta = datetime.timedelta(days=1)
        
            date = []
        Severity: Minor
        Found in src/report/views.py - About 1 hr to fix

          Function generatePdf has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def generatePdf(transductor_id):
              import time
              from reportlab.lib.enums import TA_JUSTIFY
              from reportlab.lib.pagesizes import letter
              from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
          Severity: Minor
          Found in src/report/views.py - About 1 hr to fix

            Function add_pass_fields has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function add_pass_fields(email){
            
                    $("#myModalLabel")[0].textContent = "Mudar senha";
            
                    var tittle = "<h2 class='form-signin-heading" +
            Severity: Minor
            Found in src/retrieve_password/static/retrieve_password/js/reset.js - About 1 hr to fix

              Function register has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              def register(request):
              
                  if request.method == "GET":
                      return render(request, 'userRegister/register.html')
                  else:
              Severity: Minor
              Found in src/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 draw_initial_chart has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function draw_initial_chart(){
                    var data = [
                      ["Date",
                      "Active power A", "Active power B", "Active power C",
                      "Apparent power A", "Apparent power B", "Apparent power C",
              Severity: Minor
              Found in src/report/static/js/chart.js - About 1 hr to fix

                Function getAlertType has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function getAlertType(notification, notification_name) {
                    var element = "";
                    switch (notification.fields.priority) {
                      case 1:
                      element = '<div class="alert alert-info" name="' + notification_name + '"> '+
                Severity: Minor
                Found in src/users/static/users/js/pusher.js - About 1 hr to fix

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

                  def create_graphic(path, array_date, array_dateb,
                                     array_datec, array_data, label):
                      title = _('Monitoring') + ' ' + label
                  
                      fig = Figure()
                  Severity: Minor
                  Found in src/report/views.py - About 1 hr to fix

                    Function confirm_email has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function confirm_email() {
                            $.ajax({
                                url : "/retrieve_password/forgot/", // the endpoint
                                type : "POST", // http method
                                data : {
                    Severity: Minor
                    Found in src/retrieve_password/static/retrieve_password/js/forgot.js - About 1 hr to fix

                      Function create_graphic has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def create_graphic(path, array_date, array_dateb,
                      Severity: Minor
                      Found in src/report/views.py - About 45 mins to fix

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

                        def edit_user(request, user_id):
                        
                            user = User.objects.get(id=user_id)
                        
                            if request.method == "GET":
                        Severity: Minor
                        Found in src/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 confirm_email has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def confirm_email(request, token):
                            if request.method == "GET":
                                return render(request, "retrieve_password/reset_password.html", \
                                {"token":token})
                            else:
                        Severity: Minor
                        Found in src/retrieve_password/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

                        Avoid too many return statements within this function.
                        Open

                            return render(request, 'users/dashboard.html')
                        Severity: Major
                        Found in src/users/views.py - About 30 mins to fix

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

                            function getAlertType(notification, notification_name) {
                              var element = "";
                              switch (notification.fields.priority) {
                                case 1:
                                element = '<div class="alert alert-info" name="' + notification_name + '"> '+
                          Severity: Minor
                          Found in src/users/static/users/js/pusher.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

                          Severity
                          Category
                          Status
                          Source
                          Language