<commit_before>require 'sensu/base'
require 'thin'
require 'sinatra/async'
require 'em-http-request'
require 'slim'
require 'sass'

module Sensu
  class Dashboard < Sinatra::Base
    register Sinatra::Async

    class << self
      def run(options={})
        EM::run do
          setup(options)
          start
          trap_signals
        end
      end

      def invalid_settings(reason, details={})
        $logger.fatal('invalid settings', {
          :reason => reason
        }.merge(details))
        $logger.fatal('SENSU DASHBOARD NOT RUNNING!')
        exit 2
      end

      def setup(options={})
        $logger = Sensu::Logger.get
        base = Sensu::Base.new(options)
        $settings = base.settings
        unless $settings[:dashboard].is_a?(Hash)
          invalid_settings('missing dashboard configuration')
        end
        unless $settings[:dashboard][:port].is_a?(Integer)
          invalid_settings('dashboard must have a port', {
            :dashboard => $settings[:dashboard]
          })
        end
        unless $settings[:dashboard][:user].is_a?(String) && $settings[:dashboard][:password].is_a?(String)
          invalid_settings('dashboard must have a user and password', {
            :dashboard => $settings[:dashboard]
          })<commit_msg>[fixes] invalid settings details hash has :settings<commit_after>require 'sensu/base'
require 'thin'
require 'sinatra/async'
require 'em-http-request'
require 'slim'
require 'sass'

module Sensu
  class Dashboard < Sinatra::Base
    register Sinatra::Async

    class << self
      def run(options={})
        EM::run do
          setup(options)
          start
          trap_signals
        end
      end

      def invalid_settings(reason, details={})
        $logger.fatal('invalid settings', {
          :reason => reason
        }.merge(details))
        $logger.fatal('SENSU DASHBOARD NOT RUNNING!')
        exit 2
      end

      def setup(options={})
        $logger = Sensu::Logger.get
        base = Sensu::Base.new(options)
        $settings = base.settings
        unless $settings[:dashboard].is_a?(Hash)
          invalid_settings('missing dashboard configuration')
        end
        unless $settings[:dashboard][:port].is_a?(Integer)
          invalid_settings('dashboard must have a port', {
            :settings => $settings[:dashboard]
          })
        end
        unless $settings[:dashboard][:user].is_a?(String) && $settings[:dashboard][:password].is_a?(String)
          invalid_settings('dashboard must have a user and password', {
            :settings => $settings[:dashboard]
          })
{'fraction_non_alphanumeric': 0.12145593869731801, 'fraction_numerical': 0.0007662835249042146, 'mean_word_length': 2.4220183486238533, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3713288', 'n_tokens_mistral': 731, 'n_tokens_neox': 737, 'n_words': 168}