line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::DBCritic::Policy::NoPrimaryKey; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
7845
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
201
|
|
4
|
5
|
|
|
5
|
|
25
|
use utf8; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
34
|
|
5
|
5
|
|
|
5
|
|
116
|
use Modern::Perl '2011'; ## no critic (Modules::ProhibitUseQuotedVersion) |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
38
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.021'; # TRIAL VERSION |
8
|
5
|
|
|
5
|
|
884
|
use Moo; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
37
|
|
9
|
5
|
|
|
5
|
|
1596
|
use Sub::Quote; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
453
|
|
10
|
5
|
|
|
5
|
|
2727
|
use namespace::autoclean -also => qr{\A _}xms; |
|
5
|
|
|
|
|
6252
|
|
|
5
|
|
|
|
|
47
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has description => ( is => 'ro', default => quote_sub q{'No primary key'} ); |
13
|
|
|
|
|
|
|
has explanation => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
default => quote_sub |
16
|
|
|
|
|
|
|
q{'Tables should have one or more columns defined as a primary key.'}, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub violates { |
20
|
|
|
|
|
|
|
my $source = shift->element; |
21
|
|
|
|
|
|
|
return $source->name . ' has no primary key' if !$source->primary_columns; |
22
|
|
|
|
|
|
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
with 'App::DBCritic::PolicyType::ResultSource'; |
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# ABSTRACT: Check for DBIx::Class::Schema::ResultSources without primary keys |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |