<commit_before><?php

use Silex\Application;
use Silex\Provider\RoutingServiceProvider;

$app = new Application();
$app->register(new RoutingServiceProvider());

$configPath = __DIR__.'/../config.json';
if (!file_exists($configPath) && !is_writable($configPath) && !is_readable($configPath)) {
    throw new Exception('Make sure a file named "config.json" exists in the root directory, that it is NOT writeable for '.whoami().' but readable');
}

$app['deployer.config'] = json_decode(file_get_contents(__DIR__.'/../config.json'), true);

return $app;
<commit_msg>verify the json config file is valid<commit_after><?php

use Silex\Application;
use Silex\Provider\RoutingServiceProvider;

$app = new Application();
$app->register(new RoutingServiceProvider());

$configPath = __DIR__.'/../config.json';
if (!file_exists($configPath) && !is_writable($configPath) && !is_readable($configPath)) {
    throw new Exception('Make sure a file named "config.json" exists in the root directory, that it is NOT writeable for '.whoami().' but readable');
}

$app['deployer.config'] = json_decode(file_get_contents(__DIR__.'/../config.json'), true);

if (is_null($app['deployer.config'])) {
    throw new Exception('The config file looks like is not a valid JSON');
}

return $app;

{'fraction_non_alphanumeric': 0.15839243498817968, 'fraction_numerical': 0.0, 'mean_word_length': 5.791443850267379, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '445234', 'n_tokens_mistral': 397, 'n_tokens_neox': 393, 'n_words': 106}