uktrade/invest-ui

View on GitHub

Showing 15 of 108 total issues

File urls_redirect.py has 3416 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from django.conf.urls import url
from django.http import HttpResponseNotFound, HttpResponseServerError
from django.views import View
from django.views.generic import RedirectView
from directory_constants import urls
Severity: Major
Found in conf/urls_redirect.py - About 1 wk to fix

    Function invest has 126 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    dit.tagging.invest = new function() {
    
        this.init = function(page) {
            $(document).ready(function() {
    
    
    Severity: Major
    Found in core/static/js/dit.tagging.js - About 5 hrs to fix

      File dit.js has 365 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Main dit.js file
      // Expected to hold global variables, messages, and provide base to namespaces
      
      var dit = {
        // Namespace to be populated by external files
      Severity: Minor
      Found in core/static/js/dit.js - About 4 hrs to fix

        Function responsive has 79 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        dit.responsive = (new function () {
        
          // Constants
          var RESET_EVENT = "dit:responsive:reset";
          var RESPONSIVE_ELEMENT_ID = "dit-responsive-size";
        Severity: Major
        Found in core/static/js/dit.js - About 3 hrs to fix

          Function Expander has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function Expander($target, options) {
              var EXPANDER = this;
              var id = utils.generateUniqueStr(TYPE + "_");
              var $wrapper, $control;
          
          
          Severity: Major
          Found in core/static/js/dit.js - About 2 hrs to fix

            Function home has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            dit.home = (new function () {
              // Page init
              this.init = function() {
                dit.responsive.init({
                  "desktop": "min-width: 768px",
            Severity: Major
            Found in core/static/js/main.js - About 2 hrs to fix

              Function languageSelector has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              dit.components.languageSelector = (new function() {
              
                var LANG_SELECT_CLOSE_BUTTON_ID = "header-language-selector-close";
              
                /* Extends SelectTracker to meet additional display requirement
              Severity: Major
              Found in core/static/js/dit.components.languageSelector.js - About 2 hrs to fix

                Function init has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    this.init = function(page) {
                        $(document).ready(function() {
                
                            addTaggingForFeedbackLink();
                
                
                Severity: Minor
                Found in core/static/js/dit.tagging.js - About 1 hr to fix

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

                    Expander.move = function(e) {
                      var counter = this.links.counter;
                      var $links = this.links.$found;
                      if($links) {
                        switch(e.which) {
                  Severity: Minor
                  Found in core/static/js/dit.js - About 1 hr to fix

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

                    dit.components.languageSelector = (new function() {
                    
                      var LANG_SELECT_CLOSE_BUTTON_ID = "header-language-selector-close";
                    
                      /* Extends SelectTracker to meet additional display requirement
                    Severity: Minor
                    Found in core/static/js/dit.components.languageSelector.js - 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 Modal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function Modal($container, options) {
                        var modal = this;
                        var config = $.extend({
                          $activators: $(), // (optional) Element(s) to control the Modal
                          closeOnBuild: true, // Whether intial Modal view is open or closed
                    Severity: Minor
                    Found in core/static/js/dit.class.modal.js - About 1 hr to fix

                      Function responsive has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      dit.responsive = (new function () {
                      
                        // Constants
                        var RESET_EVENT = "dit:responsive:reset";
                        var RESPONSIVE_ELEMENT_ID = "dit-responsive-size";
                      Severity: Minor
                      Found in core/static/js/dit.js - About 55 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 localised_urls has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def localised_urls(self):
                              localised = []
                              requested_language = translation.get_language()
                              url_parts = urlparse(self.request.build_absolute_uri())
                              base_url = f'{url_parts.scheme}://{url_parts.netloc}/'
                      Severity: Minor
                      Found in core/mixins.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def __init__(
                      Severity: Minor
                      Found in opportunities/forms.py - About 35 mins to fix

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

                            def process_request(self, request):
                                if not request.session.get('utm'):
                                    request.session['utm'] = {}
                        
                                if request.GET.get('utm_source'):
                        Severity: Minor
                        Found in contact/middleware.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

                        Severity
                        Category
                        Status
                        Source
                        Language