jekyll/jekyll

View on GitHub

Showing 47 of 58 total issues

Class Site has 42 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 282 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

      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 site.rb has 273 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

          File configuration.rb has 272 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 267 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 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 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 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 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 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 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 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)
                          input_id = input.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 add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def add(severity, message = nil, progname = nil)
                          severity ||= UNKNOWN
                          @logdev = logdevice(severity)
                    
                          return true if @logdev.nil? || severity < @level
                    Severity: Minor
                    Found in lib/jekyll/stevenson.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

                    Method init_with_program has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def init_with_program(prog)
                              prog.command(:serve) do |cmd|
                                cmd.description "Serve your site locally"
                                cmd.syntax "serve [options]"
                                cmd.alias :server
                    Severity: Minor
                    Found in lib/jekyll/commands/serve.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