/// <summary>
        /// Activates a policy failure.
        /// </summary>
        /// <param name="failure">The failure to activate.</param>
        public override void Activate(PolicyFailure failure)
        {
            SourceAnalysisPolicyFailure policyFailure = failure as SourceAnalysisPolicyFailure;

            if (policyFailure != null)
            {
                // Create dialog to show the violations
                using (DisplayViolationsDialog dialog = new DisplayViolationsDialog())
                {
                    // Set the violations in the dialog.
                    dialog.Violations = policyFailure.Violations;

                    // Show dialog
                    dialog.ShowDialog();

                    // Check if there is a selected violation
                    if (dialog.SelectedViolation != null)
                    {
                        // There is a selected violation so move to it.
                        ViolationTask.MoveToViolation(dte, dialog.SelectedViolation);
                    }
                }
            }

            base.Activate(failure);
        }
        /// <summary>
        /// Activates a policy failure.
        /// </summary>
        /// <param name="failure">The failure to activate.</param>
        public override void Activate(PolicyFailure failure)
        {
            SourceAnalysisPolicyFailure policyFailure = failure as SourceAnalysisPolicyFailure;

            if (policyFailure != null)
            {
                using (DisplayViolationsDialog dialog = new DisplayViolationsDialog())
                {
                    dialog.Violations = policyFailure.Violations;

                    dialog.ShowDialog();
                }
            }
            var f = failure as ExtendPolicyFailure;

            if (f != null)
            {
                var zz = f.Violation;
                if (this.taskProvider != null)
                {
                    this.taskProvider.GotoError(zz);
                }
            }

            base.Activate(failure);
        }
Exemplo n.º 3
0
 public override void Activate(PolicyFailure failure)
 {
     if (failure is CodeDocumentationPolicyFailure)
     {
         OnPolicyFailureActivation((CodeDocumentationPolicyFailure)failure);
     }
     else
     {
         base.Activate(failure);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Retrieves issues from an FxCop Xml report.
        /// </summary>
        /// <param name="results">The FxCop Xml report to retrieve issues from.</param>
        private PolicyFailure[] GetPolicyFailures(XmlDocument results)
        {
            XmlNodeList issues = results.SelectNodes("//Issue");

            PolicyFailure[] failures = new PolicyFailure[issues.Count];

            for (int i = 0; i < issues.Count; i++)
            {
                XmlNode issue = issues[i];
                failures[i] = new PolicyFailure(issue.InnerText, this);
            }

            return(failures);
        }
 //This method is executed when the user ask for the policy help (F1)
 public override void DisplayHelp(PolicyFailure failure)
 {
     if (runner != null)
     {
         if (String.IsNullOrEmpty(runner.Log))
         {
             MessageBox.Show("Not log found", "Grunt task log");
         }
         else
         {
             MessageBox.Show(runner.Log, "Grunt task log");
         }
     }
 }
        public override void Activate(PolicyFailure failure)
        {
            var f = failure as TsLintPolicyFailure;

            if (f != null)
            {
                var zz = f.Violation;
                if (this._taskProvider != null)
                {
                    this._taskProvider.GotoError(zz);
                }
            }

            base.Activate(failure);
        }
Exemplo n.º 7
0
        public override void Activate(PolicyFailure failure)
        {
            if (AllowDismiss)
            {
                var result = MessageBox.Show(
                    Resources.PolicyDismissMessage,
                    Resources.PolicyDismissTitle,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button2);

                if (result == DialogResult.Yes)
                {
                    warningDismissed = true;
                    OnPolicyStateChanged(Evaluate());
                }
            }
        }
        // [rgn] Public Methods (1)

        public static PolicyFailure[] Evaluate(IPendingCheckin pendingCheckin, IPolicyEvaluation policyEvaluation)
        {
            List <PolicyFailure> failures = new List <PolicyFailure>();

            // Iterate over all changes to files that end with ".csproj".
            foreach (PendingChange pendingChange in GetCheckedPendingProjects(pendingCheckin))
            {
                // Examine the csproj file and validate all constraints.
                // Start by reading the csproj into an XmlDocument.
                XmlDocument csprojDocument = new XmlDocument();
                csprojDocument.Load(pendingChange.LocalItem);

                // Iterate over all of this project's build configurations.
                foreach (XmlNode node in GetBuildConfigurationNodes(csprojDocument))
                {
                    // Get the build configuration's name.
                    string configurationName = node.Attributes["Condition"].InnerText;

                    // Get the build configuration's debug symbol type.
                    string debugType = node["DebugType"].InnerText;

                    // Check if any constraint is unsatisfied with this build configuration.
                    foreach (DebugSymbolConstraint unsatisfiedConstraint in GetUnsatisfiedConstraints(configurationName, debugType))
                    {
                        // A constraint is unsatisfied with this project's build configuration. Report a failure.
                        string message = string.Format("Project '{0}' does not satisfy the constraint '{1}'.",
                                                       pendingChange.FileName,
                                                       unsatisfiedConstraint);

                        PolicyFailure failure = new PolicyFailure(message, policyEvaluation);
                        failures.Add(failure);
                    }
                }
            }

            return(failures.ToArray());
        }
Exemplo n.º 9
0
 public override void DisplayHelp(PolicyFailure failure)
 {
     MessageBox.Show("This policy helps you to remember to exclude Nuget Packages from your check-ins.", "Prompt Policy Help");
 }
Exemplo n.º 10
0
 public override void DisplayHelp(PolicyFailure failure)
 {
     MessageBox.Show(helpText, dialogTitle);
 }
Exemplo n.º 11
0
 public override void DisplayHelp(PolicyFailure failure)
 {
     MessageBox.Show("This policy helps you to remember to include a specific file with your changeset.", "Prompt Policy Help");
 }
Exemplo n.º 12
0
 //This method is executed when the user double-clicks the UI of the policy
 public override void Activate(PolicyFailure failure)
 {
     MessageBox.Show("Run the grunt configurated task to see the errors in your code.", "How to fix your policy failure");
 }
Exemplo n.º 13
0
 public override void DisplayHelp(PolicyFailure failure)
 {
     System.Diagnostics.Process.Start("http://nkdagility.net/TfsBranchPolicyWiki");
 }
Exemplo n.º 14
0
 public override void Activate(PolicyFailure failure)
 {
     MessageBox.Show($"Please include {Config.Filename} with your changeset");
 }
Exemplo n.º 15
0
 // This method is called if the user presses F1 when a policy failure
 // is active in the UI.
 public override void DisplayHelp(PolicyFailure failure)
 {
     MessageBox.Show("This policy lets you associate your checkin with one or more VersionOne work items", "Prompt Policy Help");
 }
Exemplo n.º 16
0
 // This method is called if the user double-clicks on
 // a policy failure in the UI. If so, display the V1 checkin dialog
 public override void Activate(PolicyFailure failure)
 {
     PromptForWorkitem();
 }
Exemplo n.º 17
0
 public override void Activate(PolicyFailure failure)
 {
     MessageBox.Show("Please exclude Nuget Packages from your check-in.", "How to fix your policy failure");
 }
 // This method is called if the user presses F1 when a policy failure
 // is active in the UI. In this example, a message box is displayed.
 public override void DisplayHelp(PolicyFailure failure)
 {
     MessageBox.Show("This policy detects if your check in is approaching the TFS Version control MAX PATH of 260 characters and and reminds you to reduce the file and directory length.", "Policy Help");
 }
Exemplo n.º 19
0
 public override void Activate(PolicyFailure failure) {
    MessageBox.Show("Please provide comments for your check-in.", "Fix your policy failure");
 }
 // This method is called if the user double-clicks on 
 // a policy failure in the UI. If so, display the V1 checkin dialog
 public override void Activate(PolicyFailure failure)
 {
     PromptForWorkitem();
 }
Exemplo n.º 21
0
 // This method is called if the user double-clicks on 
 // a policy failure in the UI. In this case a message telling the user 
 // to supply some comments is displayed.
 public override void Activate(PolicyFailure failure)
 {
     MessageBox.Show("Please fix all JS errors for your check-in.", "JS errors");
 }
Exemplo n.º 22
0
 // This method is called if the user presses F1 when a policy failure 
 // is active in the UI. In this example, a message box is displayed.
 public override void DisplayHelp(PolicyFailure failure)
 {
     MessageBox.Show("Please fix all JS errors for your check-in.", "Prompt Policy Help");
 }
Exemplo n.º 23
0
 public override void DisplayHelp(PolicyFailure failure)
 {
     System.Diagnostics.Process.Start("http://nkdagility.net/TfsBranchPolicyWiki");
 }
 // This method is called if the user presses F1 when a policy failure 
 // is active in the UI. 
 public override void DisplayHelp(PolicyFailure failure)
 {
     MessageBox.Show("This policy lets you associate your checkin with one or more VersionOne work items", "Prompt Policy Help");
 }
 // This method is called if the user double-clicks on
 // a policy failure in the UI. In this case a message telling the user
 // to supply some comments is displayed.
 public override void Activate(PolicyFailure failure)
 {
     MessageBox.Show("Please reduce the file or directory name length to less than 260 characters", "How to fix your policy failure");
 }
        public override void Activate(PolicyFailure failure)
        {
            if (AllowDismiss)
            {
                var result = MessageBox.Show(
                    Resources.PolicyDismissMessage,
                    Resources.PolicyDismissTitle,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button2);

                if (result == DialogResult.Yes)
                {
                    warningDismissed = true;
                    OnPolicyStateChanged(Evaluate());
                }
            }
        }
Exemplo n.º 27
0
 /// <summary>
 /// Called if the user double-clicks on a policy failure.
 /// </summary>
 /// <param name="failure">The policy failure that causes this event.</param>
 public override void Activate(PolicyFailure failure)
 {
     MessageBox.Show("Please type a comment with 10 or more characters", "Resolving Comment Failure");
 }