divio/django-cms

View on GitHub

Showing 579 of 869 total issues

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

Plugin._refreshPlugins = function refreshPlugins() {
    Plugin.aliasPluginDuplicatesMap = {};
    Plugin.staticPlaceholderDuplicatesMap = {};
    CMS._plugins = uniqWith(CMS._plugins, isEqual);

Severity: Minor
Found in cms/static/cms/js/modules/cms.plugins.js - About 1 hr to fix

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

            destroy: function () {
                var element=this.opts.element, select2 = element.data("select2"), self = this;
    
                this.close();
    
    
    Severity: Minor
    Found in cms/static/cms/js/select2/select2.js - About 1 hr to fix

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

          cutPlugin: function() {
              // if cut is once triggered, prevent additional actions
              if (CMS.API.locked) {
                  return false;
              }
      Severity: Minor
      Found in cms/static/cms/js/modules/cms.plugins.js - About 1 hr to fix

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

            addJsScriptsNeededForRender(newScripts, oldScripts) {
                const scriptSrcList = [];
                let classListCollection = [];
                const that = this;
        
        
        Severity: Minor
        Found in cms/static/cms/js/modules/cms.structureboard.js - About 1 hr to fix

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

              _setPluginContentEvents: function _setPluginContentEvents() {
                  const pluginDoubleClickEvent = this._getNamepacedEvent(Plugin.doubleClick);
          
                  this.ui.container
                      .off('mouseover.cms.plugins')
          Severity: Minor
          Found in cms/static/cms/js/modules/cms.plugins.js - About 1 hr to fix

            Function add_ajax_item has 11 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def add_ajax_item(self, name, action, active=False, disabled=False,
            Severity: Major
            Found in cms/toolbar/items.py - About 1 hr to fix

              Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, name, action, csrf_token, data=None, active=False,
              Severity: Major
              Found in cms/toolbar/items.py - About 1 hr to fix

                Function create_title has 11 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def create_title(language, title, page, menu_title=None, slug=None,
                Severity: Major
                Found in cms/api.py - About 1 hr to fix

                  Function _filterPluginsList has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _filterPluginsList: function _filterPluginsList(list, input) {
                          var items = list.find('.cms-submenu-item');
                          var titles = list.find('.cms-submenu-item-title');
                          var query = input.val();
                  
                  
                  Severity: Minor
                  Found in cms/static/cms/js/modules/cms.plugins.js - About 1 hr to fix

                    Function _paste has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _paste: function _paste(event) {
                            // hide helpers after we picked one
                            this._disablePaste();
                    
                            var copyFromId = this._getNodeId(
                    Severity: Minor
                    Found in cms/static/cms/js/modules/cms.pagetree.js - About 1 hr to fix

                      Function bindPlaceholderKeys has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      var bindPlaceholderKeys = function () {
                          keyboard.setContext('placeholders');
                          keyboard.bind('escape', function () {
                              $('.cms-structure .cms-dragarea').removeAttr('tabindex');
                              $('.cms-structure-content').untrap();
                      Severity: Minor
                      Found in cms/static/cms/js/modules/shortcuts/placeholders.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if (parentItem != null
                                        && nextItem == null
                                        && ! (o.protectRoot && parentItem[0].parentNode == this.element[0])
                                        &&
                                            (o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth())
                        Severity: Critical
                        Found in cms/static/cms/js/modules/jquery.ui.nestedsortable.js - About 1 hr to fix

                          Function initContainerWidth has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  initContainerWidth: function () {
                                      function resolveContainerWidth() {
                                          var style, attrs, matches, i, l, attr;
                          
                                          if (this.opts.width === "off") {
                          Severity: Minor
                          Found in cms/static/cms/js/select2/select2.js - About 1 hr to fix

                            Function loadMoreIfNeeded has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    loadMoreIfNeeded: function () {
                                        var results = this.results,
                                            more = results.find("li.select2-more-results"),
                                            below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible
                                            page = this.resultsPage + 1,
                            Severity: Minor
                            Found in cms/static/cms/js/select2/select2.js - About 1 hr to fix

                              Function _setAjaxPost has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  _setAjaxPost: function _setAjaxPost(trigger) {
                                      var that = this;
                              
                                      this.ui.container.on(this.click, trigger, function(e) {
                                          e.preventDefault();
                              Severity: Minor
                              Found in cms/static/cms/js/modules/cms.pagetree.js - About 1 hr to fix

                                Function onSelect has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        onSelect: function (data, options) {
                                
                                            if (!this.triggerSelect(data) || data.text === "") { return; }
                                
                                            this.addSelectedChoice(data);
                                Severity: Minor
                                Found in cms/static/cms/js/select2/select2.js - About 1 hr to fix

                                  Function getFocusableElementsInContainer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      function getFocusableElementsInContainer(container) {
                                          var $container = $(container);
                                          var result = [],
                                              cnt = 0;
                                  
                                  
                                  Severity: Minor
                                  Found in cms/static/cms/js/modules/jquery.trap.js - About 1 hr to fix

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

                                        def render_page_placeholder(self, slot, context, inherit,
                                                                    page=None, nodelist=None, editable=True):
                                            if not self.current_page:
                                                # This method should only be used when rendering a cms page.
                                                return ''
                                    Severity: Minor
                                    Found in cms/plugin_rendering.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 __init__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def __init__(self, *args, **kwargs):
                                            super().__init__(*args, **kwargs)
                                            user = get_current_user() # current user from threadlocals
                                            site = Site.objects.get_current()
                                            sub_users = get_subordinate_users(user, site)
                                    Severity: Minor
                                    Found in cms/admin/forms.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 _preload_placeholders_for_page has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def _preload_placeholders_for_page(self, page, slots=None, inherit=False):
                                            """
                                            Populates the internal plugin cache of each placeholder
                                            in the given page if the placeholder has not been
                                            previously cached.
                                    Severity: Minor
                                    Found in cms/plugin_rendering.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language