publify/publify

View on GitHub

Showing 101 of 238 total issues

Function show has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Collapse.prototype.show = function () {
    if (this.transitioning || this.$element.hasClass('in')) return

    var activesData
    var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
Severity: Minor
Found in publify_core/app/assets/javascripts/bootstrap/collapse.js - About 1 hr to fix

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

      Modal.prototype.show = function (_relatedTarget) {
        var that = this
        var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
    
        this.$element.trigger(e)
    Severity: Minor
    Found in themes/bootstrap-2/javascripts/bootstrap.js - About 1 hr to fix

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

          var EventTarget = function() {
              var eventSplitter = /\s+/;
              return {
                  on: function(events, callback) {
                      var event;
      Severity: Minor
      Found in publify_core/app/assets/javascripts/typeahead.js - About 1 hr to fix

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

          Modal.prototype.backdrop = function (callback) {
            var that = this
            var animate = this.$element.hasClass('fade') ? 'fade' : ''
        
            if (this.isShown && this.options.backdrop) {
        Severity: Minor
        Found in themes/bootstrap-2/javascripts/bootstrap.js - About 1 hr to fix

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

                      initialize: function(datasetDefs) {
                          var datasets;
                          datasetDefs = utils.isArray(datasetDefs) ? datasetDefs : [ datasetDefs ];
                          if (datasetDefs.length === 0) {
                              $.error("no datasets provided");
          Severity: Minor
          Found in publify_core/app/assets/javascripts/typeahead.js - About 1 hr to fix

            Method bulkops has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def bulkops
                ids = (params[:feedback_check] || {}).keys.map(&:to_i)
                items = Feedback.find(ids)
                @unexpired = true
            
            
            Severity: Minor
            Found in publify_core/app/controllers/admin/feedback_controller.rb - About 1 hr to fix

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

                          _loadPrefetchData: function(o) {
                              var that = this, thumbprint = VERSION + (o.thumbprint || ""), storedThumbprint, storedProtocol, storedItemHash, storedAdjacencyList, isExpired, deferred;
                              if (this.storage) {
                                  storedThumbprint = this.storage.get(keys.thumbprint);
                                  storedProtocol = this.storage.get(keys.protocol);
              Severity: Minor
              Found in publify_core/app/assets/javascripts/typeahead.js - About 1 hr to fix

                Method create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create
                    note = new_note
                
                    note.state = "published"
                    note.attributes = params[:note].permit!
                Severity: Minor
                Found in publify_core/app/controllers/admin/notes_controller.rb - 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

                Method delta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.delta(year = nil, month = nil, day = nil)
                    return nil if year.nil? && month.nil? && day.nil?
                
                    year = year.to_i unless year.nil?
                    month = month.to_i unless month.nil?
                Severity: Minor
                Found in publify_core/lib/publify_time.rb - 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 _getLocalSuggestions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            _getLocalSuggestions: function(terms) {
                                var that = this, firstChars = [], lists = [], shortestList, suggestions = [];
                                utils.each(terms, function(i, term) {
                                    var firstChar = term.charAt(0);
                                    !~utils.indexOf(firstChars, firstChar) && firstChars.push(firstChar);
                Severity: Minor
                Found in publify_core/app/assets/javascripts/typeahead.js - About 1 hr to fix

                  Function applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Tooltip.prototype.applyPlacement = function (offset, placement) {
                      var $tip   = this.tip()
                      var width  = $tip[0].offsetWidth
                      var height = $tip[0].offsetHeight
                  
                  
                  Severity: Minor
                  Found in themes/bootstrap-2/javascripts/bootstrap.js - About 1 hr to fix

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

                      Affix.prototype.checkPosition = function () {
                        if (!this.$element.is(':visible')) return
                    
                        var scrollHeight = $(document).height()
                        var scrollTop    = this.$target.scrollTop()
                    Severity: Minor
                    Found in themes/bootstrap-2/javascripts/bootstrap.js - About 1 hr to fix

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

                        Tab.prototype.show = function () {
                          var $this    = this.element
                          var $ul      = $this.closest('ul:not(.dropdown-menu)')
                          var selector = $this.data('target')
                      
                      
                      Severity: Minor
                      Found in publify_core/app/assets/javascripts/bootstrap/tab.js - About 1 hr to fix

                        Function show has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          Collapse.prototype.show = function () {
                            if (this.transitioning || this.$element.hasClass('in')) return
                        
                            var startEvent = $.Event('show.bs.collapse')
                            this.$element.trigger(startEvent)
                        Severity: Minor
                        Found in themes/bootstrap-2/javascripts/bootstrap.js - About 1 hr to fix

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

                            Affix.prototype.checkPosition = function () {
                              if (!this.$element.is(':visible')) return
                          
                              var height       = this.$element.height()
                              var offset       = this.options.offset
                          Severity: Minor
                          Found in publify_core/app/assets/javascripts/bootstrap/affix.js - About 1 hr to fix

                            Method macrofilter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def self.macrofilter(attrib, _text = "")
                                    img = attrib["img"]
                                    size = attrib["size"] || "square"
                                    style = attrib["style"]
                                    caption = attrib["caption"]
                            Severity: Minor
                            Found in lib/publify_textfilter_flickr.rb - About 1 hr to fix

                              Method extract_params has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def extract_params(path, format)
                                  specs = format.split("/")
                                  specs.delete("")
                                  parts = path.split("/")
                                  parts.delete("")
                              Severity: Minor
                              Found in publify_core/app/models/article/factory.rb - 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

                              Method substitute_item has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def substitute_item(str, item)
                                  # Tags for item
                                  str = str.gsub("%title%", item.title) if str =~ /%title/ && item.respond_to?(:title)
                                  str = str.gsub("%excerpt%", item.excerpt_text) if str =~ /%excerpt%/ && item.respond_to?(:excerpt_text)
                                  str = str.gsub("%description%", item.description) if str =~ /%description%/ && item.respond_to?(:description)
                              Severity: Minor
                              Found in publify_core/app/services/title_builder.rb - 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

                              Method search_with has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def self.search_with(params)
                                  params ||= {}
                                  scoped = unscoped
                                  scoped = scoped.searchstring(params[:searchstring]) if params[:searchstring].present?
                              
                              
                              Severity: Minor
                              Found in publify_core/app/models/content.rb - 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 buildDomStructure has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      function buildDomStructure(input) {
                                          var $wrapper = $(html.wrapper), $dropdown = $(html.dropdown), $input = $(input), $hint = $(html.hint);
                                          $wrapper = $wrapper.css(css.wrapper);
                                          $dropdown = $dropdown.css(css.dropdown);
                                          $hint.css(css.hint).css({
                              Severity: Minor
                              Found in publify_core/app/assets/javascripts/typeahead.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language