<commit_before>
'use strict';

var profiles = require('../../../public/data/profiles.json');

exports.name = "headers.h2-status";

exports.check = function (sr, done) {

    var profileFound = false;
    var i, j;

    if (!sr.config.longStatus) return done();
    var $h2 = sr.getDocumentDateElement();
    if (!$h2 || !$h2.length) {
        sr.error(this.name, "no-h2");
        return done();
    }
    var txt = sr.norm($h2.text());
    if (txt.indexOf("W3C " + sr.config.longStatus) !== 0)
        sr.error(this.name, "bad-h2");

    i = 0;
    while (i < profiles.tracks.length && !profileFound) {
        j = 0;
        while (j < profiles.tracks[i].profiles.length && !profileFound) {
            if (0 === txt.toLowerCase().indexOf(('W3C ' + profiles.tracks[i].profiles[j].name + ' ').toLowerCase())) {
                profileFound = true;
                sr.metadata('status', profiles.tracks[i].profiles[j].id);
            }
            j ++;
        }
        i ++;
    }

    done();

};
<commit_msg>send an error if a whitespace doesn't follow the long status in h2<commit_after>
'use strict';

var profiles = require('../../../public/data/profiles.json');

exports.name = "headers.h2-status";

exports.check = function (sr, done) {

    var profileFound = false;
    var i, j;

    if (!sr.config.longStatus) return done();
    var $h2 = sr.getDocumentDateElement();
    if (!$h2 || !$h2.length) {
        sr.error(this.name, "no-h2");
        return done();
    }
    var txt = sr.norm($h2.text());
    if (txt.indexOf("W3C " + sr.config.longStatus) !== 0)
        sr.error(this.name, "bad-h2");

    i = 0;
    while (i < profiles.tracks.length && !profileFound) {
        j = 0;
        while (j < profiles.tracks[i].profiles.length && !profileFound) {
            if (0 === txt.toLowerCase().indexOf(('W3C ' + profiles.tracks[i].profiles[j].name + ' ').toLowerCase())) {
                profileFound = true;
                sr.metadata('status', profiles.tracks[i].profiles[j].id);
            }
            j ++;
        }
        i ++;
    }
    if (!profileFound)
        sr.error(this.name, "bad-h2");

    done();

};

{'fraction_non_alphanumeric': 0.18712085860942604, 'fraction_numerical': 0.013065795613625758, 'mean_word_length': 2.1436950146627565, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3372500', 'n_tokens_mistral': 751, 'n_tokens_neox': 720, 'n_words': 146}