<commit_before>'use strict';

// MODULES //

var isUppercase = require( '@stdlib/assert/is-uppercase' );
var endsWith = require( '@stdlib/string/ends-with' );
var contains = require( '@stdlib/assert/contains' );


// VARIABLES //

var HEADERS = [
	'MODULES',
	'VARIABLES',
	'FUNCTIONS',
	'MAIN',
	'EXPORTS',
	'FIXTURES',
	'TESTS'
];


// MAIN //

/**
* Rule for validating that section header comments are properly formatted.
*
* @param {Object} context - ESLint context
* @returns {Object} validators
*/
function main( context ) {
	var source = context.getSourceCode();

	/**
	* Reports the error message.
	*
	* @private
	* @param {string} msg - message to report
	* @param {Object} loc - lines of code (object with `start` and `end` properties)
	*/
	function report( msg, loc ) {
		context.report({
			'node': null,
			'message': msg,
			'loc': loc
		});
	} // end FUNCTION report()

	/**
	* Checks section header comments.
	*
	* @private
	*/
	function validate() {
		var comments;
		var current;
		var i;

		comments = source.getAllComments();
		for ( i = 0; i < comments.length; i++ ) {
			current = comments[ i ];
			if ( isSectionHeader( current ) ) {
				validateHeader( current );
			}
		}
	} // end FUNCTION validate()

	/**
	* Checks whether a comment is a section header.
	*
	* @private
	* @param {Object} comment - comment object
	* @returns {boolean} boolean indicating if a line comment denotes a section header
	*/
	function isSectionHeader( comment ) {
		var val;
		if ( comment.type !== 'Line' ) {
			return false;
		}
		val = comment.value;
		return isUppercase( val ) || endsWith( val, ' //' );
	} // end FUNCTION isSectionHeader()

	/**
	* Checks whether a section header comment is properly formatted.
	*
	* @private
	* @param {string} comment - literal value of comment
	*/
	function validateHeader( comment ) {
		var val = comment.value;

		if ( isUppercase( val ) ) {
			if ( endsWith( val, ' //' ) ) {
				val = val.substring( 1, val.length-3 );<commit_msg>Check for alphanumeric characters instead of just uppercase<commit_after>'use strict';

// MODULES //

var isUppercase = require( '@stdlib/assert/is-uppercase' );
var endsWith = require( '@stdlib/string/ends-with' );
var contains = require( '@stdlib/assert/contains' );


// VARIABLES //

var HEADERS = [
	'MODULES',
	'VARIABLES',
	'FUNCTIONS',
	'MAIN',
	'EXPORTS',
	'FIXTURES',
	'TESTS'
];
var REGEXP_ALPHANUMERIC = /^[A-Z0-9 ]+( \/\/)?$/;


// MAIN //

/**
* Rule for validating that section header comments are properly formatted.
*
* @param {Object} context - ESLint context
* @returns {Object} validators
*/
function main( context ) {
	var source = context.getSourceCode();

	/**
	* Reports the error message.
	*
	* @private
	* @param {string} msg - message to report
	* @param {Object} loc - lines of code (object with `start` and `end` properties)
	*/
	function report( msg, loc ) {
		context.report({
			'node': null,
			'message': msg,
			'loc': loc
		});
	} // end FUNCTION report()

	/**
	* Checks section header comments.
	*
	* @private
	*/
	function validate() {
		var comments;
		var current;
		var i;

		comments = source.getAllComments();
		for ( i = 0; i < comments.length; i++ ) {
			current = comments[ i ];
			if ( isSectionHeader( current ) ) {
				validateHeader( current );
			}
		}
	} // end FUNCTION validate()

	/**
	* Checks whether a comment is a section header.
	*
	* @private
	* @param {Object} comment - comment object
	* @returns {boolean} boolean indicating if a line comment denotes a section header
	*/
	function isSectionHeader( comment ) {
		var val;
		if ( comment.type !== 'Line' ) {
			return false;
		}
		val = comment.value;
		return REGEXP_ALPHANUMERIC.test( val ) || endsWith( val, ' //' );
	} // end FUNCTION isSectionHeader()

	/**
	* Checks whether a section header comment is properly formatted.
	*
	* @private
	* @param {string} comment - literal value of comment
	*/
	function validateHeader( comment ) {
		var val = comment.value;

		if ( isUppercase( val ) ) {
			if ( endsWith( val, ' //' ) ) {
				val = val.substring( 1, val.length-3 );
{'fraction_non_alphanumeric': 0.15001227596366315, 'fraction_numerical': 0.001964154186103609, 'mean_word_length': 3.1444557477110884, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6962648', 'n_tokens_mistral': 1467, 'n_tokens_neox': 1362, 'n_words': 406}