From 706d65233e1bca5047e0cf0b7e0ad8e3eb50cd4c Mon Sep 17 00:00:00 2001 From: Daniel Mantovani Date: Mon, 12 Aug 2024 13:47:47 -0300 Subject: [PATCH] tidy code --- .gitignore | 47 ++++++++++++++++++++++++----------------------- .perltidyrc | 14 ++++++++++++++ .tidyallrc | 8 ++++++++ t/basic.t | 2 +- t/cron.t | 6 +++--- t/one_crontab.t | 2 +- 6 files changed, 51 insertions(+), 28 deletions(-) create mode 100644 .perltidyrc create mode 100644 .tidyallrc diff --git a/.gitignore b/.gitignore index af9bede..6d91336 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,31 @@ -/blib/ -/.build/ -_build/ -cover_db/ -inc/ -Build !Build/ -Build.bat +!Build/ +!LICENSE +!META.json +*.bs +*.o .last_cover_stats -/Makefile -/Makefile.old +.tidyall.d/ +.vscode/ +.vstags +/.build +/.build/ +/Build +/Build.bat /MANIFEST.bak /META.yml /MYMETA.* -nytprof.out -/pm_to_blib -*.o -*.bs -/_eumm/ -Mojolicious-Plugin-Cron-* +/Makefile +/Makefile.old /Mojolicious-Plugin-Cron-* -/.build /_build_params -/Build -/Build.bat -!Build/ -!META.json -!LICENSE -.vstags -.vscode/ \ No newline at end of file +/_eumm/ +/blib/ +/pm_to_blib +Build +Build.bat +Mojolicious-Plugin-Cron-* +_build/ +cover_db/ +inc/ +nytprof.out diff --git a/.perltidyrc b/.perltidyrc new file mode 100644 index 0000000..a262fce --- /dev/null +++ b/.perltidyrc @@ -0,0 +1,14 @@ +-pbp # Start with Perl Best Practices +-nst # for tidyall +-w # Show all warnings +-iob # Ignore old breakpoints +-l=80 # 80 characters per line +-mbl=2 # No more than 2 blank lines +-i=2 # Indentation is 2 columns +-ci=2 # Continuation indentation is 2 columns +-vt=0 # Less vertical tightness +-pt=2 # High parenthesis tightness +-bt=2 # High brace tightness +-sbt=2 # High square bracket tightness +-wn # Weld nested containers +-isbc # Don't indent comments without leading space diff --git a/.tidyallrc b/.tidyallrc new file mode 100644 index 0000000..8a69686 --- /dev/null +++ b/.tidyallrc @@ -0,0 +1,8 @@ +[PerlTidy] +select = **/*.{pl,pm,t} +select = Build.PL +select = {mod2html,podtree2html,pods2html,perl2html} +argv = --profile=$ROOT/.perltidyrc + +[SortLines] +select = .gitignore \ No newline at end of file diff --git a/t/basic.t b/t/basic.t index 00e3f46..072b1bd 100644 --- a/t/basic.t +++ b/t/basic.t @@ -3,7 +3,7 @@ use warnings; use Test::More tests => 1; BEGIN { - use_ok('Mojolicious::Plugin::Cron'); + use_ok('Mojolicious::Plugin::Cron'); } diag("Testing M::P::Cron $Mojolicious::Plugin::Cron::VERSION"); diff --git a/t/cron.t b/t/cron.t index 5bf5afe..5da7d9d 100644 --- a/t/cron.t +++ b/t/cron.t @@ -90,7 +90,7 @@ ff(Algorithm::Cron->new(base => 'utc', crontab => '0 15 * * *')->next_time(time) undef %global_tstamps; my @utc_at13pm = gmtime; -my $gday = substr fmt_time(@utc_at13pm), 0, 10; +my $gday = substr fmt_time(@utc_at13pm), 0, 10; ff(3610); # 1 h 30 secs from 3PM @@ -104,8 +104,8 @@ is \%global_tstamps, { "$gday 15:50" => {sched1 => 1}, "$gday 15:58" => {sched3 => 1}, "$gday 15:59" => { - sched3 => 1, # means locking works - sched4 => 2 # means all_proc flag works + sched3 => 1, # means locking works + sched4 => 2 # means all_proc flag works }, # no more because hour is always 15 utc }, 'exact tstamps'; diff --git a/t/one_crontab.t b/t/one_crontab.t index d9df17a..3b3e32a 100644 --- a/t/one_crontab.t +++ b/t/one_crontab.t @@ -30,7 +30,7 @@ ff(Algorithm::Cron->new(base => 'local', crontab => '0 15 * * *') ->next_time(time) - time); undef %local_tstamps; my @local_at13pm = localtime; -my $lday = substr fmt_time(@local_at13pm), 0, 10; +my $lday = substr fmt_time(@local_at13pm), 0, 10; ff(3630); # 1 h 30 secs from 3PM, local time is \%local_tstamps, {