jekyll/jekyll

View on GitHub

Showing 73 of 84 total issues

Function e has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
Severity: Minor
Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 2 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 Connector has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function Connector(options, WebSocket, Timer, handlers) {
      this.options = options;
      this.WebSocket = WebSocket;
      this.Timer = Timer;
      this.handlers = handlers;
Severity: Minor
Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix

    Function 2 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    },{"./protocol":6}],2:[function(require,module,exports){
    (function() {
      var CustomEvents;
    
      CustomEvents = {
    Severity: Minor
    Found in lib/jekyll/commands/serve/livereload_assets/livereload.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 process has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        Parser.prototype.process = function(data) {
          var command, e, message, options, _ref;
          try {
            if (this.protocol == null) {
              if (data.match(/^!!ver:([\d.]+)$/)) {
    Severity: Minor
    Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix

      Function reattachStylesheetLink has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Reloader.prototype.reattachStylesheetLink = function(link) {
            var clone, parent;
            if (link.__LiveReload_pendingRemoval) {
              return;
            }
      Severity: Minor
      Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix

        Method merge! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def merge!(other)
                other.each_key do |key|
                  if block_given?
                    self[key] = yield key, self[key], other[key]
                  else
        Severity: Minor
        Found in lib/jekyll/drops/drop.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 reattachImportedRule has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            Reloader.prototype.reattachImportedRule = function(_arg) {
              var href, index, link, media, newRule, parent, rule, tempLink;
              rule = _arg.rule, index = _arg.index, link = _arg.link;
              parent = rule.parentStyleSheet;
              href = this.generateCacheBustUrl(rule.href);
        Severity: Minor
        Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix

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

          },{"./protocol":6}],2:[function(require,module,exports){
          (function() {
            var CustomEvents;
          
            CustomEvents = {
          Severity: Minor
          Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix

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

            },{"./customevents":2,"./less":3,"./livereload":4}],9:[function(require,module,exports){
            (function() {
              var Timer;
            
              exports.Timer = Timer = (function() {
            Severity: Minor
            Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix

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

                  def as_liquid(item)
                    case item
                    when Hash
                      pairs = item.map { |k, v| as_liquid([k, v]) }
                      Hash[pairs]
              Severity: Minor
              Found in lib/jekyll/filters.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 waitUntilCssLoads has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  Reloader.prototype.waitUntilCssLoads = function(clone, func) {
                    var callbackExecuted, executeCallback, poll;
                    callbackExecuted = false;
                    executeCallback = (function(_this) {
                      return function() {
              Severity: Minor
              Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix

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

                    Connector.prototype.connect = function() {
                      this._connectionDesired = true;
                      if (this._isSocketConnected()) {
                        return;
                      }
                Severity: Minor
                Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix

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

                      Reloader.prototype.reloadImages = function(path) {
                        var expando, img, selector, styleNames, styleSheet, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3, _results;
                        expando = this.generateUniqueString();
                        _ref = this.document.images;
                        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                  Severity: Minor
                  Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix

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

                            def dispatch(data)
                              parser = Http::Parser.new
                              parser << data
                    
                              # WebSockets requests will have a Connection: Upgrade header
                    Severity: Minor
                    Found in lib/jekyll/commands/serve/websockets.rb - About 1 hr to fix

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

                          def slugify(string, mode: nil, cased: false)
                            mode ||= "default"
                            return nil if string.nil?
                      
                            unless SLUGIFY_MODES.include?(mode)
                      Severity: Minor
                      Found in lib/jekyll/utils.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def render(context)
                              site = context.registers[:site]
                      
                              file = render_variable(context) || @file
                              validate_file_name(file)
                      Severity: Minor
                      Found in lib/jekyll/tags/include.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 read_data_to has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def read_data_to(dir, data)
                            return unless File.directory?(dir) && !@entry_filter.symlink?(dir)
                      
                            entries = Dir.chdir(dir) do
                              Dir["*.{yaml,yml,json,csv,tsv}"] + Dir["*"].select { |fn| File.directory?(fn) }
                      Severity: Minor
                      Found in lib/jekyll/readers/data_reader.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 validate_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def validate_options(opts)
                                if opts["livereload"]
                                  if opts["detach"]
                                    Jekyll.logger.warn "Warning:",
                                      "--detach and --livereload are mutually exclusive. Choosing --livereload"
                      Severity: Minor
                      Found in lib/jekyll/commands/serve.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 extract has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        Options.extract = function(document) {
                          var element, keyAndValue, m, mm, options, pair, src, _i, _j, _len, _len1, _ref, _ref1;
                          _ref = document.getElementsByTagName('script');
                          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                            element = _ref[_i];
                      Severity: Minor
                      Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix

                        Function reload has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            Reloader.prototype.reload = function(path, options) {
                              var plugin, _base, _i, _len, _ref;
                              this.options = options;
                              if ((_base = this.options).stylesheetReloadTimeout == null) {
                                _base.stylesheetReloadTimeout = 15000;
                        Severity: Minor
                        Found in lib/jekyll/commands/serve/livereload_assets/livereload.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language