jekyll/jekyll

View on GitHub

Showing 50 of 50 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 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 298 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 3 hrs to fix

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

        require "thread"
        
        module Jekyll
          module Commands
            class Serve < Command
        Severity: Minor
        Found in lib/jekyll/commands/serve.rb - About 2 hrs to fix

          File configuration.rb has 284 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 site.rb has 279 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "csv"
            
            module Jekyll
              class Site
                attr_reader   :source, :dest, :config
            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

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

                    Class Serve has 21 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        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
                          # state since Serve is just called via class methods instead of an instance
                          # being created each time.
                    Severity: Minor
                    Found in lib/jekyll/commands/serve.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 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 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 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 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 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 read has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def read
                              return unless site.theme && site.theme.assets_path
                        
                              Find.find(site.theme.assets_path) do |path|
                                next if File.directory?(path)
                        Severity: Minor
                        Found in lib/jekyll/readers/theme_assets_reader.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 parse_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def parse_options(input)
                                options = {}
                                unless input.empty?
                                  # Split along 3 possible forms -- key="<quoted list>", key=value, or key
                                  input.scan(%r!(?:\w="[^"]*"|\w=\w|\w)+!) do |opt|
                        Severity: Minor
                        Found in lib/jekyll/tags/highlight.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

                        Severity
                        Category
                        Status
                        Source
                        Language