Princeton-CDH/derrida-django

View on GitHub

Showing 65 of 184 total issues

Function imgAreaSelect has 506 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.imgAreaSelect = function (img, options) {
    var

        $img = $(img),

Severity: Major
Found in sitemedia/js/annotator/imgAreaSelect.js - About 2 days to fix

    File site.js has 780 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    $(function() {
    
      // Clear the text inputs initially so that they are set properly
      // based on the checked boxes when users hit back/forward in the browser
      $('.mdl-textfield__input:not([name=query])').val(''); // but don't clear the header search bar...let it persist
    Severity: Major
    Found in sitemedia/js/site.js - About 1 day to fix

      File tests.py has 698 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      import codecs
      import csv
      import datetime
      from io import StringIO
      Severity: Major
      Found in derrida/interventions/tests.py - About 1 day to fix

        File models.py has 664 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import json
        import string
        
        from django.contrib.contenttypes.fields import GenericRelation
        from django.core.exceptions import ValidationError
        Severity: Major
        Found in derrida/books/models.py - About 1 day to fix

          Function initGlobalFunctions has 285 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function initGlobalFunctions() {
              window.initYearSelector = function(options) {
                var selector = options.selector,
                    fieldName = options.fieldName;
          
          
          Severity: Major
          Found in sitemedia/js/site.js - About 1 day to fix

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

            import datetime
            import json
            import logging
            
            from dal import autocomplete
            Severity: Major
            Found in derrida/books/views.py - About 1 day to fix

              File imgAreaSelect.js has 538 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               * imgAreaSelect jQuery plugin
               * version 0.9.10
               *
               * Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net)
              Severity: Major
              Found in sitemedia/js/annotator/imgAreaSelect.js - About 1 day to fix

                Function annotatorImageSelect has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function annotatorImageSelect(options) {
                  var _t = annotator.util.gettext,
                    global = this;  // equivalent to previously used annotator.util.getGlobal()
                
                  options = options || {};
                Severity: Major
                Found in sitemedia/js/annotator/imgselect.js - About 6 hrs to fix

                  Function annotatorInterventions has 161 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function annotatorInterventions(confs) {
                  
                    var interventions = {
                  
                      /**
                  Severity: Major
                  Found in sitemedia/js/annotator/interventions-plugin.js - About 6 hrs to fix

                    Function initYearSelector has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        window.initYearSelector = function(options) {
                          var selector = options.selector,
                              fieldName = options.fieldName;
                    
                          var $yearFilter = $(selector),
                    Severity: Major
                    Found in sitemedia/js/site.js - About 5 hrs to fix

                      Function initAuthorFilter has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function initAuthorFilter() {
                          var $authorFilter = $(".filter.filter--author");
                          if (! $authorFilter.length) {
                            return false;
                          }
                      Severity: Major
                      Found in sitemedia/js/site.js - About 5 hrs to fix

                        Function annotatorImageSelect has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function annotatorImageSelect(options) {
                          var _t = annotator.util.gettext,
                            global = this;  // equivalent to previously used annotator.util.getGlobal()
                        
                          options = options || {};
                        Severity: Minor
                        Found in sitemedia/js/annotator/imgselect.js - About 5 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

                        File 0001_squashed_0033_remove_book_models.py has 372 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        # -*- coding: utf-8 -*-
                        # Generated by Django 1.11.1 on 2017-06-13 23:16
                        from __future__ import unicode_literals
                        import os
                        from django.conf import settings
                        Severity: Minor
                        Found in derrida/books/migrations/0001_squashed_0033_remove_book_models.py - About 4 hrs to fix

                          Function as_zotero_item has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def as_zotero_item(self, library):
                                  '''Serialize the instance as an item suitable for export to a Zotero
                                  library. Requires a :class:`pyzotero.zotero.Zotero` instance for API
                                  calls to retrieve item type templates and creator types.'''
                                  # get the item template/creator types based on item type
                          Severity: Minor
                          Found in derrida/books/models.py - 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 get_queryset has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def get_queryset(self):
                                  sqs = SearchQuerySet().models(self.model)
                          
                                  # initialize form with user search parameters and form defaults
                                  # preserve as QueryDict to get smart single item/list behavior
                          Severity: Minor
                          Found in derrida/books/views.py - 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 initCheckboxSelector has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              window.initCheckboxSelector = function(options) {
                                var filterInputSelector = options.filterInputSelector,
                                    filterCheckListSelector = options.filterCheckListSelector,
                                    filterSelector = options.filterSelector,
                                    filterClickEvent = options.filterClickEvent,
                          Severity: Major
                          Found in sitemedia/js/site.js - About 4 hrs to fix

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

                                def get_queryset(self):
                                    sqs = SearchQuerySet().models(self.model)
                            
                                    # initialize form with user search parameters and form defaults
                                    # preserve as QueryDict to get smart single item/list behavior
                            Severity: Minor
                            Found in derrida/interventions/views.py - 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 get_queryset has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def get_queryset(self):
                                    sqs = SearchQuerySet().models(self.model)
                                    # restrict to cited books
                                    sqs = sqs.filter(item_type_exact='Book', cited_in='*')
                                    # Note: using item_type_exact to avoid matching book section
                            Severity: Minor
                            Found in derrida/books/views.py - About 3 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 get_proxy_url has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def get_proxy_url(self, *args, **kwargs):
                                    '''
                                    Return a proxy url for client browsers to access IIIF images from.
                                    '''
                            
                            
                            Severity: Minor
                            Found in derrida/books/views.py - About 3 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 editorExtension has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                 editorExtension: function(editor) {
                                      // update built-in annotation text field so label and placeholders
                                      // make sense for how it is being used in this project
                                      // TODO: could these overrides be included in the config?
                                      editor.fields[0].label = 'Annotation Text';
                            Severity: Major
                            Found in sitemedia/js/annotator/interventions-plugin.js - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language