Showing 28 of 28 total issues
Function Run
has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring. Open
func Run(args []string, input io.Reader, output *os.File, stderr *os.File) int {
if os.Getenv("RAILS_ENV") != "" {
println("Warning: Specifying a Rails environment via RAILS_ENV has no effect for commands run with zeus.")
println("As a safety precaution to protect you from nuking your development database,")
println("Zeus will now cowardly refuse to proceed. Please unset RAILS_ENV and try again.")
- Read upRead up
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
Function Run
has 140 lines of code (exceeds 50 allowed). Consider refactoring. Open
func Run(args []string, input io.Reader, output *os.File, stderr *os.File) int {
if os.Getenv("RAILS_ENV") != "" {
println("Warning: Specifying a Rails environment via RAILS_ENV has no effect for commands run with zeus.")
println("As a safety precaution to protect you from nuking your development database,")
println("Zeus will now cowardly refuse to proceed. Please unset RAILS_ENV and try again.")
Class Rails
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Rails < Plan
def after_fork
reconnect_activerecord
restart_girl_friday
reconnect_redis
SlaveNode
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
type SlaveNode struct {
ProcessTreeNode
socket *unixsocket.Usock
pid int
Error string
Function main
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func main() {
args := os.Args[1:]
configFile := "zeus.json"
simpleStatus := false
fileChangeDelay := filemonitor.DefaultFileChangeDelay
- Read upRead up
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 boot_steps
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def boot_steps(identifier)
while true
boot_step = catch(:boot_step) do
$0 = "zeus slave: #{identifier}"
- Read upRead up
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 run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def run
@zeus_connection = spawn_zeus_connection
@file_monitor = spawn_file_monitor
ui.info("Connected to zeus, watching for changes...")
- Read upRead up
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
Function main
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
args := os.Args[1:]
configFile := "zeus.json"
simpleStatus := false
fileChangeDelay := filemonitor.DefaultFileChangeDelay
Method suites
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def suites
# Since we're not using `ruby -Itest -Ilib` to run the tests, we need to add this directory to the `LOAD_PATH`
$:.unshift "./test", "./lib"
if framework == :testunit1
Method boot_steps
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def boot_steps(identifier)
while true
boot_step = catch(:boot_step) do
$0 = "zeus slave: #{identifier}"
Method run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
@zeus_connection = spawn_zeus_connection
@file_monitor = spawn_file_monitor
ui.info("Connected to zeus, watching for changes...")
Method _monkeypatch_rake
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _monkeypatch_rake
if version = gem_is_bundled?('rake')
gem 'rake', version
end
require 'rake/testtask'
Method fsEventsMonitor.handleAdd
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (f *fsEventsMonitor) handleAdd() {
watched := make(map[string]bool)
started := false
// We don't want to add individual files to watch here but figure out the
// directory to watch and watch it instead.
- Read upRead up
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 command
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def command(identifier, sock)
$0 = "zeus runner: #{identifier}"
Process.setsid
local, remote = UNIXSocket.pair(:DGRAM)
Function Run
has 14 return statements (exceeds 4 allowed). Open
func Run(args []string, input io.Reader, output *os.File, stderr *os.File) int {
if os.Getenv("RAILS_ENV") != "" {
println("Warning: Specifying a Rails environment via RAILS_ENV has no effect for commands run with zeus.")
println("As a safety precaution to protect you from nuking your development database,")
println("Zeus will now cowardly refuse to proceed. Please unset RAILS_ENV and try again.")
Method test
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def test(argv=ARGV)
# if there are two test frameworks and one of them is RSpec,
# then "zeus test/rspec/testrb" without arguments runs the
# RSpec suite by default.
if using_rspec?(argv)
- Read upRead up
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
Avoid deeply nested control flow statements. Open
} else if args[0] == "init" {
zeusInit()
} else if args[0] == "commands" {
zeusCommands(configFile)
} else {
Method console
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def console
if rails_5_1_or_higher?
run_rails_5_1_or_higher_command('console')
else
require 'rails/commands/console'
- Read upRead up
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
Function StartSlaveMonitor
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func StartSlaveMonitor(tree *ProcessTree, fileChanges <-chan []string, done chan bool) chan bool {
quit := make(chan bool)
go func() {
localMasterFile, remoteMasterFile, err := unixsocket.Socketpair(syscall.SOCK_DGRAM)
if err != nil {
- Read upRead up
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 build_test_arguments
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_test_arguments
if @line
abort_with_no_test_found_by_line_number if @tests_to_run.empty?
# assemble the regexp to run these tests,
- Read upRead up
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"