<commit_before>var parseCSS = require('css-parse');

function formatCssStyle(v) {
    return '  ' + v.property + ': ' + v.value + '; \n';
}

function getCode(rule) {
    return rule.selectors.join(', ') + ' {\n' + rule.declarations.map(formatCssStyle).join('') + '}\n';
}

function hasSelectorViolation(rule) {
    return rule && rule.selectors && !rule.selectors[0].match(RE_VALID_FIRST_SELECTOR);
}

var RE_VALID_FIRST_SELECTOR = /^[#|\.]{1}/;

function reportErrorOnStyleContent(report) {
    return function (styleContent) {

        var parsed;

        try{
            parsed = parseCSS(styleContent);
        } catch(e){
            console.log('CSS parse error', e, styleContent);
        }

        if (!parsed || !parsed.stylesheet || !parsed.stylesheet.rules) {<commit_msg>log out parse error<commit_after>var logger = require('../../logger.js');
var parseCSS = require('css-parse');

function formatCssStyle(v) {
    return '  ' + v.property + ': ' + v.value + '; \n';
}

function getCode(rule) {
    return rule.selectors.join(', ') + ' {\n' + rule.declarations.map(formatCssStyle).join('') + '}\n';
}

function hasSelectorViolation(rule) {
    return rule && rule.selectors && !rule.selectors[0].match(RE_VALID_FIRST_SELECTOR);
}

var RE_VALID_FIRST_SELECTOR = /^[#|\.]{1}/;

function reportErrorOnStyleContent(report) {
    return function (styleContent) {

        var parsed;

        try{
            parsed = parseCSS(styleContent);
        } catch(e){
            logger.info('CSS parse error', e, !!styleContent);
            return report.info('CSS/Styling might be malformed: '+e.message);
        }

        if (!parsed || !parsed.stylesheet || !parsed.stylesheet.rules) {
{'fraction_non_alphanumeric': 0.16794342958161462, 'fraction_numerical': 0.002357100766057749, 'mean_word_length': 3.1414634146341465, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1178619', 'n_tokens_mistral': 555, 'n_tokens_neox': 548, 'n_words': 102}