divio/django-cms

View on GitHub

Showing 869 of 869 total issues

File select2.js has 2562 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
Copyright 2012 Igor Vaynberg

Version: @@ver@@ Timestamp: @@timestamp@@

Severity: Major
Found in cms/static/cms/js/select2/select2.js - About 1 wk to fix

    File cms.plugins.js has 1473 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright https://github.com/divio/django-cms
     */
    import Modal from './cms.modal';
    import StructureBoard from './cms.structureboard';
    Severity: Major
    Found in cms/static/cms/js/modules/cms.plugins.js - About 3 days to fix

      File pageadmin.py has 1416 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import json
      import re
      import sys
      import uuid
      from collections import namedtuple
      Severity: Major
      Found in cms/admin/pageadmin.py - About 3 days to fix

        File pagemodel.py has 1273 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import copy
        from collections import OrderedDict
        from logging import getLogger
        from os.path import join
        
        
        Severity: Major
        Found in cms/models/pagemodel.py - About 3 days to fix

          File pep.js has 1106 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*!
           * PEP v0.3.0 | https://github.com/jquery/PEP
           * Copyright jQuery Foundation and other contributors | http://jquery.org/license
           *
           * This file is modified for CMS. All `touch-action` attributes are now `data-touch-action`
          Severity: Major
          Found in cms/static/cms/js/libs/pep.js - About 2 days to fix

            File cms.structureboard.js has 1105 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             * Copyright https://github.com/divio/django-cms
             */
            
            import $ from 'jquery';
            Severity: Major
            Found in cms/static/cms/js/modules/cms.structureboard.js - About 2 days to fix

              Function grid has 553 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  $.jstree.plugins.grid = function(options,parent) {
                      this._initialize = function () {
                          if (!this._initialized) {
                              var s = this.settings.grid || {}, styles,    container = this.element, gridparent = container.parent(), i,
                              gs = this._gridSettings = {
              Severity: Major
              Found in cms/static/cms/js/libs/jstree/jstree.grid.min.js - About 2 days to fix

                File forms.py has 1050 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from django import forms
                from django.apps import apps
                from django.contrib.auth import get_permission_codename, get_user_model
                from django.contrib.auth.models import Permission
                from django.contrib.contenttypes.models import ContentType
                Severity: Major
                Found in cms/admin/forms.py - About 2 days to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  (function ($) {
                      "use strict";
                      // use text for the numbers 2 through 4
                      var smallNumbers = {
                          2: function(masc) { return (masc ? "dva" : "dvě"); },
                  Severity: Major
                  Found in cms/static/cms/js/select2/select2_locale_cs.js and 1 other location - About 2 days to fix
                  cms/static/cms/js/select2/select2_locale_sk.js on lines 6..50

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 425.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  (function ($) {
                      "use strict";
                      // use text for the numbers 2 through 4
                      var smallNumbers = {
                          2: function(masc) { return (masc ? "dva" : "dve"); },
                  Severity: Major
                  Found in cms/static/cms/js/select2/select2_locale_sk.js and 1 other location - About 2 days to fix
                  cms/static/cms/js/select2/select2_locale_cs.js on lines 7..51

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 425.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  File placeholderadmin.py has 933 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import uuid
                  import warnings
                  from urllib.parse import parse_qsl, urlparse
                  
                  from django.contrib.admin.helpers import AdminForm
                  Severity: Major
                  Found in cms/admin/placeholderadmin.py - About 2 days to fix

                    File cms_tags.py has 851 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    from collections import OrderedDict, namedtuple
                    from copy import copy
                    from datetime import datetime
                    
                    from classytags.arguments import Argument, MultiKeywordArgument, MultiValueArgument
                    Severity: Major
                    Found in cms/templatetags/cms_tags.py - About 2 days to fix

                      Page has 93 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Page(models.Model):
                          """
                          A simple hierarchical page model
                          """
                          LIMIT_VISIBILITY_IN_MENU_CHOICES = (
                      Severity: Major
                      Found in cms/models/pagemodel.py - About 1 day to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        class MenusFixture:
                            def create_fixtures(self):
                                """
                                Tree from fixture:
                        
                        
                        Severity: Major
                        Found in cms/test_utils/fixtures/menus.py and 1 other location - About 1 day to fix
                        cms/test_utils/fixtures/menus.py on lines 70..97

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 192.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        class SubMenusFixture:
                            def create_fixtures(self):
                                """
                                Tree from fixture:
                        
                        
                        Severity: Major
                        Found in cms/test_utils/fixtures/menus.py and 1 other location - About 1 day to fix
                        cms/test_utils/fixtures/menus.py on lines 4..31

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 192.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        File cms.modal.js has 743 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /*
                         * Copyright https://github.com/divio/django-cms
                         */
                        
                        import ChangeTracker from './cms.changetracker';
                        Severity: Major
                        Found in cms/static/cms/js/modules/cms.modal.js - About 1 day to fix

                          File cms.pagetree.js has 743 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /*
                           * Copyright https://github.com/divio/django-cms
                           */
                          
                          import $ from 'jquery';
                          Severity: Major
                          Found in cms/static/cms/js/modules/cms.pagetree.js - About 1 day to fix

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                            @toolbar_pool.register
                            class MyTitleExtensionToolbar(CMSToolbar):
                                def populate(self):
                                    # always use draft if we have a page
                                    self.page = get_page_draft(self.request.current_page)
                            Severity: Major
                            Found in cms/test_utils/project/extensionapp/cms_toolbars.py and 1 other location - About 1 day to fix
                            cms/test_utils/project/extensionapp/cms_toolbars.py on lines 45..69

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 185.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                def populate(self):
                                    # always use draft if we have a page
                                    self.page = get_page_draft(self.request.current_page)
                            
                                    if not self.page:
                            Severity: Major
                            Found in cms/test_utils/project/extensionapp/cms_toolbars.py and 1 other location - About 1 day to fix
                            cms/test_utils/project/extensionapp/cms_toolbars.py on lines 12..38

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 185.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                            (function ($) {
                                "use strict";
                            
                                $.fn.select2.locales['nl'] = {
                                    formatNoMatches: function () { return "Geen resultaten gevonden"; },
                            Severity: Major
                            Found in cms/static/cms/js/select2/select2_locale_nl.js and 1 other location - About 1 day to fix
                            cms/static/cms/js/select2/select2_locale_et.js on lines 6..19

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 270.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Severity
                            Category
                            Status
                            Source
                            Language