Branch Coverage

File:blib/lib/Database/BI.pm
Coverage:91.9%

line%coveragebranch
2737100TFunless $DISC_CACHE_DRIVER{$driver}
2738100TFif defined $cache_conf->{'root_dir'}
274350TFunless $model_dir->is_abs
2781100TFif ($alert_every)
27860TFunless $weak
27880TFunless $ok
2792100TFif defined $self->config("ai_calls_per_hour") and not $self->config("ai_calls_per_hour") =~ /\A[0-9]+\z/u
2807100TFunless length($ENV{'MOJO_LISTEN'} // "")
2815100TFref $secrets eq 'ARRAY' && @{$secrets;} ? :
284350TF$home && -d "$home/Downloads" ? :
2846100TFif (ref $exports eq "ARRAY" and @{$exports;})
284850TF'File::Spec'->file_name_is_absolute($first) ? :
285050TF-e "$dir" ? :
2874100TFif ($page_cache_dir)
288050TFunless $default->is_abs
2905100TF$page_chi ? :
2947100TFunless $c->req->method =~ /\A(?:GET|HEAD)\z/u
2955100TFunless defined $nonce
2979100TFunless defined $headers->header("Referrer-Policy")
2984100TFif (defined(my $features = _permissions_policy($c->app->config)))
2985100TFunless defined $headers->header("Permissions-Policy")
2991100TFif (defined(my $hsts = _strict_transport_security($c)))
299250TFunless defined $headers->header("Strict-Transport-Security")
3000100TFunless defined $headers->header("X-Content-Type-Options")
3003100TFunless ($headers->content_type // "") =~ m[\Atext/html\b]iu
3010100TFunless defined $headers->header("X-Frame-Options")
3016100TFif (defined(my $coop = _cross_origin_opener_policy($c->app->config)))
3017100TFunless defined $headers->header("Cross-Origin-Opener-Policy")
3023100TFunless ref $framers eq "ARRAY"
3027100TF$report_only ? :
3028100TFif defined $policy and not defined $headers->header($name)
3036100TFif (@{$framers;})
3037100TF$report_only ? :
3038100TFunless defined $enforced and $enforced =~ /(?:\A|;)\s*frame-ancestors\b/iu
3061100TFif $c->res->code
3099100TF$jtype =~ /\A(?:left|inner|outer)\z/u ? :
100TF$c->param('d') ? :
100TF($c->param('srccol') // '') =~ /\A[A-Za-z_][A-Za-z0-9_]{0,63}\z/u ? :
311850TFunless $language =~ /\A[a-z]{2}(?:[-_][A-Za-z]{2})?\z/u and -d $c->app->home->child("templates/$platform/$language")
3132100TFif (defined $args->{'text'} and $status == 400 || $status == 403 and $c->req->method eq "GET" and ($c->req->headers->accept // "") =~ m[\btext/html\b]u and not $c->req->url->path->to_string =~ m[\A/api/]u)
3139100TF$status == 403 ? :
3151100TFif defined $args->{'text'} and not defined $c->stash("format")
3154100TFlength($c->app->config('ai_api_key') // '') ? :
100TFunless defined $c->stash("ai_available")
3161100TFdefined $d3_url && !ref($d3_url) && length $d3_url ? :
3170100TFif (($args->{'template'} // "") =~ m[/dashboard\z]u)
3177100TFif ref $active eq "HASH" and not grep({$_ eq $active->{'col'};} @time)
3189100TFif (($args->{'template'} // "") =~ /\Anot_found\.\w+\z/u and (($args->{'format'} // $c->stash("format")) // "html") eq "html")
3199100TFunless (defined $c->stash("trail"))
3206100TFunless (defined $c->stash("preferences_url"))
3211100TFif defined $c->stash("tutorial_chapter")
3214100TFunless $chapter
3237100TFunless $data_path->is_abs
3256100TFif (exists $opts{'url'})
3264100TFexists $opts{'html_table_index'} ? :
326950TFif (exists $opts{'redis'})
327850TFif (exists $opts{'mariadb'})
3285100TFexists $opts{'directory'} ? :
3294100TFexists $opts{'host'} ? :
100TFexists $opts{'file_ext'} ? :
100TFexists $opts{'internal_table'} ? :
100TFexists $opts{'column_order'} ? :
100TF$c->app->config('json_flatten') ? :
3414100TFunless defined $dir and not ref $dir and length $dir
3418100TF$path->is_abs ? :
3430100TFunless -d $uploads_dir
3437100TFif $mtime >= $cutoff
3438100TFif (-d $entry) { }
50TFelsif (-f $entry) { }
3456100TFunless defined $value
3457100TFif ref $value or not length $value or $value eq 0
3458100TF$COOP_VALUES{$value} ? :
3468100TFif not defined $value or not ref $value and !length($value) || $value eq '0' || $COOP_VALUES{$value}
3469100TFref $value ? :
3484100TFunless defined $value
3485100TFif ref $value or not length $value or $value eq 0
3486100TF$value =~ /\A[\x20-\x7e]+\z/u ? :
3497100TFif not defined $value or not ref $value and $value =~ /\A(?:[\x20-\x7e]*)\z/u
3519100TFunless $c->req->is_secure
3522100TFif $host eq "" or $host eq "localhost" or $host =~ /\.localhost\z/u or $host =~ /\A\d{1,3}(?:\.\d{1,3}){3}\z/u or $host =~ /:/u or $host =~ /\A\[/u
3526100TFunless defined $value
3527100TFif ref $value or not length $value or $value eq 0
3528100TF$value =~ /$HSTS_RE/u ? :
3538100TFif not defined $value or not ref $value and !length($value) || $value eq '0'
3539100TFif not ref $value and $value =~ /$HSTS_RE/u
3540100TFref $value ? :
3555100TFunless defined $hash and not ref $hash and length $hash
3556100TFif ref $dirs eq "ARRAY" and @{$dirs;}
3571100TFif (defined $hash and ref $hash || length $hash)
3573100TFunless Database::BI::Password::is_password_hash($hash)
3576100TFif defined $expiration and ref $expiration || !($expiration =~ /\A[0-9]+\z/u) || $expiration < 60
3596100TFif defined $hash and length $hash
360250TFif $ENV{'HYPNOTOAD_APP'} and ref $hypnotoad eq "HASH" and ref $hypnotoad->{'listen'} eq "ARRAY"
3605100TFif $host eq "localhost" or $host =~ /\A127\./u or $host eq "[::1]" or $host eq "::1"
3625100TFunless defined $value
3626100TFunless ref $value eq "ARRAY"
3629100TFunless defined $name and not ref $name and $name =~ /\A(?:\*\.)?[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)+\z/u
3648100TFunless defined $value
3649100TFunless ref $value eq "HASH"
365350TFif $ok
3666100TFif (defined $command)
3667100TFif ref $command
3669100TFunless defined $every and ref $every || length $every
367050TFif ref $every
3672100TFunless defined $seconds
3673100TFif $seconds < 60
3687100TFunless defined $value and ref $value || length $value
3688100TFif ref $value
3689100TFif $value eq "BI_DEFAULT_INSECURE_SECRET"
3691100TFif length $value < 16
3706100TFunless defined $value
3707100TFunless ref $value eq "ARRAY"
3709100TFunless defined $root and not ref $root and length $root
3711100TF'File::Spec'->file_name_is_absolute($root) ? :
3712100TFunless -d $dir
3726100TFunless defined $value
3727100TFunless ref $value eq "ARRAY"
3729100TFunless defined $dir and not ref $dir and length $dir
373150TF'File::Spec'->file_name_is_absolute($dir) ? :
3732100TFunless -d $path
3735100TFif (ref $roots eq "ARRAY" and @{$roots;})
3738100TFunless Database::BI::Controller::Dashboard::_inside_any($path, @real)
3742100TFif /\A\./u and $_ ne "."
100TFif grep {$_ ne ".." if /\A\./u and $_ ne ".";} "File::Spec"->splitdir("Mojo::File"->new($path)->realpath->to_string)
3757100TFunless defined $value
3758100TFunless ref $value eq "ARRAY"
3761100TFunless defined $name and not ref $name and $name =~ /\A(?:\*|(?:\*\.)?[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)*)\z/u
3779100TFunless defined $value
3781100TFref $value ? :
100TFref $value eq 'ARRAY' ? :
3782100TFunless @locations
3785100TFunless defined $location and not ref $location and $location =~ m[\Ahttps?://[^\s,]+\z]u
380450TFunless ref $hypnotoad eq "HASH"
384750TFunless defined $nonce and $nonce =~ /$NONCE_RE/u
3850100TFif (defined $set and not ref $set)
3851100TFunless length $set and $set ne 0
385950TFunless defined $url and not ref $url and length $url
3871100TFref $_ eq 'HASH' ? :
100TFref $sources eq 'HASH' ? :
387650TFif defined $_
387950TFdefined $nonce ? :
3912100TFdefined $value && !ref($value) ? :
100TFref $value eq 'ARRAY' ? :
391450TFif defined $_
3924100TFunless defined $value
3925100TFif ref $value and ref $value ne "ARRAY"
3927100TFref $value ? :
3928100TFif defined _frame_origin($entry)
3947100TFunless defined $entry and not ref $entry
3948100TFunless my($scheme, $host, $port) = $entry =~ m[            \A\s*(https?)://            ((?:\*\.)?[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)*)            (?::(\d{1,5}))?            /?\s*\z    ]iux
395450TFif defined $port and $port == 0 || $port > 65535
3955100TFdefined $port ? :
3973100TFunless defined $url and not ref $url and length $url
3975100TFunless ($url =~ m[\A(?:[A-Za-z][A-Za-z0-9+.-]*:)?//]u)
3977100TF$url =~ /\A[A-Za-z][A-Za-z0-9+.-]*:/u ? :
3981100TFif length $scheme and not $scheme =~ /\Ahttps?\z/u
3982100TFlength $scheme ? :
3983100TFlength $scheme ? :
398650TFunless my($host, $port) = $authority =~ /\A([^:]+)(?::(.*))?\z/u
3989100TFif @labels > 1 and $labels[0] =~ /\{/u
3991100TFif $i == 0 and $labels[0] eq "*"
3992100TFunless $labels[$i] =~ /\A[A-Za-z0-9-]+\z/u
3994100TFif (defined $port)
399550TFunless $port =~ /\A(?:\d{1,5}|\{[^}]*\})\z/u
3996100TF$port =~ /\{/u ? :
3998100TFdefined $port ? :