private bool ShouldSkipScan(INuGetValidationRequest request)
        {
            var package = _packageService.FindPackageByIdAndVersionStrict(
                request.PackageId,
                request.PackageVersion);

            if (!_criteriaEvaluator.IsMatch(_configuration.PackageCriteria, package))
            {
                _logger.LogInformation(
                    "The scan for {ValidationId} ({PackageId} {PackageVersion}) was skipped due to package criteria configuration.",
                    request.ValidationId,
                    request.PackageId,
                    request.PackageVersion);

                return(true);
            }

            return(false);
        }
示例#2
0
        private bool ShouldSkip(IValidationRequest request)
        {
            var package = _packageService.FindPackageByIdAndVersionStrict(
                request.PackageId,
                request.PackageVersion)?.EntityRecord;

            if (!_criteriaEvaluator.IsMatch(_config.Value.PackageCriteria, package))
            {
                // This means the validation has already started. This is acceptable so we should move on.
                _logger.LogInformation(
                    "The VCS validation for {validationId} ({packageId} {packageVersion}) was skipped due to package criteria configuration.",
                    request.ValidationId,
                    request.PackageId,
                    request.PackageVersion);

                return(true);
            }

            return(false);
        }
        private bool ShouldSkipScan(IValidationRequest request)
        {
            var symbolPackage = _symbolPackageService
                                .FindSymbolPackagesByIdAndVersion(request.PackageId, request.PackageVersion)
                                .FirstOrDefault(sp => sp.Key == request.PackageKey);

            if (symbolPackage == null)
            {
                throw new InvalidDataException($"The expected symbol package for {request.PackageId} {request.PackageVersion} not found!");
            }

            if (!_criteriaEvaluator.IsMatch(_configuration.PackageCriteria, symbolPackage))
            {
                _logger.LogInformation(
                    "The scan for {ValidationId} ({PackageId} {PackageVersion}) was skipped due to package criteria configuration.",
                    request.ValidationId,
                    request.PackageId,
                    request.PackageVersion);

                return(true);
            }

            return(false);
        }
示例#4
0
 public bool IsMatch(ICriteria criteria, SymbolPackage entity)
 {
     return(_packageCriteriaEvaluator.IsMatch(criteria, entity.Package));
 }