Analizo

 view release on metacpan or  search on metacpan

lib/Analizo/Command/metrics.pm  view on Meta::CPAN


=item --exclude <dirs>, -x <dirs>

Exclude <I<dirs>> (a colon-separated list of directories) from the analysis.
This is useful, for example, when you want to focus on production code and
exclude test code from the analysis. You could do that by passing something
like pass B<--exclude test>.

=back

=head1 OUTPUT FORMAT

The output is a stream of YAML documents. The first one presents metrics for
the project as a whole. The subsequent ones present per-module metrics, and thus
there will be as many of them as there are modules in your project.

=head1 COPYRIGHT AND AUTHORS

See B<analizo(1)>.

=cut

lib/Test/Analizo.pm  view on Meta::CPAN

  for my $repo (@repos) {
    system('tar', 'xzf', "t/samples/$repo.tar.gz", '-C', $tmpdir,
        '--no-same-owner');
  }
  &$code();
  system('rm', '-rf', $tmpdir);
}

sub readfile {
  my ($filename) = @_;
  open INPUT, $filename;
  my @lines = <INPUT>;
  close INPUT;
  chomp @lines;
  return @lines;
}

1;

lib/Test/Analizo/Git.pm  view on Meta::CPAN

package Test::Analizo::Git;

use parent 'Exporter';
@EXPORT = qw(
  $MAIN
  $SOME_COMMIT
  $IRRELEVANT_COMMIT
  $FIRST_COMMIT
  $MERGE_COMMIT
  $ADD_OUTPUT_COMMIT
  $RELEVANT_MERGE
);

our $MAIN = '8183eafad3a0f3eff6e8869f1bdbfd255e86825a'; # first commit id in sample
our $SOME_COMMIT = '0a06a6fcc2e7b4fe56d134e89d74ad028bb122ed'; # some commit in the middle of the history
our $IRRELEVANT_COMMIT = 'acd043761ee8071e8cef792629ccbb9492c53132';
our $FIRST_COMMIT = '0d3c023120ad4e9f519a03fff275d048c52671ad';
our $MERGE_COMMIT = '0fdaaa7dcc8073332a957024fafc8c98f165e725';
our $ADD_OUTPUT_COMMIT = 'e8faf88f0e20a193d700b6c68eeb31897dd85e53';
our $RELEVANT_MERGE = 'eb67c27055293e835049b58d7d73ce3664d3f90e';

1;

t/Analizo/Batch/Job/Git.t  view on Meta::CPAN


sub changed_files : Tests {
  my $repo = __get_repo();

  my $main = $repo->find($MAIN);
  is_deeply($main->changed_files, {'input.cc' => 'M'});

  my $some_commit = $repo->find($SOME_COMMIT);
  is_deeply($some_commit->changed_files, {'prog.cc' => 'M'});

  my $add_output_commit = $repo->find($ADD_OUTPUT_COMMIT);
  is_deeply($add_output_commit->changed_files, { 'output.cc' => 'A', 'output.h' => 'A', 'prog.cc' => 'M' });

  my $relevant_merge_commit = $repo->find($RELEVANT_MERGE);
  is_deeply($relevant_merge_commit->changed_files, { 'prog.cc' => 'MM' });
}

sub previous_relevant : Tests {
  my $batch = __get_repo();

  my $first = $batch->find($FIRST_COMMIT);



( run in 0.475 second using v1.01-cache-2.11-cpan-4e96b696675 )