public override void Calc(IRepository repository)
        {
            base.Calc(repository);

            x = new double[dates.Count()];
            tdd = new double[dates.Count()];
            dd = new double[dates.Count()];
            string revision = null;

            for (int i = 0; i < dates.Length; i++)
            {
                x[i] = (dates[i] - dates[0]).TotalDays;
                var code = repository.SelectionDSL()
                    .Commits()
                        .DateIsLesserOrEquelThan(dates[i])
                        .Do(c =>
                            revision = repository.Queryable<Commit>().Single(cc =>
                                cc.OrderedNumber == c.Max(ccc => ccc.OrderedNumber)
                            ).Revision
                        )
                    .Files()
                        .InDirectory(TargetDir)
                    .Modifications()
                        .InCommits()
                        .InFiles()
                    .CodeBlocks()
                        .InModifications();

                tdd[i] = code.CalculateTraditionalDefectDensity(revision);
                dd[i] = code.CalculateDefectDensity(revision);
            }
        }
Esempio n. 2
0
        public override IDictionary<string, object> BuildData(IRepository repositories)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            var authors = repositories.Queryable<Commit>()
                .Select(x => x.Author)
                .Distinct().ToList();

            var codeByAuthor = (from author in authors select new
            {
                Name = author,
                AddedCode = repositories.SelectionDSL()
                    .Commits().AuthorIs(author)
                    .Files().InDirectory(TargetDir)
                    .Modifications().InFiles()
                    .CodeBlocks().InModifications().AddedInitiallyInCommits()
                    .Fixed(),
            }).ToList();

            var statByAuthor =
                from a in codeByAuthor
                let authorCommits = a.AddedCode.Commits().Again().Count()
                let authorFixes = a.AddedCode.Commits().Again().AreBugFixes().Count()
                let authorRefactorings = a.AddedCode.Commits().Again().AreRefactorings().Count()
            select new
                {
                    name = a.Name,
                    fixes = (double) authorFixes / authorCommits * 100,
                    refactorings = (double) authorRefactorings / authorCommits * 100
                };

            result.Add("authors", statByAuthor.OrderBy(x => x.name).ToArray());

            return result;
        }
Esempio n. 3
0
        protected override double[] DistributionData(IRepository repository)
        {
            var commits = repository.Queryable<Commit>()
                .Select(c => new
                {
                    Revision = c.Revision,
                    Message = c.Message
                }).ToArray();

            List<double> deletedToAdded = new List<double>();
            double added, deleted;

            foreach (var c in commits)
            {
                var code = repository.SelectionDSL()
                    .Commits()
                        .RevisionIs(c.Revision)
                    .Modifications()
                        .InCommits()
                    .CodeBlocks()
                        .InModifications().Fixed();

                added = code.Added().CalculateLOC();
                if (added > 0)
                {
                    deleted = -code.Deleted().CalculateLOC();
                    deletedToAdded.Add(deleted / added);
                }
            }

            return deletedToAdded.ToArray();
        }
Esempio n. 4
0
        public static List <crm_Users> GetListUsersByTenantId(this IRepository <crm_Users> repository, int tenantId)
        {
            var _lstEntity = from k in repository.Queryable()
                             where k.TenantId == tenantId
                             select k;

            return(_lstEntity.ToList());
        }
Esempio n. 5
0
        public static crm_Users GetUserByUsername(this IRepository <crm_Users> repository, string username)
        {
            var _entity = from k in repository.Queryable()
                          where k.Username == username
                          select k;

            return(_entity.FirstOrDefault());
        }
Esempio n. 6
0
        public static crm_Users GetUserById(this IRepository <crm_Users> repository, int id)
        {
            var _entity = from k in repository.Queryable()
                          where k.ID == id
                          select k;

            return(_entity.FirstOrDefault());
        }
Esempio n. 7
0
        public static bool IsLogin(this IRepository <crm_Users> repository, string username, string password)
        {
            bool isOK = repository
                        .Queryable()
                        .Where(x => x.Username == username && x.Password == password).Any();

            return(isOK);
        }
Esempio n. 8
0
        public static List <crm_Users> CheckURL(this IRepository <crm_Users> repository, string provider, string url)
        {
            List <crm_Users> user = new List <crm_Users>();

            try
            {
                string Provider = provider.ToLower().Trim();
                switch (Provider)
                {
                case "google":
                    user = repository
                           .Queryable()
                           .Where(x => x.GoogleplusURL == url).ToList();
                    break;

                case "facebook":
                    user = repository
                           .Queryable()
                           .Where(x => x.FacebookURL == url).ToList();
                    break;

                case "twitter":
                    user = repository
                           .Queryable()
                           .Where(x => x.TwitterURL == url).ToList();
                    break;

                case "linkedin":
                    user = repository
                           .Queryable()
                           .Where(x => x.LinkedURL == url).ToList();
                    break;

                case "microsoft":
                    user = repository
                           .Queryable()
                           .Where(x => x.LinkedURL == url).ToList();
                    break;
                }
            }
            catch (Exception)
            {
            }

            return(user);
        }
Esempio n. 9
0
        public static bool IsUserExist(
            this IRepository <User> repository,
            string userMail)
        {
            var test = repository
                       .Queryable()
                       .Any(x => x.UserName == userMail);

            return(test);
        }
        /// <summary>
        /// Sends an verification email for a given auth0 user.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        public void SendVerification(string userId)
        {
            var user = _repository.Queryable()
                       .Single(x => x.GlobalId == userId);

            var emailTicket       = _emailVerificationRepository.Create(userId);
            var emailVerification = new EmailVerificationMessage(_appSettings, user, emailTicket);

            _postOffice.Send(emailVerification);
        }
Esempio n. 11
0
        public static async Task <bool> IsTeamNameExistAsync(this IRepository <TeamDb> repository,
                                                             int companyId,
                                                             string teamName)
        {
            var result = await repository.Queryable()
                         .AnyAsync(x => x.CompanyId == companyId &&
                                   x.TeamName == teamName);

            return(result);
        }
Esempio n. 12
0
        public override IDictionary<string, object> BuildData(IRepository repositories)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            var authors = repositories.Queryable<Commit>()
                .Select(x => x.Author)
                .Distinct().ToList();

            var codeByAuthor = (from author in authors select new
            {
                Name = author,
                AddedCode = repositories.SelectionDSL()
                    .Commits().AuthorIs(author)
                    .Files().InDirectory(TargetDir)
                    .Modifications().InFiles()
                    .CodeBlocks().InModifications().AddedInitiallyInCommits()
                    .Fixed(),
                RemovedCode = repositories.SelectionDSL()
                    .Commits().AuthorIs(author)
                    .Files().InDirectory(TargetDir)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications().Deleted()
                    .Fixed()
            }).ToList();

            var statByAuthor =
                from a in codeByAuthor
                select new
                {
                    name = a.Name,
                    added_loc = a.AddedCode.CalculateLOC() / (a.AddedCode.CalculateLOC() - a.RemovedCode.CalculateLOC()) * 100,
                    removed_loc = -a.RemovedCode.CalculateLOC() / (a.AddedCode.CalculateLOC() - a.RemovedCode.CalculateLOC()) * 100
                };
            result.Add("authors", statByAuthor.OrderBy(x => x.name).ToArray());

            return result;
        }
Esempio n. 13
0
        public override IDictionary<string, object> BuildData(IRepository repository)
        {
            Dictionary<string,object> result = new Dictionary<string,object>();

            int commits_count = repository.Queryable<Commit>().Count();
            int commits_fix_count = repository.SelectionDSL().Commits().AreBugFixes().Count();
            string commits_fix_percent = ((double)commits_fix_count / commits_count * 100).ToString("F02");
            int commits_refactoring_count = repository.SelectionDSL().Commits().AreRefactorings().Count();
            string commits_refactoring_percent = ((double)commits_refactoring_count / commits_count * 100).ToString("F02");

            DateTime statfrom = repository.Queryable<Commit>().Min(x => x.Date);
            DateTime statto = repository.Queryable<Commit>().Max(x => x.Date);

            result.Add("stat_date", DateTime.Now.ToString());
            result.Add("stat_period_from", statfrom);
            result.Add("stat_period_to", statto);
            result.Add("stat_period_days", (statto - statfrom).Days);
            result.Add("stat_period_years", ((statto - statfrom).TotalDays / 365).ToString("F01"));
            result.Add("authors_count",
                repository.Queryable<Commit>().Select(x => x.Author).Distinct().Count()
            );
            result.Add("commits_count", commits_count);
            result.Add("commits_fix_count", commits_fix_count);
            result.Add("commits_fix_percent", commits_fix_percent);
            result.Add("commits_refactoring_count", commits_refactoring_count);
            result.Add("commits_refactoring_percent", commits_refactoring_percent);
            var files = repository.SelectionDSL()
                .Files().InDirectory(TargetDir)
                .Fixed();
            result.Add("files_current",
                files.Exist().Count()
            );
            result.Add("files_added",
                files.Count()
            );
            result.Add("files_removed",
                files.Deleted().Count()
            );
            var code = repository.SelectionDSL()
                .Files().InDirectory(TargetDir)
                .Modifications().InFiles()
                .CodeBlocks().InModifications()
                .Fixed();
            result.Add("loc_current",
                code.CalculateLOC()
            );
            result.Add("loc_added",
                code.Added().CalculateLOC()
            );
            result.Add("loc_removed",
                - code.Deleted().CalculateLOC()
            );
            result.Add("tdd",
                code.CalculateTraditionalDefectDensity().ToString("F03")
            );
            result.Add("dd",
                code.CalculateDefectDensity().ToString("F03")
            );

            return result;
        }
        public override void Init(IRepository repository)
        {
            authorByRevision = repository.SelectionDSL()
                .Commits().TillRevision(model.PredictionRelease)
                .ToDictionary(x => x.Revision, x => x.Author);

            int releaseRevisionOrderedNumber = repository.Queryable<Commit>()
                .Single(x => x.Revision == model.PredictionRelease).OrderedNumber;
            var codeByAuthorAndFile =
                (
                    from cb in repository.Queryable<CodeBlock>()
                    join m in repository.Queryable<Modification>() on cb.ModificationID equals m.ID
                    join c in repository.Queryable<Commit>() on m.CommitID equals c.ID
                    join f in repository.Queryable<ProjectFile>() on m.FileID equals f.ID
                    where
                        cb.Size > 0
                        &&
                        c.OrderedNumber <= releaseRevisionOrderedNumber
                    group cb by new { Author = c.Author, FileID = f.ID } into g
                    select new
                    {
                        Author = g.Key.Author,
                        FileID = g.Key.FileID,
                        CodeSize = g.Sum(x => x.Size)
                    }
                ).ToArray();

            var allFiles = model.AllFiles.Select(x => x.ID).ToArray();
            var allAuthors = repository.SelectionDSL()
                .Commits().TillRevision(model.PredictionRelease)
                .Select(x => x.Author).Distinct().ToArray();

            int numberOfFiles = allFiles.Count();
            int numberOfAuthors = allAuthors.Count();
            int numberOfEquations = numberOfFiles + numberOfAuthors + 1;
            double[,] equations = new double[numberOfEquations,numberOfEquations];
            double[] results = new double[numberOfEquations];

            int equation = 0;
            double locAdded = codeByAuthorAndFile.Sum(x => x.CodeSize);

            for (int i = 0; i < allFiles.Length; i++)
            {
                double locAddedInFile = codeByAuthorAndFile
                    .Where(x => x.FileID == allFiles[i])
                    .Sum(x => x.CodeSize);
                equations[numberOfEquations-1, i] = locAddedInFile / locAdded;
                equations[equation, i] = 1;

                if (locAddedInFile > 0)
                {
                    double dcd = repository.SelectionDSL()
                        .Commits()
                            .TillRevision(model.PredictionRelease)
                        .Files()
                            .IdIs(allFiles[i])
                        .Modifications().InCommits().InFiles()
                        .CodeBlocks().InModifications().CalculateDefectCodeDensity(model.PredictionRelease);

                    for (int j = 0; j < allAuthors.Length; j++)
                    {
                        double locAddedInFileByAuthor = codeByAuthorAndFile
                            .Where(x => x.FileID == allFiles[i] && x.Author == allAuthors[j])
                            .Sum(x => x.CodeSize);
                        equations[equation, numberOfFiles + j] = (locAddedInFileByAuthor / locAddedInFile);
                    }
                    results[equation] = dcd;
                }
                equation++;
            }

            for (int i = 0; i < allAuthors.Length; i++)
            {
                double locAddedByAuthor = codeByAuthorAndFile
                    .Where(x => x.Author == allAuthors[i])
                    .Sum(x => x.CodeSize);
                equations[numberOfEquations-1, numberOfFiles + i] = locAddedByAuthor / locAdded;
                equations[equation, numberOfFiles + i] = 1;

                if (locAddedByAuthor > 0)
                {
                    double dcd = repository.SelectionDSL()
                        .Commits()
                            .AuthorIs(allAuthors[i])
                            .TillRevision(model.PredictionRelease)
                        .Modifications().InCommits()
                        .CodeBlocks().InModifications().CalculateDefectCodeDensity(model.PredictionRelease);
                    for (int j = 0; j < allFiles.Length; j++)
                    {
                        double locAddedByAuthorInFile = codeByAuthorAndFile
                            .Where(x => x.Author == allAuthors[i] && x.FileID == allFiles[j])
                            .Sum(x => x.CodeSize);
                        equations[equation, j] = (locAddedByAuthorInFile / locAddedByAuthor);
                    }
                    results[equation] = dcd;
                }
                equation++;
            }

            results[numberOfEquations-1] = repository.SelectionDSL()
                .Commits()
                    .TillRevision(model.PredictionRelease)
                .Modifications().InCommits()
                .CodeBlocks().InModifications().CalculateDefectCodeDensity(model.PredictionRelease);

            int varCount = equations.GetUpperBound(1)+1;
            double[,] normalEquations = new double[varCount, varCount];
            double[] normalResults = new double[varCount];
            Func<double[,],double[],int,int,double> nc = (e, r, n1, n2) =>
            {
                double sum = 0;
                for (int i = 0; i < numberOfEquations; i++)
                {
                    if (n2 < numberOfEquations)
                    {
                        sum += e[i,n1] * e[i,n2];
                    }
                    else
                    {
                        sum += e[i,n1] * r[i];
                    }
                }
                return sum;
            };

            for (int i = 0; i < varCount; i++)
            {
                for (int j = 0; j < varCount; j++)
                {
                    normalEquations[i,j] = nc(equations,results,i,j);
                }
                normalResults[i] = nc(equations,results,i,numberOfEquations);
            }
            var DCD = new Accord.Math.Decompositions.SingularValueDecomposition(normalEquations).Solve(normalResults);

            DCDF = new Dictionary<int,double>();
            DCDA = new Dictionary<string,double>();
            double DCD_min = 0.001;
            for (int i = 0; i < allFiles.Length; i++)
            {
                DCDF.Add(allFiles[i], DCD[i] > 0 ? DCD[i] : DCD_min);
            }
            for (int i = 0; i < allAuthors.Length; i++)
            {
                DCDA.Add(allAuthors[i], DCD[numberOfFiles + i] > 0 ? DCD[numberOfFiles + i] : DCD_min);
            }
        }
Esempio n. 15
0
        private bool CheckLinesContent(IRepository repository, IScmData scmData, string testRevision, ProjectFile file, bool resultOnly)
        {
            IBlame fileBlame = null;
            try
            {
                fileBlame = scmData.Blame(testRevision, file.Path);
            }
            catch
            {
            }
            if (fileBlame == null)
            {
                if (! resultOnly)
                {
                    Console.WriteLine("File {0} does not exist.", file.Path);
                }
                return false;
            }

            double currentLOC = repository.SelectionDSL()
                    .Commits().TillRevision(testRevision)
                    .Files().IdIs(file.ID)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications()
                    .CalculateLOC();

            bool correct = currentLOC == fileBlame.Count;

            if (! correct)
            {
                if (! resultOnly)
                {
                    Console.WriteLine("Incorrect number of lines in file {0}. {1} should be {2}",
                        file.Path, currentLOC, fileBlame.Count
                    );
                }
                else
                {
                    return false;
                }
            }

            SmartDictionary<string, int> linesByRevision = new SmartDictionary<string, int>(x => 0);
            foreach (var line in fileBlame)
            {
                linesByRevision[line.Value]++;
            }

            var codeBySourceRevision =
            (
                from f in repository.Queryable<ProjectFile>()
                join m in repository.Queryable<Modification>() on f.ID equals m.FileID
                join cb in repository.Queryable<CodeBlock>() on m.ID equals cb.ModificationID
                join c in repository.Queryable<Commit>() on m.CommitID equals c.ID
                let addedCodeBlock = repository.Queryable<CodeBlock>()
                    .Single(x => x.ID == (cb.Size < 0 ? cb.TargetCodeBlockID : cb.ID))
                let codeAddedInitiallyInRevision = repository.Queryable<Commit>()
                    .Single(x => x.ID == addedCodeBlock.AddedInitiallyInCommitID)
                    .Revision
                let testRevisionNumber = repository.Queryable<Commit>()
                    .Single(x => x.Revision == testRevision)
                    .OrderedNumber
                where
                    f.ID == file.ID
                    &&
                    c.OrderedNumber <= testRevisionNumber
                group cb.Size by codeAddedInitiallyInRevision into g
                select new
                {
                    FromRevision = g.Key,
                    CodeSize = g.Sum()
                }
            ).Where(x => x.CodeSize != 0).ToList();

            var errorCode =
                (
                    from codeFromRevision in codeBySourceRevision
                    where
                        codeFromRevision.CodeSize != linesByRevision[codeFromRevision.FromRevision]
                    select new
                    {
                        SourceRevision = codeFromRevision.FromRevision,
                        CodeSize = codeFromRevision.CodeSize,
                        RealCodeSize = linesByRevision[codeFromRevision.FromRevision]
                    }
                ).ToList();

            correct =
                correct
                &&
                codeBySourceRevision.Count() == linesByRevision.Count
                &&
                errorCode.Count == 0;

            if (! resultOnly)
            {
                if (codeBySourceRevision.Count() != linesByRevision.Count)
                {
                    Console.WriteLine("Number of revisions file {0} contains code from is incorrect. {1} should be {2}",
                        file.Path, codeBySourceRevision.Count(), linesByRevision.Count
                    );
                }
                foreach (var error in errorCode)
                {
                    Console.WriteLine("Incorrect number of lines in file {0} from revision {1}. {2} should be {3}",
                        file.Path,
                        error.SourceRevision,
                        error.CodeSize,
                        error.RealCodeSize
                    );
                }
                if ((! correct) && (errorCode.Count > 0))
                {
                    string latestCodeRevision = repository.LastRevision(errorCode.Select(x => x.SourceRevision));

                    var commitsFileTouchedIn = repository.SelectionDSL()
                        .Files().IdIs(file.ID)
                        .Commits().FromRevision(latestCodeRevision).TouchFiles()
                        .OrderBy(c => c.OrderedNumber);

                    foreach (var commit in commitsFileTouchedIn)
                    {
                        if (!CheckLinesContent(repository, scmData, commit.Revision, file, true))
                        {
                            Console.WriteLine("{0} - incorrectly mapped commit.", commit.Revision);
                            if ((automaticallyFixDiffErrors) && (errorCode.Sum(x => x.CodeSize - x.RealCodeSize) == 0))
                            {
                                var incorrectDeleteCodeBlocks =
                                    from cb in repository.SelectionDSL()
                                        .Commits().RevisionIs(commit.Revision)
                                        .Files().PathIs(file.Path)
                                        .Modifications().InCommits().InFiles()
                                        .CodeBlocks().InModifications().Deleted()
                                    join tcb in repository.Queryable<CodeBlock>() on cb.TargetCodeBlockID equals tcb.ID
                                    join m in repository.Queryable<Modification>() on tcb.ModificationID equals m.ID
                                    join c in repository.Queryable<Commit>() on m.CommitID equals c.ID
                                    where
                                        errorCode.Select(x => x.SourceRevision).Contains(c.Revision)
                                    select new
                                    {
                                        Code = cb,
                                        TargetRevision = c.Revision
                                    };

                                foreach (var error in errorCode)
                                {
                                    var incorrectDeleteCodeBlock = incorrectDeleteCodeBlocks.SingleOrDefault(x => x.TargetRevision == error.SourceRevision);
                                    var codeBlock = incorrectDeleteCodeBlock == null ? null : incorrectDeleteCodeBlock.Code;
                                    double difference = error.CodeSize - error.RealCodeSize;
                                    if (codeBlock == null)
                                    {
                                        codeBlock = new CodeBlock()
                                        {
                                            Size = 0,
                                            Modification = repository.SelectionDSL()
                                                .Commits().RevisionIs(commit.Revision)
                                                .Files().PathIs(file.Path)
                                                .Modifications().InCommits().InFiles().Single(),
                                        };
                                        repository.Add(codeBlock);
                                    }
                                    Console.WriteLine("Fix code block size for file {0} in revision {1}:", file.Path, commit.Revision);
                                    Console.Write("Was {0}", codeBlock.Size);
                                    codeBlock.Size -= difference;
                                    if (codeBlock.Size == 0)
                                    {
                                        repository.Delete(codeBlock);
                                    }
                                    else if ((codeBlock.Size > 0) && (codeBlock.AddedInitiallyInCommitID == null))
                                    {
                                        codeBlock.AddedInitiallyInCommit = commit;
                                    }
                                    else if ((codeBlock.Size < 0) && (codeBlock.TargetCodeBlockID == null))
                                    {
                                        codeBlock.TargetCodeBlock = repository.SelectionDSL()
                                            .Commits().RevisionIs(error.SourceRevision)
                                            .Files().PathIs(file.Path)
                                            .Modifications().InFiles()
                                            .CodeBlocks().InModifications().AddedInitiallyInCommits().Single();
                                    }
                                    Console.WriteLine(", now {0}", codeBlock.Size);
                                }
                            }
                            break;
                        }
                    }
                }
            }

            return correct;
        }
Esempio n. 16
0
 private void CheckDeletedCodeBlocksVsAdded(IRepository repository, string testRevision)
 {
     foreach (var codeBlockWithWrongTarget in
         (
             from cb in repository.Queryable<CodeBlock>()
             join m in repository.Queryable<Modification>() on cb.ModificationID equals m.ID
             join f in repository.Queryable<ProjectFile>() on m.FileID equals f.ID
             join c in repository.Queryable<Commit>() on m.CommitID equals c.ID
             let testRevisionNumber = repository.Queryable<Commit>()
                 .Single(x => x.Revision == testRevision)
                 .OrderedNumber
             let addedCodeID = cb.Size < 0 ? cb.TargetCodeBlockID : cb.ID
             where
                 c.OrderedNumber <= testRevisionNumber
             group cb.Size by addedCodeID into g
             select new
             {
                 CodeSize = g.Sum(),
                 Path = repository.Queryable<ProjectFile>()
                     .Single(f => f.ID == repository.Queryable<Modification>()
                         .Single(m => m.ID == repository.Queryable<CodeBlock>()
                             .Single(cb => cb.ID == g.Key).ModificationID
                         ).FileID
                     ).Path,
                 AddedCodeSize = repository.Queryable<CodeBlock>()
                     .Single(cb => cb.ID == g.Key)
                     .Size,
                 Revision = repository.Queryable<Commit>()
                     .Single(c => c.ID == repository.Queryable<Modification>()
                         .Single(m => m.ID == repository.Queryable<CodeBlock>()
                             .Single(cb => cb.ID == g.Key).ModificationID
                         ).CommitID
                     ).Revision
             }
         ).Where(x => x.CodeSize < 0)
     )
     {
         Console.WriteLine("There are too many deleted code blocks for code block in revision {0} for file {1} for code with size {2}. Code size {3} should be greater or equal to 0",
             codeBlockWithWrongTarget.Revision,
             codeBlockWithWrongTarget.Path,
             codeBlockWithWrongTarget.AddedCodeSize,
             codeBlockWithWrongTarget.CodeSize
         );
     }
 }
Esempio n. 17
0
        public override IDictionary<string, object> BuildData(IRepository repository)
        {
            Dictionary<string,object> result = new Dictionary<string,object>();

            int commits = repository.Queryable<Commit>().Count();
            var authors = repository.Queryable<Commit>()
                .Select(x => x.Author)
                .Distinct().ToList();
            double totalLoc = repository.SelectionDSL()
                .Files().InDirectory(TargetDir)
                .Modifications().InFiles()
                .CodeBlocks().InModifications().CalculateLOC();
            int totalFiles = repository.SelectionDSL()
                .Files().InDirectory(TargetDir).Exist()
                .Count();

            var codeByAuthor = (from author in authors select new
            {
                Name = author,
                AddedCode = repository.SelectionDSL()
                    .Commits().AuthorIs(author)
                    .Files().InDirectory(TargetDir)
                    .Modifications().InFiles()
                    .CodeBlocks().InModifications().AddedInitiallyInCommits()
                    .Fixed(),
                RemovedCode = repository.SelectionDSL()
                    .Commits().AuthorIs(author)
                    .Files().InDirectory(TargetDir)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications().Deleted()
                    .Fixed(),
                TouchedFiles = repository.SelectionDSL()
                    .Commits().AuthorIs(author)
                    .Files().InDirectory(TargetDir).Exist().TouchedInCommits()
            }).ToList();

            var statByAuthor =
                from a in codeByAuthor
                let authorCommits = a.AddedCode.Commits().Again().Count()
                let authorFixes = a.AddedCode.Commits().Again().AreBugFixes().Count()
                let authorRefactorings = a.AddedCode.Commits().Again().AreRefactorings().Count()
                let authorAddedLoc = a.AddedCode.CalculateLOC()
                let authorCurrentLoc = authorAddedLoc + a.AddedCode.ModifiedBy().CalculateLOC()
                let authorTouchedFiles = a.TouchedFiles.Count()
                let authorFilesTouchedByOtherAuthors = a.TouchedFiles
                    .Commits().AuthorIsNot(a.Name)
                    .Files().Again().TouchedInCommits().Count()
                select new
                {
                    name = a.Name,
                    commits = string.Format("{0} ({1}%)", authorCommits, (((double)authorCommits / commits) * 100).ToString("F02")),
                    fixes = string.Format("{0} ({1}%)", authorFixes, (((double)authorFixes / authorCommits) * 100).ToString("F02")),
                    refactorings = string.Format("{0} ({1}%)", authorRefactorings, (((double)authorRefactorings / authorCommits) * 100).ToString("F02")),
                    dd = a.AddedCode.CalculateDefectDensity().ToString("F03"),
                    added_loc = a.AddedCode.CalculateLOC(),
                    removed_loc = - a.RemovedCode.CalculateLOC(),
                    remain_loc = authorCurrentLoc,
                    contribution = ((authorCurrentLoc / totalLoc) * 100).ToString("F02") + "%",
                    specialization = ((double)authorTouchedFiles / totalFiles * 100).ToString("F02") + "%",
                    unique_specialization = (authorTouchedFiles > 0 ?
                        ((double)(authorTouchedFiles - authorFilesTouchedByOtherAuthors) / totalFiles * 100)
                        :
                        0).ToString("F02") + "%",
                    demand_for_code = (authorAddedLoc > 0 ?
                        ((authorCurrentLoc / authorAddedLoc) * 100)
                        :
                        0).ToString("F02") + "%"
                };

            result.Add("authors", statByAuthor.OrderBy(x => x.name).ToArray());

            return result;
        }
Esempio n. 18
0
        public override IDictionary<string, object> BuildData(IRepository repositories)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            var authors = repositories.Queryable<Commit>()
                .Select(x => x.Author)
                .Distinct().ToList();

            var codeByAuthor = (from author in authors
                                select new
                                {
                                    Name = author,
                                }).ToList();

            var statByAuthor =
                from a in codeByAuthor
                select new
                {
                    name = a.Name,
                };

            result.Add("authors", statByAuthor.OrderBy(x => x.name).ToArray());

            DateTime statFrom = repositories.Queryable<Commit>().Min(x => x.Date);
            DateTime statTo = repositories.Queryable<Commit>().Max(x => x.Date);

            List<object> monthObjs = new List<object>();
            List<object> locObjs = new List<object>();

            List<DateTime> monthes = new List<DateTime>();
            DateTime m = new DateTime(statFrom.Year, statFrom.Month, 1);
            while (m < statTo)
            {
                monthes.Add(m);
                m = m.AddMonths(1);
            }

            foreach (var month in monthes)
            {
                DateTime nextMonth = month.AddMonths(1);

                var totalMonthCommits = repositories.SelectionDSL()
                    .Commits()
                        .DateIsLesserThan(nextMonth)
                        .Fixed();

                foreach (var author in authors)
                {
                    double authorLoc = totalMonthCommits
                        .AuthorIs(author).Files().InDirectory(TargetDir)
                        .Modifications().InCommits().InFiles()
                        .CodeBlocks().InModifications().Fixed().CalculateLOC();

                    locObjs.Add(new
                    {
                        loc = authorLoc
                    });
                }

                monthObjs.Add(new
                {
                    month = String.Format("{0:00}", month.Month) + "-" + month.Year.ToString()
                });
            }

            result.Add("monthes", monthObjs);

            result.Add("locs", locObjs);

            return result;
        }
 public override void Init(IRepository repository)
 {
     Authors = repository.Queryable<Commit>()
         .Select(x => x.Author).Distinct().OrderBy(x => x)
         .ToArray();
     base.Init(repository);
 }
Esempio n. 20
0
        public override IDictionary<string, object> BuildData(IRepository repository)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            double totalLoc = repository.SelectionDSL()
                .Files().InDirectory(TargetDir)
                .Modifications().InFiles()
                .CodeBlocks().InModifications().CalculateLOC();

            List<object> monthObjects = new List<object>();

            DateTime statFrom = repository.Queryable<Commit>().Min(x => x.Date);
            DateTime statTo = repository.Queryable<Commit>().Max(x => x.Date);

            List<DateTime> monthes = new List<DateTime>();
            DateTime m = new DateTime(statFrom.Year, statFrom.Month, 1);
            while (m < statTo)
            {
                monthes.Add(m);
                m = m.AddMonths(1);
            }

            string lastRevision = null;

            foreach (var month in monthes)
            {
                DateTime nextMonth = month.AddMonths(1);

                var monthCommits = repository.SelectionDSL()
                    .Commits()
                        .DateIsGreaterOrEquelThan(month)
                        .DateIsLesserThan(nextMonth)
                        .Fixed();
                var monthCode = monthCommits
                    .Files().InDirectory(TargetDir)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications().Fixed();
                var totalMonthCommits = repository.SelectionDSL()
                    .Commits()
                        .DateIsLesserThan(nextMonth)
                        .Fixed();
                var totalMonthCode = totalMonthCommits
                    .Files().InDirectory(TargetDir)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications().Fixed();

                int monthCommitsCount = monthCommits.Count();
                int totalMonthCommitsCount = totalMonthCommits.Count();
                int monthAuthorsCount = monthCommits.Select(c => c.Author).Distinct().Count();
                int totalMonthAuthorsCount = totalMonthCommits.Select(c => c.Author).Distinct().Count();
                int monthFixesCount = monthCommits.AreBugFixes().Count();
                int totalMonthFixesCount = totalMonthCommits.AreBugFixes().Count();
                if (monthCommitsCount > 0)
                {
                    lastRevision = monthCommits
                        .Single(c => c.OrderedNumber == monthCommits.Max(x => x.OrderedNumber))
                        .Revision;
                }

                monthObjects.Add(new
                {
                    month = month.Year.ToString() + "-" + String.Format("{0:00}", month.Month),
                    commits = string.Format("{0} ({1})",
                        monthCommitsCount,
                        totalMonthCommitsCount
                    ),
                    authors = string.Format("{0} ({1})",
                        monthAuthorsCount,
                        totalMonthAuthorsCount
                    ),
                    files = repository.SelectionDSL().Files()
                        .ExistInRevision(lastRevision).Count(),
                    fixed_defects = string.Format("{0} ({1})",
                        monthFixesCount,
                        totalMonthFixesCount
                    ),
                    added_loc = string.Format("{0} ({1})",
                        monthCode.Added().CalculateLOC(),
                        totalMonthCode.Added().CalculateLOC()
                    ),
                    removed_loc = string.Format("{0} ({1})",
                        -monthCode.Deleted().CalculateLOC(),
                        -totalMonthCode.Deleted().CalculateLOC()
                    ),
                    loc = totalMonthCode.CalculateLOC()
                });
            }

            result.Add("monthes", monthObjects);
            return result;
        }
        public override IDictionary<string, object> BuildData(IRepository repositories)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            var authors = repositories.Queryable<Commit>()
                .Select(x => x.Author)
                .Distinct().ToList();

            var codeByAuthor = (from author in authors select new
            {
                Name = author,
            }).ToList();

            var statByAuthor =
                from a in codeByAuthor
            select new
            {
                name = a.Name,
            };

            result.Add("authors", statByAuthor.OrderBy(x => x.name).ToArray());

            List<object> monthObjs = new List<object>();
            List<object> fixObjs = new List<object>();
            List<object> refactObjs = new List<object>();
            List<object> restObjs = new List<object>();

            DateTime statFrom = repositories.Queryable<Commit>().Min(x => x.Date);
            DateTime statTo = repositories.Queryable<Commit>().Max(x => x.Date);

            List<DateTime> monthes = new List<DateTime>();
            DateTime m = new DateTime(statFrom.Year, statFrom.Month, 1);
            while (m < statTo)
            {
                monthes.Add(m);
                m = m.AddMonths(1);
            }

            foreach (var month in monthes)
            {
                DateTime nextMonth = month.AddMonths(1);

                var monthCommits = repositories.SelectionDSL()
                    .Commits()
                        .DateIsGreaterOrEquelThan(month)
                        .DateIsLesserThan(nextMonth)
                        .Fixed();

                int monthFixCommitsCount = monthCommits.AreBugFixes().Count();
                int monthRefactCommitsCount = monthCommits.AreRefactorings().Count();
                int monthRestCommitsCount = monthCommits.Count() - monthFixCommitsCount - monthRefactCommitsCount;

                foreach (var author in authors)
                {
                    int monthAuthFixCommits = monthCommits.AuthorIs(author).AreBugFixes().Count();
                    int monthAuthRefactCommits = monthCommits.AuthorIs(author).AreRefactorings().Count();
                    int monthRestAuthCommits = monthCommits.AuthorIs(author).Count() - monthAuthFixCommits - monthAuthRefactCommits;

                    double monthAuthFixCommitsCount = monthFixCommitsCount == 0 ? 0 : (monthAuthFixCommits / monthFixCommitsCount * 100);
                    double monthAuthRefactCommitsCount = monthRefactCommitsCount == 0 ? 0 : (monthAuthRefactCommits / monthRefactCommitsCount * 100);
                    double monthAuthRestCommitsCount = monthRestCommitsCount == 0 ? 0 : (monthRestAuthCommits / monthRestCommitsCount * 100);

                    fixObjs.Add(new
                    {
                        fix = monthAuthFixCommitsCount
                    });

                    refactObjs.Add(new
                    {
                        refact = monthAuthRefactCommitsCount
                    });

                    restObjs.Add(new
                    {
                        rest = monthAuthRestCommitsCount
                    });
                }

                monthObjs.Add(new
                {
                    month = month.Year.ToString() + "-" + String.Format("{0:00}", month.Month)
                });
            }

            result.Add("monthes", monthObjs);

            result.Add("fixes",fixObjs);

            result.Add("refactorings",refactObjs);

            result.Add("rests",restObjs);

            return result;
        }
        protected DateTime[] GetDates(IRepository repository)
        {
            List<DateTime> dates = new List<DateTime>();

            DateTime min = repository.Queryable<Commit>().Min(c => c.Date);
            DateTime max = repository.Queryable<Commit>().Max(c => c.Date);

            DateTime date = min;
            switch (DatePeriod)
            {
                case DatePeriod.DAY: date = date.StartOfDay(); break;
                case DatePeriod.WEEK: date = date.StartOfWeek(); break;
                case DatePeriod.MONTH: date = date.StartOfMonth(); break;
                case DatePeriod.QUARTER: date = date.StartOfQuarter(); break;
                case DatePeriod.YEAR: date = date.StartOfYear(); break;
                default: break;
            }

            DateTime prevDate = date;
            while (prevDate < max)
            {
                dates.Add(date);
                prevDate = date;
                switch (DatePeriod)
                {
                    case DatePeriod.DAY: date = date.AddDays(1); break;
                    case DatePeriod.WEEK: date = date.AddWeeks(1); break;
                    case DatePeriod.MONTH: date = date.AddMonths(1); break;
                    case DatePeriod.QUARTER: date = date.AddQuarters(1); break;
                    case DatePeriod.YEAR: date = date.AddYears(1); break;
                    default: break;
                }
            }

            if (dates.Count > 0 && dates.First() < min)
            {
                dates[0] = min;
            }
            if (dates.Count > 1 && dates.Last() > max)
            {
                dates[dates.Count-1] = max;
            }

            return dates.ToArray();
        }
Esempio n. 23
0
 private void CheckCodeSizeForDeletedFiles(IRepository repository, string testRevision)
 {
     foreach (var codeSizeForDeletedFile in
         (
             from cb in repository.Queryable<CodeBlock>()
             join m in repository.Queryable<Modification>() on cb.ModificationID equals m.ID
             join f in repository.Queryable<ProjectFile>() on m.FileID equals f.ID
             join c in repository.Queryable<Commit>() on m.CommitID equals c.ID
             let testRevisionNumber = repository.Queryable<Commit>()
                 .Single(x => x.Revision == testRevision)
                 .OrderedNumber
             where
                 c.OrderedNumber <= testRevisionNumber
                 &&
                 f.DeletedInCommitID != null
                 &&
                 repository.Queryable<Commit>()
                     .Single(x => x.ID == f.DeletedInCommitID)
                     .OrderedNumber <= testRevisionNumber
             group cb by f into g
             select new
             {
                 Path = g.Key.Path,
                 DeletedInRevision = repository.Queryable<Commit>()
                     .Single(x => x.ID == g.Key.DeletedInCommitID)
                     .Revision,
                 CodeSize = g.Sum(x => x.Size)
             }
         ).Where(x => x.CodeSize != 0)
     )
     {
         Console.WriteLine("For file {0} deleted in revision {1} code size is not 0. {2} should be 0.",
             codeSizeForDeletedFile.Path,
             codeSizeForDeletedFile.DeletedInRevision,
             codeSizeForDeletedFile.CodeSize
         );
     }
 }
Esempio n. 24
0
        public override IDictionary<string, object> BuildData(IRepository repository)
        {
            Dictionary<string,object> result = new Dictionary<string,object>();

            double totalLoc = repository.SelectionDSL()
                .Files().InDirectory(TargetDir)
                .Modifications().InFiles()
                .CodeBlocks().InModifications().CalculateLOC();

            List<object> releaseObjects = new List<object>();

            var releases = repository.AllReleases();
            releases.Add(repository.LastRevision(), "upcoming");

            DateTime statFrom = repository.Queryable<Commit>().Min(x => x.Date);

            string prevRelease = null;
            foreach (var release in releases)
            {
                var releaseCommits = repository.SelectionDSL()
                    .Commits()
                        .AfterRevision(prevRelease)
                        .TillRevision(release.Key)
                    .Fixed();
                var releaseCode = releaseCommits
                    .Files()
                        .InDirectory(TargetDir)
                    .Modifications()
                        .InCommits()
                        .InFiles()
                    .CodeBlocks()
                        .InModifications()
                    .Fixed();
                var totalReleaseCommits = repository.SelectionDSL()
                    .Commits()
                        .TillRevision(release.Key)
                    .Fixed();
                var totalReleaseCode = totalReleaseCommits
                    .Files()
                        .InDirectory(TargetDir)
                    .Modifications()
                        .InCommits()
                        .InFiles()
                    .CodeBlocks()
                        .InModifications()
                    .Fixed();

                DateTime releaseStatFrom = releaseCommits.Min(x => x.Date);
                DateTime releaseStatTo = releaseCommits.Max(x => x.Date);

                int releaseCommitsCount = releaseCommits.Count();
                int releaseAuthorsCount = releaseCommits.Select(c => c.Author).Distinct().Count();
                int releaseFixesCount = releaseCommits.AreBugFixes().Count();
                int releaseFilesCount = repository.SelectionDSL()
                    .Files().ExistInRevision(release.Key).Count();
                int releaseTouchedFilesCount = releaseCommits
                    .Files()
                        .ExistInRevision(release.Key)
                        .TouchedInCommits()
                    .Count();
                int releaseDefectiveFilesCount = releaseCode
                    .DefectiveFiles(prevRelease, null)
                        .ExistInRevision(release.Key)
                    .Count();
                int totalReleaseCommitsCount = totalReleaseCommits.Count();
                int totalReleaseAuthorsCount = totalReleaseCommits.Select(c => c.Author).Distinct().Count();
                int totalReleaseFixesCount = totalReleaseCommits.AreBugFixes().Count();

                var totalReleaseLoc = totalReleaseCode.CalculateLOC();
                var releaseRemainLoc = releaseCode.Added().CalculateLOC() + releaseCode.ModifiedBy().CalculateLOC();
                var totalReleaseAddedLoc = totalReleaseCode.Added().CalculateLOC();
                var releaseAddedLoc = releaseCode.Added().CalculateLOC();

                double releaseDD = releaseCode.CalculateDefectDensity();
                double totalReleaseDD = totalReleaseCode.CalculateDefectDensity();
                double postReleaseDD = releaseDD - releaseCode.CalculateDefectDensity(release.Key);

                releaseObjects.Add(new
                {
                    tag = release.Value,
                    commits = string.Format("{0} ({1})",
                        releaseCommitsCount,
                        totalReleaseCommitsCount
                    ),
                    days = string.Format("{0} ({1})",
                        (releaseStatTo - releaseStatFrom).Days,
                        (releaseStatTo - statFrom).Days
                    ),
                    authors = string.Format("{0} ({1})",
                        releaseAuthorsCount,
                        totalReleaseAuthorsCount
                    ),
                    files = releaseFilesCount,
                    files_changed = string.Format(
                        "{0} ({1}%)",
                        releaseTouchedFilesCount,
                        (((double)releaseTouchedFilesCount / releaseFilesCount) * 100).ToString("F02")
                    ),
                    files_defective = string.Format(
                        "{0} ({1}%)",
                        releaseDefectiveFilesCount,
                        (((double)releaseDefectiveFilesCount / releaseFilesCount) * 100).ToString("F02")
                    ),
                    dd = string.Format("{0} ({1})",
                        releaseDD.ToString("F03"),
                        totalReleaseDD.ToString("F03")
                    ),
                    post_release_dd = string.Format(
                        "{0} ({1}%)",
                        postReleaseDD.ToString("F02"),
                        ((releaseDD > 0 ? postReleaseDD / releaseDD : 0) * 100).ToString("F02")
                    ),
                    fixed_defects = string.Format("{0} ({1})",
                        releaseFixesCount,
                        totalReleaseFixesCount
                    ),
                    added_loc = string.Format("{0} ({1})",
                        releaseAddedLoc,
                        totalReleaseAddedLoc
                    ),
                    removed_loc = string.Format("{0} ({1})",
                        - releaseCode.Deleted().CalculateLOC(),
                        - totalReleaseCode.Deleted().CalculateLOC()
                    ),
                    loc = totalReleaseLoc,
                    remain_loc = releaseRemainLoc,
                    contribution = ((releaseRemainLoc / totalLoc) * 100).ToString("F02") + "%",
                    demand_for_code = (releaseAddedLoc > 0 ?
                        ((releaseRemainLoc / releaseAddedLoc) * 100)
                        :
                        0).ToString("F02") + "%"
                });

                prevRelease = release.Key;
            }

            result.Add("releases", releaseObjects);
            return result;
        }
Esempio n. 25
0
 private void CheckEmptyCodeBlocks(IRepository repository, string testRevision)
 {
     foreach (var zeroCodeBlock in
         from cb in repository.Queryable<CodeBlock>()
         join m in repository.Queryable<Modification>() on cb.ModificationID equals m.ID
         join f in repository.Queryable<ProjectFile>() on m.FileID equals f.ID
         join c in repository.Queryable<Commit>() on m.CommitID equals c.ID
         let testRevisionNumber = repository.Queryable<Commit>()
             .Single(x => x.Revision == testRevision)
             .OrderedNumber
         where
             c.OrderedNumber <= testRevisionNumber
             &&
             cb.Size == 0
         select new { path = f.Path, revision = c.Revision }
     )
     {
         Console.WriteLine("Empty code block in file {0} in revision {1}!",
             zeroCodeBlock.path, zeroCodeBlock.revision
         );
     }
 }
        public override void Init(IRepository repository)
        {
            base.Init(repository);

            if (! EstimateCutOffValue)
            {
                cutOffValue = 1;
            }
            else
            {
                var fixCommits = repository.SelectionDSL()
                    .Commits().TillRevision(model.PredictionRelease).AreBugFixes();
                var defectCount = fixCommits.Count();
                var deletedLoc = - fixCommits
                    .Modifications().InCommits()
                    .CodeBlocks().InModifications().Deleted().CalculateLOC();
                var deletedLocPerDefect = deletedLoc / defectCount;

                var touchedFiles =
                    (
                        from c in fixCommits
                        join m in repository.Queryable<Modification>() on c.ID equals m.CommitID
                        join f in repository.Queryable<ProjectFile>() on m.FileID equals f.ID
                        select f
                    ).Count();

                var touchedFilesPerDefect = (float)touchedFiles / defectCount;

                cutOffValue = deletedLocPerDefect / touchedFilesPerDefect;
            }
        }
Esempio n. 27
0
 private void CheckTargetsForCodeBlocks(IRepository repository, string testRevision)
 {
     foreach (var codeBlockWithWrongTarget in
         from cb in repository.Queryable<CodeBlock>()
         join m in repository.Queryable<Modification>() on cb.ModificationID equals m.ID
         join f in repository.Queryable<ProjectFile>() on m.FileID equals f.ID
         join c in repository.Queryable<Commit>() on m.CommitID equals c.ID
         let testRevisionNumber = repository.Queryable<Commit>()
             .Single(x => x.Revision == testRevision)
             .OrderedNumber
         where
             c.OrderedNumber <= testRevisionNumber
             &&
             (
                 (cb.Size > 0 && cb.TargetCodeBlockID != null)
                 ||
                 (cb.Size < 0 && cb.TargetCodeBlockID == null)
             )
         select new
         {
             CodeSize = cb.Size,
             Path = f.Path,
             Revision = c.Revision
         }
     )
     {
         Console.WriteLine("Code block in revision {0} with size {1} for file {2} should{3} have target!",
             codeBlockWithWrongTarget.Revision,
             codeBlockWithWrongTarget.CodeSize,
             codeBlockWithWrongTarget.Path,
             codeBlockWithWrongTarget.CodeSize < 0 ? "" : " not"
         );
     }
 }
        public override void Init(IRepository repository, IEnumerable<string> releases)
        {
            base.Init(repository, releases);

            ReleaseDate = repository.Queryable<Commit>()
                .Single(x => x.Revision == PredictionRelease)
                .Date;

            RemainCodeSizeFromRevision = new SmartDictionary<string,double>(r =>
                repository.SelectionDSL()
                    .Commits().RevisionIs(r)
                    .Modifications().InCommits()
                    .CodeBlocks().InModifications().Added().CalculateRemainingCodeSize(PredictionRelease).Sum(x => x.Value)
            );
            AddedCodeSizeFromRevision = new SmartDictionary<string,double>(r =>
                repository.SelectionDSL()
                    .Commits().RevisionIs(r)
                    .Modifications().InCommits()
                    .CodeBlocks().InModifications().Added().CalculateLOC()
            );
            DefectCodeSizeFromRevision = new SmartDictionary<string,double>(r =>
                repository.SelectionDSL()
                    .Commits().RevisionIs(r)
                    .Modifications().InCommits()
                    .CodeBlocks().InModifications().CalculateDefectCodeSize(PredictionRelease)
            );

            AddedCodeSizeResolver = (revision,pathid) =>
                repository.SelectionDSL()
                    .Commits().RevisionIs(revision)
                    .Files().IdIs(pathid)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications().Added().CalculateLOC();
            DefectCodeSizeResolver = (revision,pathid) =>
                repository.SelectionDSL()
                    .Commits().RevisionIs(revision)
                    .Files().IdIs(pathid)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications().CalculateDefectCodeSize(PredictionRelease);
            RemainCodeSizeFromRevisionResolver = (revision) =>
                RemainCodeSizeFromRevision[revision];
            AddedCodeSizeFromRevisionResolver = (revision) =>
                AddedCodeSizeFromRevision[revision];
            DefectCodeSizeFromRevisionResolver = (revision) =>
                DefectCodeSizeFromRevision[revision];

            OnInit(repository);
        }