This file is indexed.

/usr/share/perl5/Padre/Plugin/PerlCritic.pm is in libpadre-plugin-perlcritic-perl 0.12-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package Padre::Plugin::PerlCritic;
BEGIN {
  $Padre::Plugin::PerlCritic::VERSION = '0.12';
}

# ABSTRACT: Analyze perl files with Perl::Critic

use 5.008;
use strict;
use warnings;
use Padre::Wx     ();
use Padre::Plugin ();

our @ISA = 'Padre::Plugin';

sub padre_interfaces {
	'Padre::Plugin' => '0.47',;
}

sub plugin_name {
	Wx::gettext('Perl Critic');
}

sub menu_plugins_simple {
	my $self = shift;
	return $self->plugin_name => [
		Wx::gettext('Perl::Critic Current Document') => sub {
			$self->critic(@_);
			}
	];
}

sub critic {
	my $self    = shift;
	my $current = $self->current;
	$DB::single = 1;

	# Get the document to critique
	my $document = $current->document or return;
	unless ( $document->isa('Padre::Document::Perl') ) {
		return Wx::MessageBox(
			Wx::gettext('Document is not a Perl document'),
			Wx::gettext('Error'),
			Wx::wxOK | Wx::wxCENTRE,
			$self,
		);
	}
	my $text = $document->text_get;
	return unless defined $text;

	# Do we have a project-specific configuration
	my $project           = $document->project;
	my $config            = $project->config;
	my $config_perlcritic = $config->config_perlcritic;
	my @params =
		$config_perlcritic
		? ( -profile => $config_perlcritic )
		: ();

	# Open and start output from the critic run
	my $main   = $current->main;
	my $output = $main->output;
	$output->clear;
	$main->show_output(1);
	if (@params) {
		$output->AppendText(
			sprintf( Wx::gettext('Perl::Critic running with project-specific configuration %s'), $config_perlcritic )
				. "\n" );
	} else {
		$output->AppendText( Wx::gettext("Perl\::Critic running with default or user configuration") . "\n" );
	}

	# Hand off to Perl::Critic
	require Perl::Critic;
	my $critic     = Perl::Critic->new(@params);
	my @violations = $critic->critique( \$text );

	# Write the results to the Output window
	if (@violations) {
		$output->AppendText( join '', @violations );
	} else {
		$output->AppendText( Wx::gettext('Perl::Critic found nothing to say about this code') . "\n" );
	}

	return;
}

1;



=pod

=head1 NAME

Padre::Plugin::PerlCritic - Analyze perl files with Perl::Critic

=head1 VERSION

version 0.12

=head1 SYNOPSIS

This is a simple plugin to run Perl::Critic on your source code.

Currently there is no configuration for this plugin, so you have to rely
on the default .perlcriticrc configuration. See Perl::Critic for details.

=head1 AUTHORS

=over 4

=item *

Kaare Rasmussen <kaare@cpan.org>

=item *

Ahmad M. Zawawi <ahmad.zawawi@gmail.com>

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Kaare Rasmussen.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut


__END__