<commit_before>var path = require('path');
var fs = require('fs');

var jshint = require('jshint').JSHINT;
var glob = require('glob');

var constants = require('../tasks/util/constants');

var focusGlobals = ['fdescribe', 'fit'];
var logs = [];


glob(path.join(constants.pathToJasmineTests, '**/*.js'), function(err, files) {
    files.forEach(function(file) {
        var code = fs.readFileSync(file, 'utf-8');

        jshint(code);

        var impliedGlobals = jshint.data().implieds;

        impliedGlobals.forEach(function(obj) {
            if(focusGlobals.indexOf(obj.name) !== -1) {
                logs.push([
                    path.basename(file),
                    '[line ' + obj.line + '] :',
                    'contains either a *fdescribe* or a *fit* block.'
                ].join(' '));
            }
        });
    });

    if(logs.length) throw new Error(logs.join('\n'));
});<commit_msg>rewrite syntax test using falafel (instead of jshint)<commit_after>var path = require('path');
var fs = require('fs');

var falafel = require('falafel');
var glob = require('glob');

var constants = require('../tasks/util/constants');

var focusGlobals = ['fdescribe', 'fit'];
var logs = [];


glob(path.join(constants.pathToJasmineTests, '**/*.js'), function(err, files) {
    files.forEach(function(file) {
        var code = fs.readFileSync(file, 'utf-8');

        falafel(code, {locations: true}, function(node) {
            if(node.type === 'Identifier' && focusGlobals.indexOf(node.name) !== -1) {
                logs.push([
                    path.basename(file),
                    '[line ' + node.loc.start.line + '] :',
                    'contains either a *fdescribe* or a *fit* block.'
                ].join(' '));
            }
        });

    });

    if(logs.length) throw new Error(logs.join('\n'));
});
{'fraction_non_alphanumeric': 0.18112798264642083, 'fraction_numerical': 0.0021691973969631237, 'mean_word_length': 2.318345323741007, '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': '3667659', 'n_tokens_mistral': 591, 'n_tokens_neox': 572, 'n_words': 116}