<commit_before>Rails.application.routes.draw do
  devise_for :users, only: []
  devise_for :reviewers, only: []

  devise_scope :user do
    get '/users/sign_out' => 'devise/sessions#destroy'
  end

  get '/auth/:provider', to: lambda{|env| [404, {}, ["Not Found"]]}, as: 'auth'
  get '/auth/:provider/callback', to: 'oauth_callbacks#create'

  namespace :api do
    resources :projects do
      resources :hooks
      resources :notes

      resources :reports do
        member do
          post :add_note
          delete :remove_note
          get :html
        end
      end

      resources :reviewers
    end

    resources :invites

    namespace :github do
      resources :repositories, only: [:index]
      resources :pull_requests, only: [:index]
    end

    resources :repositories
    resources :reviews
  end

  get "/plain/:id" => "projects#plain", as: :report
  get "/help" => "help#index", as: :help

  resource :healths

  namespace :public do
    get "/:id" => "notes#show"
  end

  match "/hook", to: "hooks#perform", via: [:get, :post]

  subdomain_constraint_params = lambda do |req|
    on_heroku = req.domain.include?("herokuapp")
    top = req.subdomains.first

    if on_heroku
      false
    else
      top.present? && top != "www"
    end
  end

  constraints subdomain_constraint_params do<commit_msg>more dynamically skip subdomain / domains<commit_after>Rails.application.routes.draw do
  devise_for :users, only: []
  devise_for :reviewers, only: []

  devise_scope :user do
    get '/users/sign_out' => 'devise/sessions#destroy'
  end

  get '/auth/:provider', to: lambda{|env| [404, {}, ["Not Found"]]}, as: 'auth'
  get '/auth/:provider/callback', to: 'oauth_callbacks#create'

  namespace :api do
    resources :projects do
      resources :hooks
      resources :notes

      resources :reports do
        member do
          post :add_note
          delete :remove_note
          get :html
        end
      end

      resources :reviewers
    end

    resources :invites

    namespace :github do
      resources :repositories, only: [:index]
      resources :pull_requests, only: [:index]
    end

    resources :repositories
    resources :reviews
  end

  get "/plain/:id" => "projects#plain", as: :report
  get "/help" => "help#index", as: :help

  resource :healths

  namespace :public do
    get "/:id" => "notes#show"
  end

  match "/hook", to: "hooks#perform", via: [:get, :post]

  subdomain_constraint_params = lambda do |req|
    skip_words = ["herokuapp", "ngrok"]
    skip = skip_words.any?{ |word| req.domain.include?(word) || req.subdomain.include?(word) }
    top = req.subdomains.first

    if skip
      false
    else
      top.present? && top != "www"
    end
  end

  constraints subdomain_constraint_params do
{'fraction_non_alphanumeric': 0.12252252252252252, 'fraction_numerical': 0.002162162162162162, 'mean_word_length': 2.7768707482993196, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3550366', 'n_tokens_mistral': 907, 'n_tokens_neox': 878, 'n_words': 247}