kigster/turnstile-rb

View on GitHub

Showing 15 of 15 total issues

Method parse has 115 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def parse
begin
OptionParser.new do |opts|
opts.banner = ' '
 
 
Severity: Major
Found in lib/turnstile/cli/parser.rb - About 4 hrs to fix

    Method launch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def launch
    launch_sinatra_app if options[:web]
    launch_signal_handler
     
    tdb "config: #{config.to_h}" if Turnstile.config.trace
    Severity: Minor
    Found in lib/turnstile/cli/launcher.rb - About 2 hrs to fix

    Method method_missing has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def method_missing(m, *args, &block)
    if redis.respond_to?(m)
    t1 = Time.now
    result = redis.send(m, *args, &block)
    delta = Time.now - t1
    Severity: Minor
    Found in lib/turnstile/redis/spy.rb - About 1 hr to fix

    Method parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse
    begin
    OptionParser.new do |opts|
    opts.banner = ' '
     
     
    Severity: Minor
    Found in lib/turnstile/cli/parser.rb - About 1 hr to fix

    Method read has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def read(&_block)
    file.tail do |line|
    token = matcher.tokenize(line) if matcher
    yield(token) if block_given? && token
    break if stopping?
    Severity: Minor
    Found in lib/turnstile/collector/log_reader.rb - About 1 hr to fix

    Method execute! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def execute!
    exit_code = begin
    Colored2.disable! unless stdout.tty?
     
    $stderr = stderr
    Severity: Minor
    Found in lib/turnstile/cli/runner.rb - About 1 hr to fix

    Method _logging has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _logging(level = :info, *args, &_block)
    message = args.join(' ')
     
    log(level, message) unless block_given?
    return unless block_given?
    Severity: Minor
    Found in lib/turnstile/logger/provider.rb - About 1 hr to fix

    Method execute! has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def execute!
    exit_code = begin
    Colored2.disable! unless stdout.tty?
     
    $stderr = stderr
    Severity: Minor
    Found in lib/turnstile/cli/runner.rb - About 1 hr to fix

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

      def with_retries(tries = 3)
      yield(tries)
      rescue Errno::EINVAL => e
      on_error e
      rescue ::Redis::BaseConnectionError => e
      Severity: Minor
      Found in lib/turnstile/redis/connection.rb - About 55 mins to fix

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

      def start
      self.thread = create_thread(self, sleep_when_idle) do |actor, sleep_period|
      loop do
      items_remaining = actor.execute
      break if actor.stopping?
      Severity: Minor
      Found in lib/turnstile/collector/actor.rb - About 55 mins to fix

      Method build_string has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def build_string(data,
      joiner = "\n",
      prefix = nil,
      suffix = nil,
      &_block)
      Severity: Minor
      Found in lib/turnstile/commands/show.rb - About 35 mins to fix

        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
        Severity: Minor
        Found in lib/turnstile/cli/runner.rb - About 35 mins to fix

          Method execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def execute
          self.read do |token|
          self.queue << token if token
          end
          rescue IOError
          Severity: Minor
          Found in lib/turnstile/collector/log_reader.rb - About 25 mins to fix

          Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def initialize(*args)
          self.options = args.last.is_a?(Hash) ? args.pop : {}
           
          options.verbose ? Turnstile::Logger.enable : Turnstile::Logger.disable
           
           
          Severity: Minor
          Found in lib/turnstile/collector/controller.rb - About 25 mins to fix

          Method method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def method_missing(method, *args, &block)
          return super unless method.to_s =~ /^redis_/
          prop = method.to_s.gsub(/^redis_/, '').to_sym
          if self.redis.respond_to?(prop)
          prop.to_s.end_with?('=') ? self.redis.send(prop, *args, &block) : self.redis.send(prop)
          Severity: Minor
          Found in lib/turnstile/configuration.rb - About 25 mins to fix
          Severity
          Category
          Status
          Source
          Language