<commit_before>#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use POSIX qw( strftime );

my $message = '';
my @tags;
GetOptions(
    'm=s' => \$message,
    't=s' => \@tags,
);

die "Your message may not contain tabs\n" if $message =~ m/\t/;
for my $tag (@tags) {
    die "Your tags may not contain commas\n" if $tag =~ m/,/;
    die "Your tags may not contain tabs\n"   if $tag =~ m/\t/;
}

my @parts;
push @parts, sprintf( "identity:%s", '<EMAIL>' );
push @parts, sprintf( "time:%s",     strftime( '%FT%TZ', gmtime ) );
push @parts, sprintf( "tags:%s",     join( ',', @tags ) ) if @tags;
push @parts, sprintf( "message:%s",  $message );
my $line = join "\t", @parts;
print "$line\n";
<commit_msg>Include microseconds in the time stamp<commit_after>#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use POSIX qw( strftime );
use Time::HiRes qw( gettimeofday );

my $message = '';
my @tags;
GetOptions(
    'm=s' => \$message,
    't=s' => \@tags,
);

die "Your message may not contain tabs\n" if $message =~ m/\t/;
for my $tag (@tags) {
    die "Your tags may not contain commas\n" if $tag =~ m/,/;
    die "Your tags may not contain tabs\n"   if $tag =~ m/\t/;
}

my @parts;
push @parts, sprintf( "identity:%s", '<EMAIL>' );
push @parts, sprintf( "time:%s",     iso8601_now() );
push @parts, sprintf( "tags:%s",     join( ',', @tags ) ) if @tags;
push @parts, sprintf( "message:%s",  $message );
my $line = join "\t", @parts;
print "$line\n";

sub iso8601_now {
    my ( $seconds, $microseconds ) = gettimeofday();
    my $fraction = sprintf( '%06d', $microseconds );
    return strftime( "%FT%T.${fraction}Z", gmtime($seconds) );
}

{'fraction_non_alphanumeric': 0.20627261761158022, 'fraction_numerical': 0.006031363088057901, 'mean_word_length': 3.6732394366197183, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7403371', 'n_tokens_mistral': 654, 'n_tokens_neox': 630, 'n_words': 198}