linkodehub/nand

View on GitHub

Showing 12 of 12 total issues

Method monitor has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def monitor
    spec_dir = @spec_dir
    FSSM.monitor(@monitoring_dir, "**/*") do
      create do |dir, file|
        if file =~/\.rb$/
Severity: Minor
Found in samples/spec_mon.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 ready? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def ready?
        [@exec_stdout, @exec_stderr].each do |out|
          next if out.is_a? IO
          path = Pathname.new(out)
          raise "Illegal Output File #{path.to_s}" unless (path.exist? and path.writable?) or
Severity: Minor
Found in lib/nand/launcher.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 daemonize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def daemonize( &block )
      if child = Process.fork
        Process.waitpid(child) # wait until exit child process
        return child
      end
Severity: Minor
Found in lib/nand/daemon.rb - About 1 hr to fix

    Method executor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.executor(*argv)
        top_dir  = Pathname.new(argv.shift || Dir.pwd).expand_path
        lib_dir  = top_dir.join("lib")
        spec_dir = top_dir.join("spec")
    
    
    Severity: Minor
    Found in samples/spec_mon.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 stop has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def stop(target = nil)
          dir = run_dir(options)
          log_debug! if options[:debug]
          ds = if options[:all]
                 Daemon.all_runnings
    Severity: Minor
    Found in lib/nand/cli.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 monitor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def monitor
        spec_dir = @spec_dir
        FSSM.monitor(@monitoring_dir, "**/*") do
          create do |dir, file|
            if file =~/\.rb$/
    Severity: Minor
    Found in samples/spec_mon.rb - About 1 hr to fix

      Method daemonize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def daemonize( &block )
            if child = Process.fork
              Process.waitpid(child) # wait until exit child process
              return child
            end
      Severity: Minor
      Found in lib/nand/daemon.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

      Method restore_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def restore_options( options )
          opts = options.dup
          unless opts[:debug]
            opts[:out] &&= string_to_stdio(opts[:out])
            opts[:err] &&= string_to_stdio(opts[:err])
      Severity: Minor
      Found in lib/nand.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 status_message has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def status_message(dir, target, running, pid = nil, user = nil)
      Severity: Minor
      Found in lib/nand/cli.rb - About 35 mins to fix

        Method launchable? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.launchable?(target, io, opts)
                file = exec_file(target)
                raise "Not Found #{file.to_s}"  unless file.exist?
                raise "Not Executable #{file.to_s}" unless file.executable?
                true
        Severity: Minor
        Found in lib/nand/launcher/executable_file_launcher.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_with_signal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def stop_with_signal(signal)
              raise "Can Not Send #{signal.to_s.capitalize} Signal to #{@execname}" unless uid == Process.uid or uid == 0
              unless running?
                @pid_file.delete if @pid_file.exist?
                raise "#{@execname} is Not Running"
        Severity: Minor
        Found in lib/nand/daemon.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 launchable? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.launchable?( target, io, opts )
                specs = Gem::Specification.find_all do |s|
                  s.name =~/^(nand-)*#{target}$/ and s.dependencies.find{ |d| d.name == "nand" }
                end
                raise "Not Found #{target} in Installed gems" if specs.empty?
        Severity: Minor
        Found in lib/nand/launcher/plugin_launcher.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