<commit_before>#!/usr/bin/perl

# Test t0000..t9999.sh for non portable shell scripts
# This script can be called with one or more filenames as parameters

use strict;
use warnings;

my $exit_code=0;

sub err {
	my $msg = shift;
	print "$ARGV:$.: error: $msg: $_\n";
	$exit_code = 1;
}

while (<>) {
	chomp;
	/^\s*sed\s+-i/ and err 'sed -i is not portable';
	/^\s*echo\s+-n/ and err 'echo -n is not portable (please use printf)';
	/^\s*declare\s+/ and err 'arrays/declare not portable';
	/^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)';
	/test\s+[^=]*==/ and err '"test a == b" is not portable (please use =)';
	# this resets our $. for each file
	close ARGV if eof;
}
exit $exit_code;<commit_msg>test-lint: detect 'export FOO=bar'<commit_after>#!/usr/bin/perl

# Test t0000..t9999.sh for non portable shell scripts
# This script can be called with one or more filenames as parameters

use strict;
use warnings;

my $exit_code=0;

sub err {
	my $msg = shift;
	print "$ARGV:$.: error: $msg: $_\n";
	$exit_code = 1;
}

while (<>) {
	chomp;
	/^\s*sed\s+-i/ and err 'sed -i is not portable';
	/^\s*echo\s+-n/ and err 'echo -n is not portable (please use printf)';
	/^\s*declare\s+/ and err 'arrays/declare not portable';
	/^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)';
	/test\s+[^=]*==/ and err '"test a == b" is not portable (please use =)';
	/^\s*export\s+[^=]*=/ and err '"export FOO=bar" is not portable (please use FOO=bar && export FOO)';
	# this resets our $. for each file
	close ARGV if eof;
}
exit $exit_code;
{'fraction_non_alphanumeric': 0.18106206014075496, 'fraction_numerical': 0.012795905310300703, 'mean_word_length': 3.546511627906977, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7633861', 'n_tokens_mistral': 640, 'n_tokens_neox': 596, 'n_words': 211}