| 1 | # Copyright 2015 - present MongoDB, Inc. | ||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||
| 4 | # you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||
| 5 | # You may obtain a copy of the License at | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||
| 9 | # Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||
| 12 | # See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||
| 13 | # limitations under the License. | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 59 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 59 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | package MongoDB::Role::_BypassValidation; | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # MongoDB interface for optionally applying bypassDocumentValidation | ||||||||||||||||||||||||||||
| 21 | # to a command | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 59 | ▶ | use version; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 59 | our $VERSION = 'v2.2.2'; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 59 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 59 | ▶ | use MongoDB::_Types qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | Boolish | ||||||||||||||||||||||||||||
| 30 | 59 | ); | |||||||||||||||||||||||||||
| 31 | 59 | ▶ | use boolean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 59 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 59 | has bypassDocumentValidation => ( | |||||||||||||||||||||||||||
| 36 | is => 'ro', | ||||||||||||||||||||||||||||
| 37 | isa => Boolish, | ||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | # args not unpacked for efficiency; args are self, validation supported | ||||||||||||||||||||||||||||
| 41 | # flag, original command; returns (possibly modified) command | ||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub _maybe_bypass { | ||||||||||||||||||||||||||
|
Subroutine
_maybe_bypass: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | push @{ $_[2] }, | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_[1] and $_[0]->bypassDocumentValidation
MC/DC0%0/2
$_[1] and $_[0]->bypassDocumentValidation
$_[1]
$_[0]->bypassDocumentValidation
Truth table0%0/3
A and B
A= $_[1]B= $_[0]->bypassDocumentValidation
| |||||||||||||||||||||||||||||
| 44 | bypassDocumentValidation => true if $_[1] && $_[0]->bypassDocumentValidation; | ||||||||||||||||||||||||||||
| 45 | 0 | return $_[2]; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 59 | 1; | |||||||||||||||||||||||||||