<commit_before>var _       = require('lodash'),
    path = require('path'),
    fs = require('fs-extra'),
    checkDeprecations;

checkDeprecations = function checkDeprecations(theme, themePath) {
    var checks = [
            {
                helperRegEx: new RegExp(/{{pageUrl(\s\S+)?}}/i),
                helperName: '{{pageUrl}}',
                ruleCode: 'GS001-DEPR-PURL'
            },
            {
                helperRegEx: new RegExp(/<meta name=("|')description("|') content=("|'){{meta_description}}("|')/i),
                helperName: '{{meta_description}}',
                ruleCode: 'GS001-DEPR-MD'
            },
            {
                helperRegEx: '{{image}}',
                helperName: '{{image}}',
                ruleCode: 'GS001-DEPR-IMG'
            },
            {
                helperRegEx: '{{author.image}}',
                helperName: '{{author.image}}',
                ruleCode: 'GS001-DEPR-AIMG'
            },
            {
                helperRegEx: '{{post.image}}',
                helperName: '{{post.image}}',
                ruleCode: 'GS001-DEPR-PIMG'
            },
            {
                helperRegEx: '{{@blog.cover}}',
                helperName: '{{@blog.cover}}',
                ruleCode: 'GS001-DEPR-BC'
            },
            {
                helperRegEx: '{{author.cover}}',
                helperName: '{{author.cover}}',
                ruleCode: 'GS001-DEPR-AC'
            },
            {
                helperRegEx: '{{post.image}}',
                helperName: '{{post.image}}',
                ruleCode: 'GS001-DEPR-TIMG'
            },
            {
                helperRegEx: '{{@blog.posts_per_page}}',
                helperName: '{{@blog.posts_per_page}}',
                ruleCode: 'GS001-DEPR-PPP'
            },
            {
                helperRegEx: new RegExp(/{{content words=("|')0("|')}}/),
                helperName: '{{content words="0"}}',
                ruleCode: 'GS001-DEPR-C0H'
            },
            {
                cssRegEx: new RegExp(/\.archive-template[\s\{]/g),
                className: '.archive-template',
                css: true,
                ruleCode: 'GS001-DEPR-CSS-AT'
            },
            {
                cssRegEx: new RegExp(/\.page[\s\{]/g),
                className: '.page',
                css: true,
                ruleCode: 'GS001-DEPR-CSS-PA'
            },
            {
                cssRegEx: new RegExp(/\.page-template-\w+[\s\{]/g),
                className: '.page-template-slug',
                css: true,
                ruleCode: 'GS001-DEPR-CSS-PATS'
            }
        ];

    _.each(checks, function (check) {
        _.each(theme.files, function (themeFile) {
            var template = themeFile.file.match(/^[^\/]+.hbs$/) || themeFile.file.match(/^partials[\/\\]+(.*)+\.hbs$/),
                css = themeFile.file.match(/\.css/),
                cssDeprecations;

            if (template && !check.css) {
                if (themeFile.content.match(check.helperRegEx)) {
                    if (!theme.results.fail.hasOwnProperty(check.ruleCode)) {
                        theme.results.fail[check.ruleCode] = {failures: []};<commit_msg>🐛  Improve deprecation RegEx (#53)<commit_after>var _       = require('lodash'),
    path = require('path'),
    fs = require('fs-extra'),
    checkDeprecations;

checkDeprecations = function checkDeprecations(theme, themePath) {
    var checks = [
            {
                helperRegEx: /{{pageUrl(\s\S+)?}}/ig,
                helperName: '{{pageUrl}}',
                ruleCode: 'GS001-DEPR-PURL'
            },
            {
                helperRegEx: /<meta name=("|')description("|') content=("|'){{meta_description}}("|')/ig,
                helperName: '{{meta_description}}',
                ruleCode: 'GS001-DEPR-MD'
            },
            {
                helperRegEx: /{{image}}/g,
                helperName: '{{image}}',
                ruleCode: 'GS001-DEPR-IMG'
            },
            {
                helperRegEx: /{{author\.image}}/g,
                helperName: '{{author.image}}',
                ruleCode: 'GS001-DEPR-AIMG'
            },
            {
                helperRegEx: /{{post\.image}}/g,
                helperName: '{{post.image}}',
                ruleCode: 'GS001-DEPR-PIMG'
            },
            {
                helperRegEx: /{{@blog\.cover}}/g,
                helperName: '{{@blog.cover}}',
                ruleCode: 'GS001-DEPR-BC'
            },
            {
                helperRegEx: /{{author\.cover}}/g,
                helperName: '{{author.cover}}',
                ruleCode: 'GS001-DEPR-AC'
            },
            {
                helperRegEx: /{{post\.image}}/g,
                helperName: '{{post.image}}',
                ruleCode: 'GS001-DEPR-TIMG'
            },
            {
                helperRegEx: /{{@blog\.posts_per_page}}/g,
                helperName: '{{@blog.posts_per_page}}',
                ruleCode: 'GS001-DEPR-PPP'
            },
            {
                helperRegEx: /{{content words=("|')0("|')}}/g,
                helperName: '{{content words="0"}}',
                ruleCode: 'GS001-DEPR-C0H'
            },
            {
                cssRegEx: /\.archive-template[\s\{]/g,
                className: '.archive-template',
                css: true,
                ruleCode: 'GS001-DEPR-CSS-AT'
            },
            {
                cssRegEx: /\.page[\s\{]/g,
                className: '.page',
                css: true,
                ruleCode: 'GS001-DEPR-CSS-PA'
            },
            {
                cssRegEx: /\.page-template-\w+[\s\{]/g,
                className: '.page-template-slug',
                css: true,
                ruleCode: 'GS001-DEPR-CSS-PATS'
            }
        ];

    _.each(checks, function (check) {
        _.each(theme.files, function (themeFile) {
            var template = themeFile.file.match(/^[^\/]+.hbs$/) || themeFile.file.match(/^partials[\/\\]+(.*)+\.hbs$/),
                css = themeFile.file.match(/\.css/),
                cssDeprecations;

            if (template && !check.css) {
                if (themeFile.content.match(check.helperRegEx)) {
                    if (!theme.results.fail.hasOwnProperty(check.ruleCode)) {
                        theme.results.fail[check.ruleCode] = {failures: []};
{'fraction_non_alphanumeric': 0.16586126266562742, 'fraction_numerical': 0.013406079501169135, 'mean_word_length': 1.2200692041522492, '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': '7125026', 'n_tokens_mistral': 2026, 'n_tokens_neox': 1846, 'n_words': 256}