Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Adding tidy command to makefile and tidyall
Browse files Browse the repository at this point in the history
  • Loading branch information
phochste committed Apr 5, 2018
1 parent 7801701 commit a87804f
Show file tree
Hide file tree
Showing 27 changed files with 64 additions and 60 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ usage:
@echo "targets:"
@echo " generate"
@echo " update"
@echo " tidy"
@echo " test"
@echo " cover [ FILE=<path> ]"

Expand Down Expand Up @@ -31,3 +32,6 @@ endif

test:
prove -l -j 1 -r t

tidy:
tidyall -r lib t
4 changes: 2 additions & 2 deletions lib/LibreCat/App/Catalogue/Route/audit.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ List all audit messages for an :id in the store :bag
sub {
$_[0]->{time} cmp $_[1]->{time};
}
)->map(
)->map(
sub {
$_[0]->{date} = strftime("%Y-%m-%dT%H:%M:%S",
localtime($_[0]->{time} // 0));
$_[0];
}
);
);

my $array = $it->to_array;

Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/App/Catalogue/Route/publication.pm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Checks if the user has permission the see/edit this record.
$hook->fix_before($rec);

my $templatepath = "backend/forms";
my $template = $rec->{meta}->{template} // $rec->{type};
my $template = $rec->{meta}->{template} // $rec->{type};

$rec->{return_url} = request->referer if request->referer;

Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/App/Catalogue/Route/qae.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ post '/librecat/upload/qae/submit' => sub {
id => $person->{_id},
}
],
year => substr($now, 0, 4),
year => substr($now, 0, 4),
department => $department || $person->{department},
creator => {id => session->{user_id}, login => session->{user}},
user_id => session->{user_id},
Expand Down
4 changes: 2 additions & 2 deletions lib/LibreCat/App/Helper.pm
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ sub extract_params {
}

sub now {
my $time = $_[1] // time;
my $time = $_[1] // time;
my $time_format = $_[0]->config->{time_format} // '%Y-%m-%dT%H:%M:%SZ';
my $now = strftime($time_format, gmtime($time));
my $now = strftime($time_format, gmtime($time));
return $now;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/LibreCat/App/Search/Route/feed.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Encode;
use LibreCat::App::Helper;

sub feed {
my $q = shift // [];
my $q = shift // [];
my $period = shift // 'weekly';

state $fixer = Catmandu::Fix->new(fixes => ['fixes/to_dc.fix']);
Expand Down Expand Up @@ -52,7 +52,7 @@ sub feed {

$hits->each(
sub {
my $hit = $_[0];
my $hit = $_[0];
my $title = $hit->{title} // 'no title';

$rss->add_item(
Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/App/Search/Route/project.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Project page with alphabetical browsing.
=cut

get qr{/project/*} => sub {
my $c = params->{browse} // 'a';
my $c = params->{browse} // 'a';
my %search_params = (
query => {prefix => {'name.exact' => lc($c)}},
sru_sortkeys => "name,,1",
Expand Down
4 changes: 2 additions & 2 deletions lib/LibreCat/App/Search/Route/publication.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Export normal publication in format :fmt
=cut

get '/publication/:id.:fmt' => sub {
my $id = params->{id};
my $id = params->{id};
my $fmt = params->{fmt} // 'yaml';

forward "/export",
Expand All @@ -35,7 +35,7 @@ Export data publication in format :fmt
=cut

get '/data/:id.:fmt' => sub {
my $id = params->{id};
my $id = params->{id};
my $fmt = params->{fmt} // 'yaml';

forward "/export",
Expand Down
4 changes: 2 additions & 2 deletions lib/LibreCat/Auth/LDAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use namespace::clean;

with 'LibreCat::Auth';

has host => (is => 'ro', required => 1);
has base => (is => 'ro');
has host => (is => 'ro', required => 1);
has base => (is => 'ro');
has password => (is => 'ro');
has auth_base => (is => 'ro', required => 1);
has search_filter => (is => 'ro');
Expand Down
4 changes: 2 additions & 2 deletions lib/LibreCat/Cmd/audit.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ sub _list {

my $count = $it->each(
sub {
my ($item) = @_;
my $id = $item->{id} // '';
my ($item) = @_;
my $id = $item->{id} // '';
my $process = $item->{process} // '';
my $message = $item->{message} // '';
my $time = strftime("%Y-%m-%dT%H:%M:%S",
Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/Cmd/copy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Catmandu::Sane;
use parent qw(Catmandu::Cmd::copy);

sub description {
return <<EOF
return <<EOF;
WARNING - Low level command
WARNING - These low level commands will skip all validation/business rules!
Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/Cmd/count.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Catmandu::Sane;
use parent qw(Catmandu::Cmd::count);

sub description {
return <<EOF
return <<EOF;
WARNING - Low level command
WARNING - These low level commands will skip all validation/business rules!
Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/Cmd/delete.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Catmandu::Sane;
use parent qw(Catmandu::Cmd::delete);

sub description {
return <<EOF
return <<EOF;
WARNING - Low level command
WARNING - These low level commands will skip all validation/business rules!
Expand Down
6 changes: 3 additions & 3 deletions lib/LibreCat/Cmd/department.pm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ sub _on_all {
sub _list {
my ($self, $query) = @_;

my $sort = $self->opts->{sort} // undef;
my $sort = $self->opts->{sort} // undef;
my $total = $self->opts->{total} // undef;
my $start = $self->opts->{start} // undef;

Expand Down Expand Up @@ -263,7 +263,7 @@ sub _tree_display {
sub _export {
my ($self, $query) = @_;

my $sort = $self->opts->{sort} // undef;
my $sort = $self->opts->{sort} // undef;
my $total = $self->opts->{total} // undef;
my $start = $self->opts->{start} // undef;

Expand Down Expand Up @@ -392,7 +392,7 @@ sub _valid {

unless ($validator->is_valid($item)) {
my $errors = $validator->last_errors();
my $id = $item->{_id} // '';
my $id = $item->{_id} // '';
if ($errors) {
for my $err (@$errors) {
print STDERR "ERROR $id: $err\n";
Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/Cmd/drop.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Catmandu::Sane;
use parent qw(Catmandu::Cmd::drop);

sub description {
return <<EOF
return <<EOF;
WARNING - Low level command
WARNING - These low level commands will skip all validation/business rules!
Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/Cmd/export.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Catmandu::Sane;
use parent qw(Catmandu::Cmd::export);

sub description {
return <<EOF
return <<EOF;
WARNING - Low level command
WARNING - These low level commands will skip all validation/business rules!
Expand Down
6 changes: 3 additions & 3 deletions lib/LibreCat/Cmd/file_store.pm
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ sub _list {
else {
if ($args[0] && $args[0] eq 'recursive') {
for (@$file_array) {
my $file_name = $_->{_id} // '';
my $file_size = $_->{size} // 0;
my $file_name = $_->{_id} // '';
my $file_size = $_->{size} // 0;
my $file_modified = $_->{modified} // 0;
my $file_md5 = $_->{md5} // '';
my $file_md5 = $_->{md5} // '';

printf "%s %s %s %s %s\n", $key,
strftime(
Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/Cmd/import.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Catmandu::Sane;
use parent qw(Catmandu::Cmd::import);

sub description {
return <<EOF
return <<EOF;
WARNING - Low level command
WARNING - These low level commands will skip all validation/business rules!
Expand Down
6 changes: 3 additions & 3 deletions lib/LibreCat/Cmd/project.pm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ sub _on_all {
sub _list {
my ($self, $query) = @_;

my $sort = $self->opts->{sort} // undef;
my $sort = $self->opts->{sort} // undef;
my $total = $self->opts->{total} // undef;
my $start = $self->opts->{start} // undef;

Expand Down Expand Up @@ -158,7 +158,7 @@ sub _list {
sub _export {
my ($self, $query) = @_;

my $sort = $self->opts->{sort} // undef;
my $sort = $self->opts->{sort} // undef;
my $total = $self->opts->{total} // undef;
my $start = $self->opts->{start} // undef;

Expand Down Expand Up @@ -286,7 +286,7 @@ sub _valid {

unless ($validator->is_valid($item)) {
my $errors = $validator->last_errors();
my $id = $item->{_id} // '';
my $id = $item->{_id} // '';
if ($errors) {
for my $err (@$errors) {
print STDERR "ERROR $id: $err\n";
Expand Down
18 changes: 9 additions & 9 deletions lib/LibreCat/Cmd/publication.pm
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ sub _on_all {
sub _list {
my ($self, $query) = @_;

my $sort = $self->opts->{sort} // undef;
my $sort = $self->opts->{sort} // undef;
my $total = $self->opts->{total} // undef;
my $start = $self->opts->{start} // undef;

Expand All @@ -217,12 +217,12 @@ sub _list {

my $count = $it->each(
sub {
my ($item) = @_;
my $id = $item->{_id};
my $title = $item->{title} // '---';
my ($item) = @_;
my $id = $item->{_id};
my $title = $item->{title} // '---';
my $creator = $item->{creator}->{login} // '---';
my $status = $item->{status};
my $type = $item->{type} // '---';
my $type = $item->{type} // '---';

printf "%-2.2s %-40.40s %-10.10s %-60.60s %-10.10s %s\n",
" " # not use
Expand All @@ -243,7 +243,7 @@ sub _list {
sub _export {
my ($self, $query) = @_;

my $sort = $self->opts->{sort} // undef;
my $sort = $self->opts->{sort} // undef;
my $total = $self->opts->{total} // undef;
my $start = $self->opts->{start} // undef;

Expand Down Expand Up @@ -444,7 +444,7 @@ sub _valid {

unless ($validator->is_valid($item)) {
my $errors = $validator->last_errors();
my $id = $item->{_id} // '';
my $id = $item->{_id} // '';
if ($errors) {
for my $err (@$errors) {
print STDERR "ERROR $id: $err\n";
Expand Down Expand Up @@ -529,9 +529,9 @@ sub _embargo {
? $embargo_to
: $file->{access_level},
request_a_copy => $process ? 0 : $file->{request_a_copy},
embargo => $process ? 'NA' : $embargo // 'NA',
embargo => $process ? 'NA' : $embargo // 'NA',
embargo_to => $process ? 'NA' : $embargo_to // 'NA',
file_name => $file->{file_name},
file_name => $file->{file_name},
}
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/Cmd/queue.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ sub _daemon {
croak "no queue.workers configured" unless exists $config->{workers};

for my $worker (keys %{$config->{workers}}) {
my $count = $config->{workers}->{$worker}->{count} // 0;
my $count = $config->{workers}->{$worker}->{count} // 0;
my $supervise = $config->{workers}->{$worker}->{supervise} // 0;

next unless $count > 0;
Expand Down
12 changes: 6 additions & 6 deletions lib/LibreCat/Cmd/research_group.pm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ sub _on_all {
sub _list {
my ($self, $query) = @_;

my $sort = $self->opts->{sort} // undef;
my $sort = $self->opts->{sort} // undef;
my $total = $self->opts->{total} // undef;
my $start = $self->opts->{start} // undef;

Expand All @@ -137,9 +137,9 @@ sub _list {

my $count = $it->each(
sub {
my ($item) = @_;
my $id = $item->{_id};
my $name = $item->{name};
my ($item) = @_;
my $id = $item->{_id};
my $name = $item->{name};
my $acronym = $item->{acronym} // '---';

printf "%-40.40s %s %s\n", $id, $acronym, $name;
Expand All @@ -158,7 +158,7 @@ sub _list {
sub _export {
my ($self, $query) = @_;

my $sort = $self->opts->{sort} // undef;
my $sort = $self->opts->{sort} // undef;
my $total = $self->opts->{total} // undef;
my $start = $self->opts->{start} // undef;

Expand Down Expand Up @@ -287,7 +287,7 @@ sub _valid {

unless ($validator->is_valid($item)) {
my $errors = $validator->last_errors();
my $id = $item->{_id} // '';
my $id = $item->{_id} // '';
if ($errors) {
for my $err (@$errors) {
print STDERR "ERROR $id: $err\n";
Expand Down
2 changes: 1 addition & 1 deletion lib/LibreCat/Cmd/schemas.pm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ sub print_properties {
$prefix = '' unless $prefix;

my $properties = $section->{'properties'} // {};
my $required = $section->{'required'} // [];
my $required = $section->{'required'} // [];

for my $name (sort keys %$properties) {
my $prop = $properties->{$name};
Expand Down
Loading

0 comments on commit a87804f

Please sign in to comment.