App-Test-Generator

 view release on metacpan or  search on metacpan

bin/test-generator-index  view on Meta::CPAN

	for my $f (keys %{ $json->{summary} }) {
		next if $f eq 'Total';
		next if $f =~ /^\//;
		next unless $f =~ /^(?:lib|blib|bin)\//;	# only own project files
		$sum += $json->{summary}{$f}{total}{percentage} // 0;
		$count++;
	}
	next unless $count;

	# Use full SHA for lookups and URL
	my $timestamp = $commit_times{$full_sha} // strftime('%Y-%m-%dT%H:%M:%S', localtime((stat($file))->mtime));

	# Git log returns format like: "2024-01-15 14:30:45 -0500" or "2024-01-15 14:30:45 +0000"
	# We need ISO 8601 format: "2024-01-15T14:30:45-05:00"

	# Replace space between date and time with 'T'
	$timestamp =~ s/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})/$1T$2/;

	# Fix timezone format: convert "-0500" to "-05:00" or " -05:00" to "-05:00"
	$timestamp =~ s/\s*([+-])(\d{2}):?(\d{2})$/$1$2:$3/;

bin/test-generator-index  view on Meta::CPAN

			_cpd_file_report(
				$config{cpd_output_dir}, $cpd_files[$i], $cpd_data, $github_base,
				$i > 0            ? $cpd_files[$i - 1] : undef,
				$i < $#cpd_files  ? $cpd_files[$i + 1] : undef,
			);
		}
	}
}

my $timestamp = 'Unknown';
if(my $stat = stat($config{cover_db})) {
	$timestamp = strftime('%Y-%m-%d %H:%M:%S', localtime($stat->mtime));
}

# Get ATG version for dashboard footer — search @INC for the installed module
my $atg_version = 'unknown';
my $module_file = $INC{'App/Test/Generator.pm'};
unless($module_file) {
	# Module not yet loaded; search @INC directly
	for my $dir (@INC) {
		my $candidate = "$dir/App/Test/Generator.pm";

bin/test-generator-index  view on Meta::CPAN

	# Duplication Report table — lists every duplicate
	# block with its file, line range, and the file/line
	# it duplicates, so the reader can see exactly which
	# lines are copied without clicking into each file.
	# --------------------------------------------------
	if($cpd_data && %$cpd_data) {

		# Change 5: staleness warning — compare cpd.json mtime to
		# the newest .pm under lib/ so stale results are flagged.
		if($config{cpd_file} && -f $config{cpd_file}) {
			my $cpd_mtime  = (stat($config{cpd_file}))[9] // 0;
			my $newest_pm  = 0;
			if(opendir my $dh, 'lib') {
				# Recursive mtime scan via find(1) kept dependency-free
				my @pm_files;
				my @dirs = ('lib');
				while(my $dir = shift @dirs) {
					next unless opendir(my $d, $dir);
					for my $e (readdir $d) {
						next if $e =~ /^\./;
						my $path = "$dir/$e";
						push @dirs, $path if -d $path;
						if($e =~ /\.pm$/) {
							my $mt = (stat($path))[9] // 0;
							$newest_pm = $mt if $mt > $newest_pm;
						}
					}
					closedir $d;
				}
				closedir $dh;
			}
			if($newest_pm > $cpd_mtime) {
				push @html, '<p class="notice" style="background:#fff3cd;border:1px solid #ffc107;border-radius:4px;padding:6px 10px;">'
					. '&#9888; CPD data may be stale &mdash; source files have changed since the last duplication scan. '

lib/Devel/App/Test/Generator/LCSAJ/Runtime.pm  view on Meta::CPAN

    { type => UNDEF }

=cut

sub DB::DB {
	my (undef, $file, $line) = caller(0);

	return unless defined $file && defined $line;

	# Resolve symlinks and relative components to a stable absolute path,
	# cached per raw $file to avoid a stat() on every statement
	my $norm = $NORM_CACHE{$file} //= _normalize(abs_path($file) // $file);

	# Never record hits inside this module itself — suffix match is used
	# so it works regardless of CWD or install prefix
	return if $norm =~ m{(?:^|/)Devel/App/Test/Generator/LCSAJ/Runtime\.pm$};

	# If a target list was provided, skip files not in it
	if(%TARGET) {
		return unless $TARGET{$norm};
	}



( run in 3.191 seconds using v1.01-cache-2.11-cpan-4ac696b4eb4 )