jekyll/jekyll

View on GitHub

Showing 48 of 58 total issues

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

    def read
      return unless 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 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_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 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 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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def sort(input, property = nil, nils = "first")
          raise ArgumentError, "Cannot sort a null object." if input.nil?
          if property.nil?
            input.sort
          else
    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 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 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 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 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 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 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 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 read has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def read
          filtered_entries.each do |file_path|
            full_path = collection_dir(file_path)
            next if File.directory?(full_path)
            if Utils.has_yaml_header? full_path
    Severity: Minor
    Found in lib/jekyll/collection.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

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

            def init_with_program(prog)
              prog.command(:help) do |c|
                c.syntax "help [subcommand]"
                c.description "Show the help message, optionally for a given subcommand."
    
    
    Severity: Minor
    Found in lib/jekyll/commands/help.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