<commit_before><?php
/**
 * Plugin Name: AMP QA Tester
 * Description: Test pre-release versions of the AMP plugin.
 * Plugin URI: https://amp-wp.org
 * Author: AMP Project Contributors
 * Author URI: https://github.com/ampproject/amp-wp/graphs/contributors
 * Version: 1.0.0
 * Text Domain: amp-qa-tester
 * License: GPLv2 or later
 * Requires at least: 5.0
 * Requires PHP: 5.6
 *
 * @package AmpProject\AmpWP_QA_Tester
 */

namespace AmpProject\AmpWP_QA_Tester;

use WP_Error;

global $load_errors;

/**
 * Loads the plugin.
 *
 * @since 1.0.0
 */
function load_plugin() {
	global $load_errors;

	$min_php_version = '5.6';
	$min_wp_version  = '5.0';
	$load_errors     = new WP_Error();

	// If the AMP plugin is not active, we simply bail.
	if ( ! defined( 'AMP__VERSION' ) ) {
		return;
	}

	if ( version_compare( phpversion(), $min_php_version, '<' ) ) {
		$load_errors->add(
			'insufficient_php_version',
			sprintf(
				/* translators: 1: required version, 2: currently used version */
				__( 'At least PHP version %1$s is required. Your site is currently running on PHP %2$s.', 'amp-qa-tester' ),
				$min_php_version,
				PHP_VERSION
			)
		);
	}

	if ( version_compare( get_bloginfo( 'version' ), $min_wp_version, '<' ) ) {
		$load_errors->add(
			'insufficient_wp_version',
			sprintf(
				/* translators: 1: required version, 2: currently used version */
				__( 'At least WordPress version %1$s is required. Your site is currently running on WordPress %2$s.', 'amp-qa-tester' ),
				$min_wp_version,
				get_bloginfo( 'version' )
			)
		);
	}

	if ( ! file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
		$load_errors->add( 'build_required', __( 'Failed to autoload the PHP files.', 'amp-qa-tester' ) );
	}

	// Bail if there were errors loading the plugin.
	if ( ! empty( $load_errors->errors ) ) {
		add_action( 'admin_notices', __NAMESPACE__ . '\display_errors_admin_notice' );
		return;
	}

	define( 'AMP_QA_TESTER_VERSION', '1.0.0' );

	require __DIR__ . '/vendor/autoload.php';

	Plugin::load( __FILE__ );
}

/**
 * Displays an admin notice about an unmet PHP version requirement.
 *
 * @since 1.0.0
 */
function display_errors_admin_notice() {
	global $load_errors;
	?>
	<div class="notice notice-error">
		<p>
			<strong><?php esc_html_e( 'AMP QA Tester failed to initialize.', 'amp-qa-tester' ); ?></strong>
			<ul>
				<?php foreach ( array_keys( $load_errors->errors ) as $error_code ) : ?>
					<?php foreach ( $load_errors->get_error_messages( $error_code ) as $message ) : ?>
						<li>
							<?php echo wp_kses_post( $message ); ?>
						</li>
					<?php endforeach; ?>
				<?php endforeach; ?>
			</ul>
		</p>
	</div>
	<?php
}

add_action( 'plugins_loaded', __NAMESPACE__ . '\load_plugin' );<commit_msg>Use unique name for global variable holding errors<commit_after><?php
/**
 * Plugin Name: AMP QA Tester
 * Description: Test pre-release versions of the AMP plugin.
 * Plugin URI: https://amp-wp.org
 * Author: AMP Project Contributors
 * Author URI: https://github.com/ampproject/amp-wp/graphs/contributors
 * Version: 1.0.0
 * Text Domain: amp-qa-tester
 * License: GPLv2 or later
 * Requires at least: 5.0
 * Requires PHP: 5.6
 *
 * @package AmpProject\AmpWP_QA_Tester
 */

namespace AmpProject\AmpWP_QA_Tester;

use WP_Error;

/**
 * Errors encountered while loading the plugin.
 *
 * @var WP_Error
 */
$load_errors = new WP_Error();

/**
 * Loads the plugin.
 *
 * @since 1.0.0
 */
function load_plugin() {
	global $_amp_qa_load_errors;

	$min_php_version = '5.6';
	$min_wp_version  = '5.0';

	// If the AMP plugin is not active, we simply bail.
	if ( ! defined( 'AMP__VERSION' ) ) {
		return;
	}

	if ( version_compare( PHP_VERSION, $min_php_version, '<' ) ) {
		$_amp_qa_load_errors->add(
			'insufficient_php_version',
			sprintf(
				/* translators: 1: required version, 2: currently used version */
				__( 'At least PHP version %1$s is required. Your site is currently running on PHP %2$s.', 'amp-qa-tester' ),
				$min_php_version,
				PHP_VERSION
			)
		);
	}

	if ( version_compare( get_bloginfo( 'version' ), $min_wp_version, '<' ) ) {
		$_amp_qa_load_errors->add(
			'insufficient_wp_version',
			sprintf(
				/* translators: 1: required version, 2: currently used version */
				__( 'At least WordPress version %1$s is required. Your site is currently running on WordPress %2$s.', 'amp-qa-tester' ),
				$min_wp_version,
				get_bloginfo( 'version' )
			)
		);
	}

	if ( ! file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
		$_amp_qa_load_errors->add( 'build_required', __( 'Failed to autoload the PHP files.', 'amp-qa-tester' ) );
	}

	// Bail if there were errors loading the plugin.
	if ( ! empty( $_amp_qa_load_errors->errors ) ) {
		add_action( 'admin_notices', __NAMESPACE__ . '\display_errors_admin_notice' );
		return;
	}

	define( 'AMP_QA_TESTER_VERSION', '1.0.0' );

	require __DIR__ . '/vendor/autoload.php';

	Plugin::load( __FILE__ );
}

/**
 * Displays an admin notice about an unmet PHP version requirement.
 *
 * @since 1.0.0
 */
function display_errors_admin_notice() {
	global $_amp_qa_load_errors;
	?>
	<div class="notice notice-error">
		<p>
			<strong><?php esc_html_e( 'AMP QA Tester failed to initialize.', 'amp-qa-tester' ); ?></strong>
			<ul>
				<?php foreach ( array_keys( $_amp_qa_load_errors->errors ) as $error_code ) : ?>
					<?php foreach ( $_amp_qa_load_errors->get_error_messages( $error_code ) as $message ) : ?>
						<li>
							<?php echo wp_kses_post( $message ); ?>
						</li>
					<?php endforeach; ?>
				<?php endforeach; ?>
			</ul>
		</p>
	</div>
	<?php
}

add_action( 'plugins_loaded', __NAMESPACE__ . '\load_plugin' );
{'fraction_non_alphanumeric': 0.14941302027748132, 'fraction_numerical': 0.01031661330487371, 'mean_word_length': 3.502001601281025, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 49, 'https://': 4, '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': '6153926', 'n_tokens_mistral': 2232, 'n_tokens_neox': 2020, 'n_words': 501}