Esempio n. 1
0
 public BuildScoreDetail CalculateScoreDetail(Build build, Metric metric)
 {
     return new BuildScoreDetail
                           {
                               Score =
                                   this.scoreStrategyFactory.GetScoreStrategy(metric.Code)
                                   .GetScore(build, metric),
                               Build = build,
                               Metric = metric
                           };
 }
        public int GetScore(Build build, Metric metric)
        {
            if(build.CodeCoverage == null)
            {
                return 0;
            }

            if(build.CodeCoverage.TotalBlocks <= 0)
            {
                return 0;
            }

            var coverage =  build.CodeCoverage.CoveredBlocks * 100.0 / build.CodeCoverage.TotalBlocks;

            return (int)Math.Round(metric.Weight * coverage);
        }
Esempio n. 3
0
 public IEnumerable<BuildScoreDetail> CalculateScoreDetail(Build build, IEnumerable<Metric> metric)
 {
     return metric.Select(x => this.CalculateScoreDetail(build, x));
 }
        public int GetScore(Build build, Metric metric)
        {
            int codeReviews = build.CodeReviews != null ? build.CodeReviews.Count() : 0;

            return metric.Weight * codeReviews;
        }