<commit_before>var jsonfile = require('jsonfile');

// Read in the file to be patched
var file = process.argv[2]; // e.g. '../src/MyProject/project.json'
if (!file)
    console.log("No filename provided");
console.log("File: " + file);

// Read in the build version (this is provided by the CI server)
var version = process.argv[3]; // e.g. '1.0.0-master-10'
var tag = process.argv[4]; // e.g. '', or '1.0.0-rc1'

if (!version)
    console.log("No version provided");
    
var lastDash = version.lastIndexOf("-");
var buildNumber = version.substring(lastDash + 1, version.length);
var num = "00000000" + parseInt(buildNumber);
buildNumber = num.substr(num.length-5);    

if (tag) {
    // Turn version into tag + '-' + buildnumber
    version = tag + '-' + buildNumber;
} else {
    version = version.substring(0, lastDash) + '-' + buildNumber;
}   

jsonfile.readFile(file, function (err, project) {
    <commit_msg>Remove buildnumber from version when tag<commit_after>var jsonfile = require('jsonfile');

// Read in the file to be patched
var file = process.argv[2]; // e.g. '../src/MyProject/project.json'
if (!file)
    console.log("No filename provided");
console.log("File: " + file);

// Read in the build version (this is provided by the CI server)
var version = process.argv[3]; // e.g. '1.0.0-master-10'
var tag = process.argv[4]; // e.g. '', or '1.0.0-rc1'

if (!version)
    console.log("No version provided");
    
var lastDash = version.lastIndexOf("-");
var buildNumber = version.substring(lastDash + 1, version.length);
var num = "00000000" + parseInt(buildNumber);
buildNumber = num.substr(num.length-5);    

if (tag) {
    // Turn version into tag
    version = tag;
} else {
    version = version.substring(0, lastDash) + '-' + buildNumber;
}   

jsonfile.readFile(file, function (err, project) {
    
{'fraction_non_alphanumeric': 0.16785518376302797, 'fraction_numerical': 0.025233132199670872, 'mean_word_length': 3.4271844660194173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '4600157', 'n_tokens_mistral': 627, 'n_tokens_neox': 610, 'n_words': 169}