<commit_before>import InstanceCache from 'Core/InstanceCache';
import { renderApplication } from 'Core/Renderer';

import App from 'View/App';
import AppIndex from 'View/Index';

import Routing from 'Core/Routing';
import StoreCreator from 'Core/StoreCreator';
import RequestFactory from 'Core/RequestFactory';

import { gitHubApiUrl } from 'Constants/Services/GitHub';
import GitHub from 'GitHub/GitHub';

import GitHubAccountsService from 'Services/GitHubAccountsService';
import GitHubAuthenticationService from 'Services/GitHubAuthenticationService';
import GitHubNotificationsService from 'Services/GitHubNotificationsService';

import Routes from 'Routes';

/**
 * @todo: This needs to change. A lot.
 */
class HawkEye
{
  private routing: IRouting;

  private storeCreator: IStoreCreator<IState>;

  constructor()
  {
    /*
     * Setup Routing and StoreCreator for our application
     */
    this.routing      = new Routing(App, AppIndex);
    this.storeCreator = new StoreCreator<IState>(this.routing.getHistory(), () =>
    {
      console.log('rehydrated');
    });

    /*
     * Sync history with the Store and add
     * the routing configuration
     */
    this.routing
        .syncHistoryWithStore(this.storeCreator.getStore())
        .addRouteConfigs(...Routes);

    /*
     * Bind our Routing and StoreCreator to the cache
     */
    InstanceCache
      .addInstance<IRouting>('IRouting', this.routing)
      .addInstance<IStoreCreator<IState>>('IStoreCreator', this.storeCreator);


    // @todo: Migrate the lot. ServiceBinder
    const gitHubService = new GitHub(new RequestFactory(gitHubApiUrl));

    InstanceCache
      .addInstance<IGitHub>('IGitHub', gitHubService)
      .addInstance<IGitHubAccountsService>('IGitHubAccountsService',
                                                 new GitHubAccountsService(gitHubService))
      .addInstance<IGitHubAuthenticationService>('IGitHubAuthenticationService',
                                                 new GitHubAuthenticationService(gitHubService))
      .addInstance<IGitHubNotificationsService>('IGitHubNotificationsService',
                                                 new GitHubNotificationsService(gitHubService));

    /*
     * Render our application in the container,
     * along with our storeCreator and routing instances.
     */
    renderApplication(
      document.getElementById('root'),
      this.storeCreator,
      this.routing
    );
  }
};

export default HawkEye;<commit_msg>Initial render flow for HawkEye<commit_after>import InstanceCache from 'Core/InstanceCache';
import { renderApplication } from 'Core/Renderer';

import App from 'View/App';
import AppIndex from 'View/Index';

import Routing from 'Core/Routing';
import StoreCreator from 'Core/StoreCreator';
import RequestFactory from 'Core/RequestFactory';

import {
  setSetupRenderApp,
  setSetupIsLoading,
  setSetupShowLoading
} from 'Actions/Setup';
import { wait } from 'Helpers/Lang/Timeout';

import { gitHubApiUrl } from 'Constants/Services/GitHub';
import GitHub from 'GitHub/GitHub';

import GitHubAccountsService from 'Services/GitHubAccountsService';
import GitHubAuthenticationService from 'Services/GitHubAuthenticationService';
import GitHubNotificationsService from 'Services/GitHubNotificationsService';

import Routes from 'Routes';

/**
 * @todo: This needs to change. A lot.
 */
class HawkEye
{
  private routing: IRouting;

  private storeCreator: IStoreCreator<IState>;

  constructor()
  {
    /*
     * Setup Routing and StoreCreator for our application
     */
    this.routing      = new Routing(App, AppIndex);
    this.storeCreator = new StoreCreator<IState>(this.routing.getHistory(),
                                                 this.onRehydrated.bind(this));

    /*
     * Sync history with the Store and add
     * the routing configuration
     */
    this.routing
        .syncHistoryWithStore(this.storeCreator.getStore())
        .addRouteConfigs(...Routes);

    /*
     * Bind our Routing and StoreCreator to the cache
     */
    InstanceCache
      .addInstance<IRouting>('IRouting', this.routing)
      .addInstance<IStoreCreator<IState>>('IStoreCreator', this.storeCreator);


    // @todo: Migrate the lot. ServiceBinder
    const gitHubService = new GitHub(new RequestFactory(gitHubApiUrl));

    InstanceCache
      .addInstance<IGitHub>('IGitHub', gitHubService)
      .addInstance<IGitHubAccountsService>('IGitHubAccountsService',
                                                 new GitHubAccountsService(gitHubService))
      .addInstance<IGitHubAuthenticationService>('IGitHubAuthenticationService',
                                                 new GitHubAuthenticationService(gitHubService))
      .addInstance<IGitHubNotificationsService>('IGitHubNotificationsService',
                                                 new GitHubNotificationsService(gitHubService));

    /*
     * Render our application in the container,
     * along with our storeCreator and routing instances.
     */
    renderApplication(
      document.getElementById('root'),
      this.storeCreator,
      this.routing
    );
  }

  public onRehydrated = () =>
  {
    let dispatch = this.storeCreator.getStore().dispatch;

    /*
     * Render the application, and wait some time
     * for completion
     */
    dispatch(setSetupRenderApp(true));
    wait(250)
      .then(() =>
      {
        /*
         * Hide the loading page, wait for it to fade out.
         * When it has, remove the loading screen from the DOM.
         */
        dispatch(setSetupShowLoading(false));
        wait(250)
          .then(() => dispatch(setSetupIsLoading(false)));
      });
  }
};

export default HawkEye;
{'fraction_non_alphanumeric': 0.09522142482058463, 'fraction_numerical': 0.001050236303168213, 'mean_word_length': 2.932553337921542, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3902050', 'n_tokens_mistral': 1562, 'n_tokens_neox': 1506, 'n_words': 356}