jekyll/jekyll

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

Summary

Maintainability
C
7 hrs
Test Coverage
B
83%

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

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