jekyll/jekyll

View on GitHub

Showing 85 issues of 85 total

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

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

            if ((index = url.indexOf('#')) >= 0) {
              hash = url.slice(index);
              url = url.slice(0, index);
            } else {
              hash = '';
        Severity: Major
        Found in lib/jekyll/commands/serve/livereload_assets/livereload.js and 1 other location - About 1 hr to fix
        lib/jekyll/commands/serve/livereload_assets/livereload.js on lines 656..661

        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 65.

        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

            if ((index = url.indexOf('?')) >= 0) {
              params = url.slice(index);
              url = url.slice(0, index);
            } else {
              params = '';
        Severity: Major
        Found in lib/jekyll/commands/serve/livereload_assets/livereload.js and 1 other location - About 1 hr to fix
        lib/jekyll/commands/serve/livereload_assets/livereload.js on lines 650..655

        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 65.

        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

        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 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 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 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 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 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 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

                      Severity
                      Category
                      Status