jekyll/jekyll

View on GitHub

Showing 51 of 59 total issues

Class Document has 54 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Document
    include Comparable
    extend Forwardable

    attr_reader :path, :site, :extname, :collection
Severity: Major
Found in lib/jekyll/document.rb - About 7 hrs to fix

    Class Site has 43 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Site
        attr_reader   :source, :dest, :config
        attr_accessor :layouts, :pages, :static_files, :drafts,
                      :exclude, :include, :lsi, :highlighter, :permalink_style,
                      :time, :future, :unpublished, :safe, :plugins, :limit_posts,
    Severity: Minor
    Found in lib/jekyll/site.rb - About 5 hrs to fix

      File document.rb has 283 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Jekyll
        class Document
          include Comparable
          extend Forwardable
      
      
      Severity: Minor
      Found in lib/jekyll/document.rb - About 2 hrs to fix

        File site.rb has 278 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Jekyll
          class Site
            attr_reader   :source, :dest, :config
            attr_accessor :layouts, :pages, :static_files, :drafts,
                          :exclude, :include, :lsi, :highlighter, :permalink_style,
        Severity: Minor
        Found in lib/jekyll/site.rb - About 2 hrs to fix

          Class Configuration has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Configuration < Hash
              # Default options. Overridden by values in _config.yml.
              # Strings rather than symbols are used for compatibility with YAML.
              DEFAULTS = Configuration[{
                # Where things are
          Severity: Minor
          Found in lib/jekyll/configuration.rb - About 2 hrs to fix

            File configuration.rb has 273 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Jekyll
              class Configuration < Hash
                # Default options. Overridden by values in _config.yml.
                # Strings rather than symbols are used for compatibility with YAML.
                DEFAULTS = Configuration[{
            Severity: Minor
            Found in lib/jekyll/configuration.rb - About 2 hrs to fix

              File serve.rb has 272 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Jekyll
                module Commands
                  class Serve < Command
                    # Similar to the pattern in Utils::ThreadEvent except we are maintaining the
                    # state of @running instead of just signaling an event.  We have to maintain this
              Severity: Minor
              Found in lib/jekyll/commands/serve.rb - About 2 hrs to fix

                Class Collection has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Collection
                    attr_reader :site, :label, :metadata
                    attr_writer :docs
                
                    # Create a new Collection.
                Severity: Minor
                Found in lib/jekyll/collection.rb - About 2 hrs to fix

                  Class Renderer has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class Renderer
                      attr_reader :document, :site
                      attr_writer :layouts, :payload
                  
                      def initialize(site, document, site_payload = nil)
                  Severity: Minor
                  Found in lib/jekyll/renderer.rb - About 2 hrs 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

                    Method slugify has a Cognitive Complexity of 12 (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 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

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

                          def calculate(timezone)
                            External.require_with_graceful_fail("tzinfo") unless defined?(TZInfo)
                            tz = TZInfo::Timezone.get(timezone)
                            difference = Time.now.to_i - tz.now.to_i
                            #
                    Severity: Minor
                    Found in lib/jekyll/utils/win_tz.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 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 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

                      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 where has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def where(input, property, value)
                            return input if property.nil? || value.nil?
                            return input unless input.respond_to?(:select)
                      
                            input    = input.values if input.is_a?(Hash)
                      Severity: Minor
                      Found in lib/jekyll/filters.rb - About 55 mins 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 hash_for_json has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def hash_for_json(state = nil)
                              to_h.tap do |hash|
                                if state && state.depth >= 2
                                  hash["previous"] = collapse_document(hash["previous"]) if hash["previous"]
                                  hash["next"]     = collapse_document(hash["next"]) if hash["next"]
                      Severity: Minor
                      Found in lib/jekyll/drops/document_drop.rb - About 55 mins 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_publishable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def read_publishable(dir, magic_dir, matcher)
                            read_content(dir, magic_dir, matcher).tap { |docs| docs.each(&:read) }
                              .select do |doc|
                                if doc.content.valid_encoding?
                                  site.publisher.publish?(doc).tap do |will_publish|
                      Severity: Minor
                      Found in lib/jekyll/readers/post_reader.rb - About 45 mins 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