<commit_before>/*
 * grunt-sitemap
 * https://github.com/RayViljoen/grunt-sitemap
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

/*
 * decaffeinate suggestions:
 * DS102: Remove unnecessary code created because of implicit returns
 * DS205: Consider reworking code to avoid use of IIFEs
 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
 */

'use strict';

const fs = require('fs');
const path = require('path');

module.exports = function(grunt) {
    grunt.registerMultiTask('sitemap', 'Grunt sitemap generator plugin', function() {
        // Read `homepage` from package.json
        const pkg = grunt.file.readJSON('package.json');
        let url = this.data.homepage || pkg.homepage;

        // Check if `homepage` property is set
        if (!url) {
            grunt.fail.warn('Requires "homepage" parameter. Sitemap was not created.', 3);
        }

        // Site root dir
        let root = path.normalize(this.data.siteRoot || '.');

        // Replace Windows slashes to unix ones
        const tempRoot = root.replace(/\\/g, '/');

        if (tempRoot !== './') {
            root = tempRoot;
        }

        // Check a `siteRoot` was set
        if (root === '.') {
            grunt.log.subhead('No "siteRoot" parameter defined. Using current directory.');
        }

        // Add trailing slash to url if not there
        if (!url.endsWith('/') && !root.endsWith('/')) {
            url += '/';
        }

        // changereq setting
        const changefreq = this.data.changefreq || 'daily';

        // extension setting
        const extension = this.data.extension ? this.data.extension : { required: true };

        // priority setting; must be a string
        const priority = (this.data.priority || 0.5).toString();

        // File pattern
        const pattern = this.data.pattern || path.join(root, '/**/*.html');

        // Glob root
        let files = grunt.file.expand({ cwd: root }, pattern);

        // Remove root from path and prepend homepage url
        files = files.map(file => {
            let rawUrlPath;<commit_msg>Revert "Take into consideration the root folder."<commit_after>/*
 * grunt-sitemap
 * https://github.com/RayViljoen/grunt-sitemap
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

/*
 * decaffeinate suggestions:
 * DS102: Remove unnecessary code created because of implicit returns
 * DS205: Consider reworking code to avoid use of IIFEs
 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
 */

'use strict';

const fs = require('fs');
const path = require('path');

module.exports = function(grunt) {
    grunt.registerMultiTask('sitemap', 'Grunt sitemap generator plugin', function() {
        // Read `homepage` from package.json
        const pkg = grunt.file.readJSON('package.json');
        let url = this.data.homepage || pkg.homepage;

        // Check if `homepage` property is set
        if (!url) {
            grunt.fail.warn('Requires "homepage" parameter. Sitemap was not created.', 3);
        }

        // Site root dir
        let root = path.normalize(this.data.siteRoot || '.');

        // Replace Windows slashes to unix ones
        const tempRoot = root.replace(/\\/g, '/');

        if (tempRoot !== './') {
            root = tempRoot;
        }

        // Check a `siteRoot` was set
        if (root === '.') {
            grunt.log.subhead('No "siteRoot" parameter defined. Using current directory.');
        }

        // Add trailing slash to url if not there
        if (!url.endsWith('/') && !root.endsWith('/')) {
            url += '/';
        }

        // changereq setting
        const changefreq = this.data.changefreq || 'daily';

        // extension setting
        const extension = this.data.extension ? this.data.extension : { required: true };

        // priority setting; must be a string
        const priority = (this.data.priority || 0.5).toString();

        // File pattern
        const pattern = this.data.pattern || path.join(root, '/**/*.html');

        // Glob root
        let files = grunt.file.expand(pattern);

        // Remove root from path and prepend homepage url
        files = files.map(file => {
            let rawUrlPath;
{'fraction_non_alphanumeric': 0.13694489653568936, 'fraction_numerical': 0.006045105789351314, 'mean_word_length': 2.1866666666666665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '2528580', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1208, 'n_words': 350}