<commit_before>require 'sinatra'
require 'rack-ssl-enforcer'
require 'haml'
require 'json'
require 'sinatra_auth_github'

module Tasseo
  class Web < Sinatra::Base

    configure do
      enable :logging
      enable :sessions
      mime_type :js, 'text/javascript'
      use Rack::SslEnforcer if ENV['FORCE_HTTPS']
      use Rack::Static, :urls => ['/dashboards/']

      set :session_secret, ENV['SESSION_SECRET'] || Digest::SHA1.hexdigest(Time.now.to_f.to_s)

      if ENV['GITHUB_AUTH_ORGANIZATION']
        set :github_options, { :scopes => "user" }

        register Sinatra::Auth::Github
      end
    end

    before do
      if organization = ENV['GITHUB_AUTH_ORGANIZATION']
        github_organization_authenticate!(organization) unless request.path == '/health'
      end
<commit_msg>team github<commit_after>require 'sinatra'
require 'rack-ssl-enforcer'
require 'haml'
require 'json'
require 'sinatra_auth_github'

module Tasseo
  class Web < Sinatra::Base

    configure do
      enable :logging
      enable :sessions
      mime_type :js, 'text/javascript'
      use Rack::SslEnforcer if ENV['FORCE_HTTPS']
      use Rack::Static, :urls => ['/dashboards/']

      set :session_secret, ENV['SESSION_SECRET'] || Digest::SHA1.hexdigest(Time.now.to_f.to_s)

      if ENV['GITHUB_AUTH_TEAM']
        register Sinatra::Auth::Github
      else if ENV['GITHUB_AUTH_ORGANIZATION']
        set :github_options, { :scopes => "user" }
        register Sinatra::Auth::Github
      end
    end

    before do
      if team = ENV['GITHUB_AUTH_TEAM']
        github_team_authenticate!(team) unless request.path == '/health'
      else if organization = ENV['GITHUB_AUTH_ORGANIZATION']
        github_organization_authenticate!(organization) unless request.path == '/health'
      end

{'fraction_non_alphanumeric': 0.11335578002244669, 'fraction_numerical': 0.001122334455667789, 'mean_word_length': 3.4133663366336635, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '870160', 'n_tokens_mistral': 617, 'n_tokens_neox': 588, 'n_words': 126}