jekyll/jekyll

View on GitHub
lib/jekyll/commands/serve.rb

Summary

Maintainability
B
5 hrs
Test Coverage

File serve.rb has 283 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

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

    There are no issues that match your filters.

    Category
    Status