X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FSanityChecker.pm;h=ccfc0f3be473df10e7214d7980c2aa5737b8267f;hb=dc7d89911b7bb98c30208cf73af522a99998dcd6;hp=c6b3e50dd70874dedb93d87bbdb2ba6b9ff4c460;hpb=12e7015aa9372aeaf1aaa7e125b8ac8da216deb5;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Schema/SanityChecker.pm b/lib/DBIx/Class/Schema/SanityChecker.pm index c6b3e50..ccfc0f3 100644 --- a/lib/DBIx/Class/Schema/SanityChecker.pm +++ b/lib/DBIx/Class/Schema/SanityChecker.pm @@ -8,7 +8,6 @@ use DBIx::Class::_Util qw( describe_class_methods emit_loud_diag ); use DBIx::Class (); -use DBIx::Class::Exception (); use Scalar::Util qw( blessed refaddr ); use namespace::clean; @@ -21,7 +20,7 @@ DBIx::Class::Schema::SanityChecker - Extensible "critic" for your Schema class h package MyApp::Schema; use base 'DBIx::Class::Schema'; - # this is the default on Perl v5.10 and later + # this is the default setting __PACKAGE__->schema_sanity_checker('DBIx::Class::Schema::SanityChecker'); ... @@ -30,8 +29,8 @@ DBIx::Class::Schema::SanityChecker - Extensible "critic" for your Schema class h This is the default implementation of the Schema and related classes L. -The validator is B on perls C and above. See -L for discussion of the runtime effects. +The validator is B. See L +for discussion of the runtime effects. Use of this class begins by invoking L (usually via L), which in turn starts @@ -101,11 +100,6 @@ test execution time (these numbers are observed with the speedups of L available, without them the slowdown reaches the whopping C<350%>). -Therefore, on these versions of perl the sanity checks are B by -default. Instead a C placeholder value is inserted into the -L, -urging the user to decide for themselves how to proceed. - It is the author's B recommendation to find a way to run the checks on your codebase continuously, even if it takes much longer. Refer to the last paragraph of L above for an example how @@ -346,8 +340,8 @@ sub format_no_indirect_method_overrides_errors { . "chain of calls within the convenience shortcut as seen when running:\n " . '~$ perl -M%2$s -MDevel::Dwarn -e "Ddie { %3$s => %2$s->can(q(%3$s)) }"', join (', ', map { "$_()" } sort @{ $_->{by} } ), - $_->{overriden}{via_class}, - $_->{overriden}{name}, + $_->{overridden}{via_class}, + $_->{overridden}{name}, )} @{ $_[1] } ] } @@ -366,12 +360,21 @@ sub check_no_indirect_method_overrides { for (@$method_stack) { push @$nonsugar_methods, $_ and next - unless $_->{attributes}{DBIC_method_is_indirect_sugar}; + unless( + $_->{attributes}{DBIC_method_is_indirect_sugar} + or + $_->{attributes}{DBIC_method_is_generated_from_resultsource_metadata} + ); push @err, { - overriden => { + overridden => { name => $_->{name}, - via_class => $_->{via_class} + via_class => ( + # this way we report a much better Dwarn oneliner in the error + $_->{attributes}{DBIC_method_is_bypassable_resultsource_proxy} + ? 'DBIx::Class::ResultSource' + : $_->{via_class} + ), }, by => [ map { "$_->{via_class}::$_->{name}" } @$nonsugar_methods ], } if ( @@ -506,7 +509,8 @@ sub check_valid_c3_composition { push @err, { class => $class, - isa => $desc->{isa}, + initial_linear_isa => $desc->{linear_isa}, + current_linear_isa => do { (undef, my @isa) = @{ mro::get_linear_isa($class) }; \@isa }, initial_mro => $desc->{mro}{type}, current_mro => mro::get_mro($class), affected_methods => $affected_methods,