<commit_before>/**
 * @file rule: html-lang
 * @author nighca<<EMAIL>>
 */

module.exports = {

    name: 'html-lang',

    desc: 'Attribute "lang" of <html> recommended to be set.',

    lint: function (enable, document, reporter) {
        if (!enable) {
            return;
        }

        var html = document.querySelector('html');

        if (!html) {
            return;
        }

        if (!html.getAttribute('lang')) {
            reporter.warn(html, '010', 'Attribute "lang" of <html> recommended to be set.');
        }

    },

    format: function (enable, document, options) {
        if (!enable) {
            return;
        }

        var html = document.querySelector('html');

        if (!html) {
            return;
        }

        if (!html.getAttribute('lang')) {
            // 默认简体中文 ( http://tools.ietf.org/html/bcp47 )
            html.setAttribute('lang', 'zh-cmn-Hans');
        }
    }

};
<commit_msg>use zh-CN as default value of lang<commit_after>/**
 * @file rule: html-lang
 * @author nighca<<EMAIL>>
 */

module.exports = {

    name: 'html-lang',

    desc: 'Attribute "lang" of <html> recommended to be set.',

    lint: function (enable, document, reporter) {
        if (!enable) {
            return;
        }

        var html = document.querySelector('html');

        if (!html) {
            return;
        }

        if (!html.getAttribute('lang')) {
            reporter.warn(html, '010', 'Attribute "lang" of <html> recommended to be set.');
        }

    },

    format: function (enable, document, options) {
        if (!enable) {
            return;
        }

        var html = document.querySelector('html');

        if (!html) {
            return;
        }

        if (!html.getAttribute('lang')) {
            html.setAttribute('lang', 'zh-CN');
        }
    }

};

{'fraction_non_alphanumeric': 0.15380434782608696, 'fraction_numerical': 0.004347826086956522, 'mean_word_length': 1.6994134897360704, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1167042', 'n_tokens_mistral': 559, 'n_tokens_neox': 546, 'n_words': 132}