<commit_before>
/*
Custom rules for the HTML linter.
Custom rule IDs are prefixed with a double dash ('--')
*/

var HTMLHint = require('htmlhint').HTMLHint;

/*
  Based on the existing `attr-value-double-quotes` rule
*/
HTMLHint.addRule({
    id: '--attr-value-single-quotes',
    description: 'Attribute values must be in single quotes.',
    init: function(parser, reporter) {
        var self = this;
        parser.addListener('tagstart', function(event) {
            var attrs = event.attrs,
                attr,
                col = event.col + event.tagName.length + 1;
            for (var i=0, l=attrs.length;i<l;i++) {
                attr = attrs[i];
                if (attr.quote !== "'" && attr.value !== '') {
                    reporter.error('The value of attribute [ '+attr.name+' ] must be in single quotes.', event.line, col + attr.index, self, attr.raw);
                }
            }
        });
    }
});

/*
  Based on the existing `tag-self-close` rule
*/
HTMLHint.addRule({
    id: '--no-tag-self-close',
    description: 'Self-closing tags are not valid HTML5.',
    init: function(parser, reporter) {
        var self = this;
        parser.addListener('tagstart', function(event) {
            if (event.close) {
                reporter.warn('In : [ '+event.tagName+' ] self-closing tags are not valid HTML5.', event.line, event.col, self, event.raw);
            }
        });
    }
});
<commit_msg>switch to error<commit_after>
/*
Custom rules for the HTML linter.
Custom rule IDs are prefixed with a double dash ('--')
*/

var HTMLHint = require('htmlhint').HTMLHint;

/*
  Based on the existing `attr-value-double-quotes` rule
*/
HTMLHint.addRule({
    id: '--attr-value-single-quotes',
    description: 'Attribute values must be in single quotes.',
    init: function(parser, reporter) {
        var self = this;
        parser.addListener('tagstart', function(event) {
            var attrs = event.attrs,
                attr,
                col = event.col + event.tagName.length + 1;
            for (var i=0, l=attrs.length;i<l;i++) {
                attr = attrs[i];
                if (attr.quote !== "'" && attr.value !== '') {
                    reporter.error('The value of attribute [ '+attr.name+' ] must be in single quotes.', event.line, col + attr.index, self, attr.raw);
                }
            }
        });
    }
});

/*
  Based on the existing `tag-self-close` rule
*/
HTMLHint.addRule({
    id: '--no-tag-self-close',
    description: 'Self-closing tags are not valid HTML5.',
    init: function(parser, reporter) {
        var self = this;
        parser.addListener('tagstart', function(event) {
            if (event.close) {
                reporter.error('In : [ '+event.tagName+' ] self-closing tags are not valid HTML5.', event.line, event.col, self, event.raw);
            }
        });
    }
});

{'fraction_non_alphanumeric': 0.1488695652173913, 'fraction_numerical': 0.002782608695652174, 'mean_word_length': 2.0369588173178457, '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': '7371159', 'n_tokens_mistral': 865, 'n_tokens_neox': 850, 'n_words': 230}