line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::DBCritic::Policy::BidirectionalRelationship; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
4409
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
189
|
|
4
|
5
|
|
|
5
|
|
18
|
use utf8; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
34
|
|
5
|
5
|
|
|
5
|
|
105
|
use Modern::Perl '2011'; ## no critic (Modules::ProhibitUseQuotedVersion) |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
34
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.021'; # TRIAL VERSION |
8
|
5
|
|
|
5
|
|
734
|
use English '-no_match_vars'; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
38
|
|
9
|
5
|
|
|
5
|
|
1788
|
use Moo; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
32
|
|
10
|
5
|
|
|
5
|
|
1638
|
use Sub::Quote; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
470
|
|
11
|
5
|
|
|
5
|
|
26
|
use namespace::autoclean -also => qr{\A _}xms; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
72
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has description => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
default => quote_sub q{'Missing bidirectional relationship'}, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
has explanation => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
default => quote_sub |
20
|
|
|
|
|
|
|
q{'Related tables should have relationships defined in both classes.'}, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub violates { |
24
|
|
|
|
|
|
|
my $source = shift->element; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return join "\n", |
27
|
|
|
|
|
|
|
map { _message( $source->name, $source->related_source($ARG)->name ) } |
28
|
|
|
|
|
|
|
grep { !keys %{ $source->reverse_relationship_info($ARG) } } |
29
|
|
|
|
|
|
|
$source->relationships; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _message { return "$ARG[0] to $ARG[1] not reciprocated" } |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
with 'App::DBCritic::PolicyType::ResultSource'; |
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# ABSTRACT: Check for missing bidirectional relationships in ResultSources |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |