private ProfileComparisonResult IsQualityUpgradable(QualityProfile profile, List <QualityModel> currentQualities, QualityModel newQuality = null)
        {
            if (newQuality != null)
            {
                var totalCompare = 0;

                foreach (var quality in currentQualities)
                {
                    var compare = new QualityModelComparer(profile).Compare(newQuality, quality);

                    totalCompare += compare;

                    if (compare < 0)
                    {
                        // Not upgradable if new quality is a downgrade for any current quality
                        return(ProfileComparisonResult.Downgrade);
                    }
                }

                // Not upgradable if new quality is equal to all current qualities
                if (totalCompare == 0)
                {
                    return(ProfileComparisonResult.Equal);
                }

                // Quality Treated as Equal if Propers are not Prefered
                if (_configService.DownloadPropersAndRepacks == ProperDownloadTypes.DoNotPrefer &&
                    newQuality.Revision.CompareTo(currentQualities.Min(q => q.Revision)) > 0)
                {
                    return(ProfileComparisonResult.Equal);
                }
            }

            return(ProfileComparisonResult.Upgrade);
        }
Exemple #2
0
        public virtual void SetupDefaultProfiles()
        {
            if (All().Count != 0)
            {
                return;
            }

            Logger.Info("Setting up default quality profiles");

            var sd = new QualityProfile {
                Name = "SD", Allowed = new List <QualityTypes> {
                    QualityTypes.SDTV, QualityTypes.DVD
                }, Cutoff = QualityTypes.SDTV
            };

            var hd = new QualityProfile
            {
                Name    = "HD",
                Allowed = new List <QualityTypes> {
                    QualityTypes.HDTV720p, QualityTypes.WEBDL720p, QualityTypes.Bluray720p
                },
                Cutoff = QualityTypes.HDTV720p
            };

            Add(sd);
            Add(hd);
        }
        public void should_lazyload_quality_profile()
        {
            var profile = new QualityProfile
            {
                Allowed = new List <Quality>
                {
                    Quality.Bluray1080p,
                    Quality.DVD,
                    Quality.HDTV720p
                },

                Cutoff = Quality.Bluray1080p,
                Name   = "TestProfile"
            };


            Mocker.Resolve <QualityProfileRepository>().Insert(profile);

            var series = Builder <Series> .CreateNew().BuildNew();

            series.QualityProfileId = profile.Id;

            Subject.Insert(series);


            StoredModel.QualityProfile.Should().NotBeNull();
        }
        public void IsUpgradeTestLanguage(Quality current, int currentVersion, Language currentLanguage, Quality newQuality, int newVersion, Language newLanguage, Quality cutoff, Language languageCutoff, bool expected)
        {
            GivenAutoDownloadPropers(ProperDownloadTypes.PreferAndUpgrade);

            var profile = new QualityProfile
            {
                UpgradeAllowed = true,
                Items          = Qualities.QualityFixture.GetDefaultQualities(),
                Cutoff         = cutoff.Id,
            };

            var langProfile = new LanguageProfile
            {
                UpgradeAllowed = true,
                Languages      = LanguageFixture.GetDefaultLanguages(),
                Cutoff         = languageCutoff
            };

            Subject.IsUpgradable(
                profile,
                langProfile,
                new QualityModel(current, new Revision(version: currentVersion)),
                currentLanguage,
                NoPreferredWordScore,
                new QualityModel(newQuality, new Revision(version: newVersion)),
                newLanguage,
                NoPreferredWordScore)
            .Should().Be(expected);
        }
Exemple #5
0
        public void should_lazyload_profiles()
        {
            var profile = new QualityProfile
            {
                Items = Qualities.QualityFixture.GetDefaultQualities(Quality.FLAC, Quality.MP3_320, Quality.MP3_320),

                Cutoff = Quality.FLAC.Id,
                Name   = "TestProfile"
            };

            var metaProfile = new MetadataProfile
            {
                Name = "TestProfile"
            };

            Mocker.Resolve <QualityProfileRepository>().Insert(profile);
            Mocker.Resolve <MetadataProfileRepository>().Insert(metaProfile);

            var author = Builder <Author> .CreateNew().BuildNew();

            author.QualityProfileId  = profile.Id;
            author.MetadataProfileId = metaProfile.Id;

            Subject.Insert(author);

            StoredModel.QualityProfile.Should().NotBeNull();
            StoredModel.MetadataProfile.Should().NotBeNull();
        }
Exemple #6
0
        public void should_lazyload_profiles()
        {
            var profile = new QualityProfile
            {
                Items = Qualities.QualityFixture.GetDefaultQualities(Quality.FLAC, Quality.MP3_192, Quality.MP3_320),

                Cutoff = Quality.FLAC.Id,
                Name   = "TestProfile"
            };

            var metaProfile = new MetadataProfile
            {
                Name = "TestProfile",
                PrimaryAlbumTypes   = new List <ProfilePrimaryAlbumTypeItem>(),
                SecondaryAlbumTypes = new List <ProfileSecondaryAlbumTypeItem>(),
                ReleaseStatuses     = new List <ProfileReleaseStatusItem>()
            };


            Mocker.Resolve <QualityProfileRepository>().Insert(profile);
            Mocker.Resolve <MetadataProfileRepository>().Insert(metaProfile);

            var artist = Builder <Artist> .CreateNew().BuildNew();

            artist.QualityProfileId  = profile.Id;
            artist.MetadataProfileId = metaProfile.Id;

            Subject.Insert(artist);


            StoredModel.QualityProfile.Should().NotBeNull();
            StoredModel.MetadataProfile.Should().NotBeNull();
        }
        public void should_return_false_if_proper_and_autoDownloadPropers_is_do_not_prefer()
        {
            GivenAutoDownloadPropers(ProperDownloadTypes.DoNotPrefer);

            var profile = new QualityProfile
            {
                Items = Qualities.QualityFixture.GetDefaultQualities(),
            };

            var langProfile = new LanguageProfile
            {
                Languages = LanguageFixture.GetDefaultLanguages(),
                Cutoff    = Language.English
            };


            Subject.IsUpgradable(
                profile,
                langProfile,
                new QualityModel(Quality.DVD, new Revision(version: 1)),
                Language.English,
                NoPreferredWordScore,
                new QualityModel(Quality.DVD, new Revision(version: 2)),
                Language.English,
                NoPreferredWordScore)
            .Should().BeFalse();
        }
        public void should_return_false_if_quality_profile_does_not_allow_upgrades_but_cutoff_is_set_to_highest_quality_and_language_cutoff_is_met()
        {
            QualityProfile _profile = new QualityProfile
            {
                Cutoff         = Quality.WEBDL1080p.Id,
                Items          = Qualities.QualityFixture.GetDefaultQualities(),
                UpgradeAllowed = false
            };

            LanguageProfile _langProfile = new LanguageProfile
            {
                Cutoff         = Language.English,
                Languages      = LanguageFixture.GetDefaultLanguages(Language.Spanish, Language.English, Language.Arabic),
                UpgradeAllowed = true
            };

            Subject.CutoffNotMet(
                _profile,
                _langProfile,
                new QualityModel(Quality.WEBDL1080p),
                Language.English,
                NoPreferredWordScore,
                new QualityModel(Quality.Bluray1080p),
                NoPreferredWordScore).Should().BeFalse();
        }
Exemple #9
0
        public void should_lazyload_quality_profile()
        {
            var profile = new QualityProfile
            {
                Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p),

                Cutoff = Quality.Bluray1080p.Id,
                Name   = "TestProfile"
            };

            var langProfile = new LanguageProfile
            {
                Name      = "TestProfile",
                Languages = Languages.LanguageFixture.GetDefaultLanguages(Language.English),
                Cutoff    = Language.English
            };


            Mocker.Resolve <QualityProfileRepository>().Insert(profile);
            Mocker.Resolve <LanguageProfileRepository>().Insert(langProfile);

            var series = Builder <Series> .CreateNew().BuildNew();

            series.QualityProfileId  = profile.Id;
            series.LanguageProfileId = langProfile.Id;

            Subject.Insert(series);


            StoredModel.QualityProfile.Should().NotBeNull();
            StoredModel.LanguageProfile.Should().NotBeNull();
        }
        public void should_return_true_if_cutoffs_are_met_and_score_is_higher()
        {
            QualityProfile _profile = new QualityProfile
            {
                Cutoff         = Quality.HDTV720p.Id,
                Items          = Qualities.QualityFixture.GetDefaultQualities(),
                UpgradeAllowed = true
            };

            LanguageProfile _langProfile = new LanguageProfile
            {
                Cutoff         = Language.Spanish,
                Languages      = LanguageFixture.GetDefaultLanguages(),
                UpgradeAllowed = true
            };

            Subject.CutoffNotMet(
                _profile,
                _langProfile,
                new QualityModel(Quality.HDTV720p, new Revision(version: 2)),
                Language.Spanish,
                NoPreferredWordScore,
                new QualityModel(Quality.Bluray1080p, new Revision(version: 2)),
                10).Should().BeTrue();
        }
        public void should_return_true_if_cutoffs_are_met_but_is_a_revision_upgrade()
        {
            QualityProfile _profile = new QualityProfile
            {
                Cutoff         = Quality.HDTV1080p.Id,
                Items          = Qualities.QualityFixture.GetDefaultQualities(),
                UpgradeAllowed = true
            };

            LanguageProfile _langProfile = new LanguageProfile
            {
                Cutoff         = Language.English,
                Languages      = LanguageFixture.GetDefaultLanguages(),
                UpgradeAllowed = true
            };

            Subject.CutoffNotMet(
                _profile,
                _langProfile,
                new QualityModel(Quality.WEBDL1080p, new Revision(version: 1)),
                Language.English,
                NoPreferredWordScore,
                new QualityModel(Quality.WEBDL1080p, new Revision(version: 2)),
                NoPreferredWordScore).Should().BeTrue();
        }
        private QualityProfileResource GetSchema()
        {
            QualityProfile qualityProfile = _profileService.GetDefaultProfile(string.Empty);


            return(qualityProfile.ToResource());
        }
Exemple #13
0
        public bool IsUpgradable(QualityProfile qualityProfile, LanguageProfile languageProfile, QualityModel currentQuality, Language currentLanguage, int currentScore, QualityModel newQuality, Language newLanguage, int newScore)
        {
            var qualityComparer           = new QualityModelComparer(qualityProfile);
            var qualityCompare            = qualityComparer.Compare(newQuality?.Quality, currentQuality.Quality);
            var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;

            if (qualityCompare > 0)
            {
                _logger.Debug("New item has a better quality");
                return(true);
            }

            if (qualityCompare < 0)
            {
                _logger.Debug("Existing item has better quality, skipping");
                return(false);
            }

            var qualityRevisionComapre = newQuality?.Revision.CompareTo(currentQuality.Revision);

            // Accept unless the user doesn't want to prefer propers, optionally they can
            // use preferred words to prefer propers/repacks over non-propers/repacks.
            if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
                qualityRevisionComapre > 0)
            {
                _logger.Debug("New item has a better quality revision");
                return(true);
            }

            // Reject unless the user does not prefer propers/repacks and it's a revision downgrade.
            if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
                qualityRevisionComapre < 0)
            {
                _logger.Debug("Existing item has a better quality revision, skipping");
                return(false);
            }

            var languageCompare = new LanguageComparer(languageProfile).Compare(newLanguage, currentLanguage);

            if (languageCompare > 0)
            {
                _logger.Debug("New item has a more preferred language");
                return(true);
            }

            if (languageCompare < 0)
            {
                _logger.Debug("Existing item has better language, skipping");
                return(false);
            }

            if (!IsPreferredWordUpgradable(currentScore, newScore))
            {
                _logger.Debug("Existing item has an equal or better preferred word score, skipping");
                return(false);
            }

            _logger.Debug("New item has a better preferred word score");
            return(true);
        }
        private ProfileComparisonResult IsQualityUpgradable(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null)
        {
            if (newQuality != null)
            {
                var totalCompare = 0;

                var compare = new QualityModelComparer(profile).Compare(newQuality, currentQuality);

                totalCompare += compare;

                if (compare < 0)
                {
                    // Not upgradable if new quality is a downgrade for any current quality
                    return(ProfileComparisonResult.Downgrade);
                }

                // Not upgradable if new quality is equal to all current qualities
                if (totalCompare == 0)
                {
                    return(ProfileComparisonResult.Equal);
                }

                // Accept unless the user doesn't want to prefer propers, optionally they can
                // use preferred words to prefer propers/repacks over non-propers/repacks.
                if (_configService.DownloadPropersAndRepacks == ProperDownloadTypes.DoNotPrefer &&
                    newQuality?.Revision.CompareTo(currentQuality.Revision) > 0)
                {
                    return(ProfileComparisonResult.Equal);
                }
            }

            return(ProfileComparisonResult.Upgrade);
        }
        public void LatestServer_APICompatibility()
        {
            // Arrange the service used to interact with SQ
            var s          = new SonarQubeServiceWrapper(this.serviceProvider);
            var connection = new ConnectionInformation(new Uri("https://sonarqube.com"));

            // Step 1: Connect anonymously
            ProjectInformation[] projects = null;

            RetryAction(() => s.TryGetProjects(connection, CancellationToken.None, out projects),
                        "Get projects from SonarQube server");
            projects.Should().NotBeEmpty("No projects were returned");

            // Step 2: Get quality profile for the first project
            var            project = projects.FirstOrDefault();
            QualityProfile profile = null;

            RetryAction(() => s.TryGetQualityProfile(connection, project, Language.CSharp, CancellationToken.None, out profile),
                        "Get quality profile from SonarQube server");
            profile.Should().NotBeNull("No quality profile was returned");

            // Step 3: Get quality profile export for the quality profile
            RoslynExportProfile export = null;

            RetryAction(() => s.TryGetExportProfile(connection, profile, Language.CSharp, CancellationToken.None, out export),
                        "Get quality profile export from SonarQube server");
            export.Should().NotBeNull("No quality profile export was returned");

            // Errors are logged to output window pane and we don't expect any
            this.outputWindowPane.AssertOutputStrings(0);
        }
        public bool IsUpgradable(QualityProfile qualityProfile, List <QualityModel> currentQualities, int currentScore, QualityModel newQuality, int newScore)
        {
            var qualityUpgrade = IsQualityUpgradable(qualityProfile, currentQualities, newQuality);

            if (qualityUpgrade == ProfileComparisonResult.Upgrade)
            {
                _logger.Debug("New item has a better quality");
                return(true);
            }

            if (qualityUpgrade == ProfileComparisonResult.Downgrade)
            {
                _logger.Debug("Existing item has better quality, skipping");
                return(false);
            }

            if (!IsPreferredWordUpgradable(currentScore, newScore))
            {
                _logger.Debug("Existing item has a better preferred word score, skipping");
                return(false);
            }

            _logger.Debug("New item has a better preferred word score");
            return(true);
        }
        public void Test_Series_Quality()
        {
            //Arrange
            var database = TestDbHelper.GetEmptyDatabase();

            var testProfile = new QualityProfile
            {
                Name    = Guid.NewGuid().ToString(),
                Cutoff  = QualityTypes.SDTV,
                Allowed = new List <QualityTypes> {
                    QualityTypes.HDTV720p, QualityTypes.DVD
                },
            };


            var profileId = Convert.ToInt32(database.Insert(testProfile));

            var series = Builder <Series> .CreateNew().Build();

            series.QualityProfileId = profileId;

            database.Insert(testProfile);
            database.Insert(series);

            var result = database.Fetch <Series>();

            result.Should().HaveCount(1);
            var profile = database.SingleOrDefault <QualityProfile>(result[0].QualityProfileId);

            Assert.AreEqual(profileId, result[0].QualityProfileId);
            Assert.AreEqual(testProfile.Name, profile.Name);
        }
        public void Update_Success()
        {
            //Arrange

            var db = TestDbHelper.GetEmptyDatabase();

            Mocker.SetConstant(db);

            var testProfile = new QualityProfile
            {
                Name   = Guid.NewGuid().ToString(),
                Cutoff = QualityTypes.SDTV
            };

            //Act
            var id             = Convert.ToInt32(db.Insert(testProfile));
            var currentProfile = db.SingleOrDefault <QualityProfile>(id);


            //Update
            currentProfile.Cutoff = QualityTypes.Bluray720p;
            Mocker.Resolve <QualityProvider>().Update(currentProfile);

            var updated = Mocker.Resolve <QualityProvider>().Get(currentProfile.QualityProfileId);

            //Assert
            updated.Name.Should().Be(currentProfile.Name);
            updated.Cutoff.Should().Be(QualityTypes.Bluray720p);
            updated.AllowedString.Should().Be(currentProfile.AllowedString);
        }
Exemple #19
0
        public void GetQualityProfile_ReturnsExpectedProfile()
        {
            // Arrange
            // Populate a profile to return
            var csProfile = new QualityProfile(Language.CSharp, null);

            wrappedProvider.ProfilesToReturnByLanguage[Language.CSharp] = csProfile;

            var testSubject = CreateTestSubjectWithInitialFetchCompleted();

            serviceMock.ResetCalls();
            wrappedProvider.ResetCalls();

            // Act & Assert - profile for language exists
            var actual = testSubject.GetQualityProfile(new BoundSonarQubeProject(), Language.CSharp);

            actual.Should().BeSameAs(csProfile);

            // Act & Assert - profile for language does not exist
            actual = testSubject.GetQualityProfile(new BoundSonarQubeProject(), Language.VBNET);
            actual.Should().BeNull();

            // Additional checks
            VerifyServiceIsConnected(Times.Never()); // should use cached data
            wrappedProvider.GetQualityProfileCallCount.Should().Be(0);
        }
        public bool IsUpgradeAllowed(QualityProfile qualityProfile, LanguageProfile languageProfile, QualityModel currentQuality, Language currentLanguage, QualityModel newQuality, Language newLanguage)
        {
            var isQualityUpgrade  = new QualityModelComparer(qualityProfile).Compare(newQuality, currentQuality) > 0;
            var isLanguageUpgrade = new LanguageComparer(languageProfile).Compare(newLanguage, currentLanguage) > 0;

            if (isQualityUpgrade && qualityProfile.UpgradeAllowed ||
                isLanguageUpgrade && languageProfile.UpgradeAllowed)
            {
                _logger.Debug("At least one profile allows upgrading");
                return(true);
            }

            if (isQualityUpgrade && !qualityProfile.UpgradeAllowed)
            {
                _logger.Debug("Quality profile does not allow upgrades, skipping");
                return(false);
            }

            if (isLanguageUpgrade && !languageProfile.UpgradeAllowed)
            {
                _logger.Debug("Language profile does not allow upgrades, skipping");
                return(false);
            }

            return(true);
        }
        public async Task SonarQubeServiceWrapper_DownloadQualityProfile_ProjectWithAnalysis()
        {
            using (var testSubject = new TestableSonarQubeServiceWrapper(this.serviceProvider))
            {
                // Setup
                HttpClient     httpClient      = testSubject.CreateHttpClient();
                var            language        = Language.CSharp;
                QualityProfile expectedProfile = CreateRandomQualityProfile(language);
                var            project         = new ProjectInformation {
                    Key = "awesome1", Name = "My Awesome Project"
                };
                ConfigureValidConnection(testSubject, new[] { project });

                // Setup test server
                RegisterQualityProfileQueryValidator(testSubject);

                RequestHandler handler = testSubject.RegisterRequestHandler(
                    SonarQubeServiceWrapper.CreateQualityProfileUrl(language, project),
                    ctx => ServiceQualityProfiles(ctx, new[] { expectedProfile })
                    );

                // Act
                QualityProfile actualProfile = await SonarQubeServiceWrapper.DownloadQualityProfile(httpClient, project, language, CancellationToken.None);

                // Verify
                Assert.IsNotNull(actualProfile, "Expected a quality profile");
                Assert.AreEqual(expectedProfile.Key, actualProfile.Key, "Unexpected quality profile returned");
                handler.AssertHandlerCalled(1);
            }
        }
        private void SonarQubeServiceWrapper_TryGetExportProfile(Language language)
        {
            using (var testSubject = new TestableSonarQubeServiceWrapper(this.serviceProvider))
            {
                // Setup
                QualityProfile profile = CreateRandomQualityProfile(language);
                var            project = new ProjectInformation {
                    Key = "awesome1", Name = "My Awesome Project"
                };
                var expectedExport         = RoslynExportProfileHelper.CreateExport(ruleSet: TestRuleSetHelper.CreateTestRuleSet(3));
                var roslynExporter         = SonarQubeServiceWrapper.CreateRoslynExporterName(language);
                ConnectionInformation conn = ConfigureValidConnection(testSubject, new[] { project });

                // Setup test server
                RegisterProfileExportQueryValidator(testSubject);

                RequestHandler getExportHandler = testSubject.RegisterRequestHandler(
                    SonarQubeServiceWrapper.CreateQualityProfileExportUrl(profile, language, roslynExporter),
                    ctx => ServiceProfileExport(ctx, expectedExport)
                    );

                // Act
                RoslynExportProfile actualExport;
                Assert.IsTrue(testSubject.TryGetExportProfile(conn, profile, language, CancellationToken.None, out actualExport), "TryGetExportProfile failed unexpectedly");

                // Verify
                Assert.IsNotNull(actualExport, "Expected a profile export to be returned");
                RoslynExportProfileHelper.AssertAreEqual(expectedExport, actualExport);
                getExportHandler.AssertHandlerCalled(1);
            }
        }
Exemple #23
0
        public void Setup()
        {
            SqlBuilderExtensions.LogSql = true;

            var profile = new QualityProfile
            {
                Name   = "Test",
                Cutoff = Quality.MP3.Id,
                Items  = Qualities.QualityFixture.GetDefaultQualities()
            };

            profile = Db.Insert(profile);

            var metadata = Builder <AuthorMetadata> .CreateNew()
                           .With(v => v.Id = 0)
                           .Build();

            Db.Insert(metadata);

            var author = Builder <Author> .CreateListOfSize(1)
                         .All()
                         .With(v => v.Id = 0)
                         .With(v => v.QualityProfileId = profile.Id)
                         .With(v => v.AuthorMetadataId = metadata.Id)
                         .BuildListOfNew();

            Db.InsertMany(author);

            var books = Builder <Book> .CreateListOfSize(3)
                        .All()
                        .With(v => v.Id = 0)
                        .With(v => v.AuthorMetadataId = metadata.Id)
                        .BuildListOfNew();

            Db.InsertMany(books);

            var editions = new List <Edition>();

            foreach (var book in books)
            {
                editions.Add(
                    Builder <Edition> .CreateNew()
                    .With(v => v.Id               = 0)
                    .With(v => v.BookId           = book.Id)
                    .With(v => v.ForeignEditionId = "test" + book.Id)
                    .Build());
            }

            Db.InsertMany(editions);

            var trackFiles = Builder <BookFile> .CreateListOfSize(1)
                             .All()
                             .With(v => v.Id        = 0)
                             .With(v => v.EditionId = editions[0].Id)
                             .With(v => v.Quality   = new QualityModel())
                             .BuildListOfNew();

            Db.InsertMany(trackFiles);
        }
Exemple #24
0
        private void WithWebdlCutoff()
        {
            var profile = new QualityProfile {
                Cutoff = QualityTypes.WEBDL720p
            };

            Mocker.GetMock <QualityProvider>().Setup(s => s.Get(It.IsAny <int>())).Returns(profile);
        }
Exemple #25
0
        public QualityModel GetBestQualityInHistory(QualityProfile qualityProfile, int episodeId)
        {
            var comparer = new QualityModelComparer(qualityProfile);

            return(_historyRepository.GetBestQualityInHistory(episodeId)
                   .OrderByDescending(q => q, comparer)
                   .FirstOrDefault());
        }
 public void Setup()
 {
     _profile = new QualityProfile {
         Cutoff = Quality.WEBDL720p, Items = QualityFixture.GetDefaultQualities()
     };
     _profileCustom = new QualityProfile {
         Cutoff = Quality.WEBDL720p, Items = QualityFixture.GetDefaultQualities(Quality.DVD)
     };
 }
Exemple #27
0
        public virtual void Update(QualityProfile profile)
        {
            if (!_database.Exists <QualityProfile>("WHERE QualityProfileid = @0", profile.QualityProfileId))
            {
                Logger.Error("Unable to update non-existing profile");
                throw new InvalidOperationException("Unable to update non-existing profile");
            }

            _database.Update(profile);
        }
        private bool CheckUpgradeAllowed(QualityProfile qualityProfile, ProfileComparisonResult isQualityUpgrade)
        {
            if (isQualityUpgrade == ProfileComparisonResult.Upgrade && !qualityProfile.UpgradeAllowed)
            {
                _logger.Debug("Quality profile does not allow upgrades, skipping");
                return(false);
            }

            return(true);
        }
        private List <QualityProfileResource> GetAll()
        {
            var profile = new QualityProfile();

            profile.Cutoff  = Quality.Unknown;
            profile.Allowed = new List <Quality>();

            return(new List <QualityProfileResource> {
                QualityToResource(profile)
            });
        }
Exemple #30
0
        private QualityProfile ConfigureProfileExport(RoslynExportProfile export, Language language)
        {
            var profile = new QualityProfile {
                Language = SonarQubeServiceWrapper.GetServerLanguageKey(language)
            };

            this.sonarQubeService.ReturnProfile[language] = profile;
            this.sonarQubeService.ReturnExport[profile]   = export;

            return(profile);
        }