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.")
Severity: Minor
Found in go/zeusclient/zeusclient.go - About 5 hrs 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

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.")
Severity: Major
Found in go/zeusclient/zeusclient.go - About 4 hrs to fix

    Class Rails has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Rails < Plan
        def after_fork
          reconnect_activerecord
          restart_girl_friday
          reconnect_redis
    Severity: Minor
    Found in rubygem/lib/zeus/rails.rb - About 2 hrs to fix

      SlaveNode has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type SlaveNode struct {
          ProcessTreeNode
          socket      *unixsocket.Usock
          pid         int
          Error       string
      Severity: Minor
      Found in go/processtree/slavenode.go - About 2 hrs to fix

        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
        Severity: Minor
        Found in go/cmd/zeus/zeus.go - About 2 hrs 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 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}"
        
        
        Severity: Minor
        Found in rubygem/lib/zeus.rb - About 2 hrs 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 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...")
        Severity: Minor
        Found in vagrant/lib/vagrant-zeus/commands/zeus-file-monitor.rb - About 2 hrs 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

        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
        Severity: Minor
        Found in go/cmd/zeus/zeus.go - About 1 hr to fix

          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
          Severity: Minor
          Found in rubygem/lib/zeus/m.rb - About 1 hr to fix

            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}"
            
            
            Severity: Minor
            Found in rubygem/lib/zeus.rb - About 1 hr to fix

              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...")
              Severity: Minor
              Found in vagrant/lib/vagrant-zeus/commands/zeus-file-monitor.rb - About 1 hr to fix

                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'
                Severity: Minor
                Found in rubygem/lib/zeus/rails.rb - About 1 hr to fix

                  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.
                  Severity: Minor
                  Found in go/filemonitor/filemonitor_darwin.go - 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 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)
                  Severity: Minor
                  Found in rubygem/lib/zeus.rb - About 1 hr to fix

                    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.")
                    Severity: Major
                    Found in go/zeusclient/zeusclient.go - About 1 hr to fix

                      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)
                      Severity: Minor
                      Found in rubygem/lib/zeus/rails.rb - About 55 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

                      Avoid deeply nested control flow statements.
                      Open

                          } else if args[0] == "init" {
                              zeusInit()
                          } else if args[0] == "commands" {
                              zeusCommands(configFile)
                          } else {
                      Severity: Major
                      Found in go/cmd/zeus/zeus.go - About 45 mins to fix

                        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'
                        Severity: Minor
                        Found in rubygem/lib/zeus/rails.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

                        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 {
                        Severity: Minor
                        Found in go/processtree/slavemonitor.go - 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 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,
                        Severity: Minor
                        Found in rubygem/lib/zeus/m.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

                        Severity
                        Category
                        Status
                        Source
                        Language