Analizo

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an

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


=head1 DESCRIPTION

Following the instructions from the L<App::Cmd::Tutorial> we create this module
to be a superclass of every analizo tool, in that way we can have global
options to every analizo tool:

  analizo <tool> --help
  analizo <tool> --usage

Any analizo tool should implement B<validate()>, method which is called by
B<validate_args()> implemented here. See L<App::Cmd::Command> for details about
B<validate_args()>.

=cut

sub validate_args {
  my ($self, $opt, $args) = @_;
  if ($self->app->global_options->version) {
    $self->usage_error("Invalid option: --version");
  }
  elsif ($self->app->global_options->usage) {
    print $self->app->usage, "\n", $self->usage;
    exit 0;
  }
  $self->validate($opt, $args);
}

sub version_information {
  my ($self) = @_;
  sprintf("%s version %s", $self->app->arg0, $Analizo::VERSION);
}

sub show_manpage {
  my ($self, $package, $command_name) = @_;
  my $version_information = $self->version_information;

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

sub usage_desc { "%c files-graph %o <input> [<input> [<input> ...]]" }

sub command_names { qw/files-graph/ }

sub opt_spec {
  return (
    [ 'output|o=s',  'output file name' ],
  );
}

sub validate {
  my ($self, $opt, $args) = @_;
  $self->usage_error("No input files!") unless @$args;
  my @unreadable = grep { ! -r $_ || ! -e $_ } @$args;
  if (@unreadable) {
    foreach my $file (@unreadable) {
      $self->usage_error("$file is not readable");
    }
  }
  if ($opt->output && ! -w dirname($opt->output)) {
    $self->usage_error("No such file or directory");

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

sub opt_spec {
  return (
    [ 'extractor=s', 'which extractor method use to parse the source code' ],
    [ 'output|o=s',  'output file name' ],
    [ 'omit=s',      'omit the given functions from the call graph', { default => '' } ],
    [ 'cluster',     'cluster the functions into files' ],
    [ 'modules',     'group the functions by modules(files)' ],
  );
}

sub validate {
  my ($self, $opt, $args) = @_;
  $self->usage_error("No input files!") unless @$args;
  my @unreadable = grep { ! -r $_ || ! -e $_ } @$args;
  if (@unreadable) {
    foreach my $file (@unreadable) {
      $self->usage_error("$file is not readable");
    }
  }
  if ($opt->output && ! -w dirname($opt->output)) {
    $self->usage_error("No such file or directory");

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

    [ 'globalonly|global-only|g', 'only output global (project-wide) metrics' ],
    [ 'output|o=s',   'output file name' ],
    [ 'language=s',   'process only filenames matching known extensions for the <lang>> programming' ],
    [ 'exclude|x=s',  'exclude <dirs> (a colon-separated list of directories) from the analysis' ],
    [ 'includedirs|I=s',  'include <dirs> (a colon-separated list of directories) with C/C++ header files', { default => '.' } ],
    [ 'libdirs|L=s',  'include <dirs> (a colon-separated list of directories) with C/C++ static and dynamic libraries files', { default => '.' } ],
    [ 'libs=s',  'include <dirs> (a colon-separated list of directories) with C/C++ linked libraries files', { default => '.' } ],
  );
}

sub validate {
  my ($self, $opt, $args) = @_;
  if (@$args > 1) {
    $self->usage_error('No more than one <input> is suported');
  }
  my @unreadable = grep { ! -r $_ || ! -e $_ } @$args;
  if (@unreadable) {
    foreach my $file (@unreadable) {
      $self->usage_error("Input '$file' is not readable");
    }
  }

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

sub command_names { qw/metrics-batch/ }

sub opt_spec {
  return (
    [ 'output|o=s',   'output file name', { default => 'metrics.csv' } ],
    [ 'quiet|q',      'supresses messages to standard output' ],
    [ 'parallel|p=i', 'activates support for parallel processing' ],
  );
}

sub validate {
  my ($self, $opt, $args) = @_;
  if ($opt->output && ! -w dirname($opt->output)) {
    $self->usage_error("Output is not writable!");
  }
}

sub execute {
  my ($self, $opt, $args) = @_;
  my $runner = undef;
  if ($opt->parallel) {

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

    [ 'output|o=s',    'output file name' ],
    [ 'list|l',        'just print out the ids of the commits that would be processed '],
    [ 'language=s',    'process only filenames matching known extensions for the <lang> programming' ],
    [ 'exclude|x=s',   'exclude <dirs> (a colon-separated list of directories) from the analysis' ],
    [ 'parallel|p=i',  'activates support for parallel processing' ],
    [ 'format|f=s',    'specifies the output format', { default => 'csv' } ],
    [ 'progressbar|b', 'displays a progress bar during the execution' ],
  );
}

sub validate {
  my ($self, $opt, $args) = @_;
  unless ($self->output_driver($opt->format)) {
    $self->usage_error("Invalid output driver " . $opt->format);
  }
}

sub output_driver {
  my ($self, $format) = @_;
  my %available_outputs = (
    csv => 'Analizo::Batch::Output::CSV',

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

=cut

sub command_names { qw/tree-evolution/ }

sub opt_spec {
  return (
    [ 'language|l=s', 'filters the source tree by language', { default => 'all' } ],
  );
}

sub validate {}

sub execute {
  my ($self, $opt, $args) = @_;
  my $filter = Analizo::LanguageFilter->new($opt->language);
  local $ENV{PATH} = '/usr/local/bin:/usr/bin:/bin';
  open COMMITS, "git log --reverse --format=%H|";
  my @commits = <COMMITS>;
  chomp @commits;
  close COMMITS;
  my %trees = ();

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


  my $job = Analizo::Batch::Job->new;

  local $Analizo::VERSION = "1.1.1";
  like ($job->_get_cache_dir, qr/1\.1\.1$/);

  local $Analizo::VERSION = "2.2.2";
  like ($job->_get_cache_dir, qr/2\.2\.2$/);
}

sub invalidates_cache_after_upgrade_version : Tests {
  my $FileSpec = Test::MockModule->new('File::Spec');
  $FileSpec->mock('splitdir', sub { '/bypass_the_tempdir_creation_on_development_environment' });
  local $ENV{ANALIZO_CACHE} = undef;

  local $Analizo::VERSION = "1.1.1";
  my $job_a = Analizo::Batch::Job->new;
  $job_a->cache->set('metrics', 'metrics values');
  ok ($job_a->cache->get('metrics'), 'metrics values sucessfully retrievied from the cache');

  my $job_b = Analizo::Batch::Job->new;

t/Analizo/Command.t  view on Meta::CPAN

  throws_ok {
    $analizo->execute_command( $analizo->prepare_command('fake', '--version') )
  } qr /Invalid option/;
}

__PACKAGE__->runtests;

package t::Analizo::Command::fake;
use Analizo -command;
use parent qw(Analizo::Command);
sub validate {}
sub execute { "command fake executed" }
1;

t/samples/android-framework/android-5.1.1_r38/AudioTrackShared.cpp  view on Meta::CPAN

    bool ignoreInitialPendingInterrupt = true;
    // check for shared memory corruption
    if (mIsShutdown) {
        status = NO_INIT;
        goto end;
    }
    for (;;) {
        int32_t flags = android_atomic_and(~CBLK_INTERRUPT, &cblk->mFlags);
        // check for track invalidation by server, or server death detection
        if (flags & CBLK_INVALID) {
            ALOGV("Track invalidated");
            status = DEAD_OBJECT;
            goto end;
        }
        // check for obtainBuffer interrupted by client
        if (!ignoreInitialPendingInterrupt && (flags & CBLK_INTERRUPT)) {
            ALOGV("obtainBuffer() interrupted by client");
            status = -EINTR;
            goto end;
        }
        ignoreInitialPendingInterrupt = false;

t/samples/android-framework/android-5.1.1_r38/AudioTrackShared.cpp  view on Meta::CPAN

        timeout = TIMEOUT_ZERO;
    } else if (requested->tv_sec == INT_MAX) {
        timeout = TIMEOUT_INFINITE;
    } else {
        timeout = TIMEOUT_FINITE;
    }
    for (;;) {
        int32_t flags = android_atomic_and(~(CBLK_INTERRUPT|CBLK_STREAM_END_DONE), &cblk->mFlags);
        // check for track invalidation by server, or server death detection
        if (flags & CBLK_INVALID) {
            ALOGV("Track invalidated");
            status = DEAD_OBJECT;
            goto end;
        }
        if (flags & CBLK_STREAM_END_DONE) {
            ALOGV("stream end received");
            status = NO_ERROR;
            goto end;
        }
        // check for obtainBuffer interrupted by client
        // check for obtainBuffer interrupted by client



( run in 0.576 second using v1.01-cache-2.11-cpan-a5abf4f5562 )