jekyll/jekyll

View on GitHub

Showing 54 of 54 total issues

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)

      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

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

    def read_yaml(base, name, opts = {})
      filename = File.join(base, name)

      begin
        self.content = File.read(@path || site.in_source_dir(base, name),
Severity: Minor
Found in lib/jekyll/convertible.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 glob_include? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def glob_include?(enum, entry)
      entry_path = Pathutil.new(site.in_source_dir).join(entry)
      enum.any? do |exp|
        # Users who send a Regexp knows what they want to
        # exclude, so let them send a Regexp to exclude files,
Severity: Minor
Found in lib/jekyll/entry_filter.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 load_cached_partial has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def load_cached_partial(path, context)
        context.registers[:cached_partials] ||= {}
        cached_partial = context.registers[:cached_partials]

        if cached_partial.key?(path)
Severity: Minor
Found in lib/jekyll/tags/include.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 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

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(site, base, dir, name, collection = nil)
Severity: Minor
Found in lib/jekyll/static_file.rb - About 35 mins to fix

    Method bundle_install has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def bundle_install(path)
              Jekyll.logger.info "Running bundle install in #{path.cyan}..."
              Dir.chdir(path) do
                exe = Gem.bin_path("bundler", "bundle")
                process, output = Jekyll::Utils::Exec.run("ruby", exe, "install")
    Severity: Minor
    Found in lib/jekyll/commands/new.rb - About 35 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 fetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def fetch(key, default = nil, &block)
            return self[key] if key?(key)
            raise KeyError, %(key not found: "#{key}") if default.nil? && block.nil?
            return yield(key) unless block.nil?
            return default unless default.nil?
    Severity: Minor
    Found in lib/jekyll/drops/drop.rb - About 35 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 require_theme_deps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def require_theme_deps
          return false unless site.theme.runtime_dependencies
          site.theme.runtime_dependencies.each do |dep|
            next if dep.name == "jekyll"
            External.require_with_graceful_fail(dep.name) if plugin_allowed?(dep.name)
    Severity: Minor
    Found in lib/jekyll/plugin_manager.rb - About 35 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 place_in_layouts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def place_in_layouts(content, payload, info)
          output = content.dup
          layout = layouts[document.data["layout"].to_s]
          validate_layout(layout)
    
    
    Severity: Minor
    Found in lib/jekyll/renderer.rb - About 35 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 start_callback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def start_callback(detached)
              unless detached
                proc do
                  mutex.synchronize do
                    # Block until EventMachine reactor starts
    Severity: Minor
    Found in lib/jekyll/commands/serve.rb - About 35 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 regenerate? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def regenerate?(document)
          return true if disabled
          case document
          when Page
            regenerate_page?(document)
    Severity: Minor
    Found in lib/jekyll/regenerator.rb - About 35 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 applies_path? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def applies_path?(scope, path)
          return true if !scope.key?("path") || scope["path"].empty?
    
          sanitized_path = Pathname.new(sanitize_path(path))
          site_path      = Pathname.new(@site.source)
    Severity: Minor
    Found in lib/jekyll/frontmatter_defaults.rb - About 35 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 sort_by_property_directly has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def sort_by_property_directly(docs, meta_key)
      docs.sort! do |apple, orange|
        apple_property = apple[meta_key]
        orange_property = orange[meta_key]
    
    
    Severity: Minor
    Found in benchmark/schwartzian_transform.rb - About 35 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_dependency has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_dependency(path, dependency)
          return if metadata[path].nil? || disabled
    
          unless metadata[path]["deps"].include? dependency
            metadata[path]["deps"] << dependency
    Severity: Minor
    Found in lib/jekyll/regenerator.rb - About 35 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 sort has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def sort(input, property = nil, nils = "first")
          if input.nil?
            raise ArgumentError, "Cannot sort a null object."
          end
          if property.nil?
    Severity: Minor
    Found in lib/jekyll/filters.rb - About 35 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 stop_callback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def stop_callback(detached)
              unless detached
                proc do
                  mutex.synchronize do
                    unless @reload_reactor.nil?
    Severity: Minor
    Found in lib/jekyll/commands/serve.rb - About 35 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 schwartzian_transform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def schwartzian_transform(docs, meta_key)
      docs.collect! { |d|
        [d[meta_key], d]
      }.sort! { |apple, orange|
        if !apple[0].nil? && !orange[0].nil?
    Severity: Minor
    Found in benchmark/schwartzian_transform.rb - About 35 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 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def parse_options(input)
            options = {}
            return options if input.empty?
    
            # Split along 3 possible forms -- key="<quoted list>", key=value, or key
    Severity: Minor
    Found in lib/jekyll/tags/highlight.rb - About 25 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