public override void AddError(Issue issue, string reason)
 {
     if (!issue.IsClosed)
     {
         base.AddError(issue, reason);
     }
 }
示例#2
0
        public IssueStates(Issue issue)
        {
            if (issue.IsClosed)
            {
                IsDone = true;
            }

            var issueLabels = issue.LabelNames.Select(l => l.ToLowerInvariant()).ToList();
            HasState = true;
            int numStates = 0;
            foreach (string label in issueLabels)
            {
                switch (label)
                {
                    case BlockedLabel:
                    case HoldLabel:
                        IsBlocked = true;
                        break;

                    case PendingLabel:
                        IsPending = true;
                        ++numStates;
                        break;

                    case InProgressLabel:
                        IsInProgress = true;
                        ++numStates;
                        break;

                    case ReadyForTestLabel:
                        IsReadyForTest = true;
                        ++numStates;
                        break;

                    case InTestLabel:
                        IsInTest = true;
                        ++numStates;
                        break;
                }
            }

            if (numStates == 0)
            {
                HasState = false;
            }

            if (numStates > 1)
            {
                HasManyStates = true;
            }
        }
        public static void ParseEstimates(Issue issue, IStatCalculator stats, out float devEstimate, out float testEstimate)
        {
            Match devMatches = devEstimateRegex.Match(issue.Body);
            Match testMatches = testEstimateRegex.Match(issue.Body);

            if (!devMatches.Success)
            {
                stats.AddError(issue, "Dev estimate not found in issue");
            }

            if (!testMatches.Success)
            {
                stats.AddError(issue, "Test estimate not found in issue");
            }

            float.TryParse(devMatches.Groups["estimate"].Value, out devEstimate);
            float.TryParse(testMatches.Groups["estimate"].Value, out testEstimate);
        }
示例#4
0
        public override void AddIssue(Issue issue, float devEstimate, float testEstimate)
        {
            if (issue.IsClosed)
            {
                return; // don't care about closed issues
            }

            var issueStates = ValidateIssueStates(issue);
            if (issueStates == null)
            {
                return;
            }

            TestRemaining += testEstimate;
            Pending += (devEstimate * (issueStates.IsPending ? 1 : 0));
            InProgress += (devEstimate * (issueStates.IsInProgress ? 1 : 0));
            ReadyForTest += (testEstimate * (issueStates.IsReadyForTest ? 1 : 0));
            InTest += (testEstimate * (issueStates.IsInTest ? 1 : 0));
        }
        protected IssueStates ValidateIssueStates(Issue issue)
        {
            var issueStates = new IssueStates(issue);
            if(issueStates.IsBlocked) {
                AddError(issue, "Blocked");
            }

            if (!issueStates.IsDone && !issueStates.HasState)
            {
                AddError(issue, "Issue doesn't have a state");
                return null;
            }

            if (!issueStates.IsDone && issueStates.HasManyStates)
            {
                AddError(issue, "Issue has multiple state labels");
                return null;
            }

            return issueStates;
        }
        public override void AddIssue(Issue issue, float devEstimate, float testEstimate)
        {
            var issueStates = ValidateIssueStates(issue);
            if (issueStates == null)
            {
                return;
            }

            float total = devEstimate + testEstimate;

            if (issue.IsClosed)
            {
                Done += total;
            }
            else
            {
                Pending += (total*(issueStates.IsPending ? 1 : 0));
                InProgress += (total*(issueStates.IsInProgress ? 1 : 0));
                ReadyForTest += (total*(issueStates.IsReadyForTest ? 1 : 0));
                InTest += (total*(issueStates.IsInTest ? 1 : 0));
            }
        }
 public static bool IsPartnerIssue(Issue issue)
 {
     return issue.Labels.Any(l => l.Color == PartnerLabelColor);
 }
 public abstract void AddIssue(Issue issue, float devEstimate, float testEstimate);
 public virtual void AddError(Issue issue, string reason)
 {
     errors.Add(new ParseError(issue, reason));
 }
示例#10
0
 public ParseError(Issue issue, string reason)
 {
     Issue = issue;
     Reason = reason;
 }