Data-only class that represents aggregated rule set information. Same rule sets should be represented by the same instance of RuleSetInformation and have their RuleSetDeclaration.ConfigurationContext associated with the shared instance by adding them into ConfigurationContexts.
Пример #1
0
        public ProjectRuleSetConflict(RuleConflictInfo conflict, RuleSetInformation aggregate)
        {
            if (conflict == null)
            {
                throw new ArgumentNullException(nameof(conflict));
            }

            if (aggregate == null)
            {
                throw new ArgumentNullException(nameof(aggregate));
            }


            this.Conflict    = conflict;
            this.RuleSetInfo = aggregate;
        }
        public ProjectRuleSetConflict(RuleConflictInfo conflict, RuleSetInformation aggregate)
        {
            if (conflict == null)
            {
                throw new ArgumentNullException(nameof(conflict));
            }

            if (aggregate == null)
            {
                throw new ArgumentNullException(nameof(aggregate));
            }


            this.Conflict = conflict;
            this.RuleSetInfo = aggregate;
        }
        private void WriteFixSummaryToOutputWindow(Dictionary <RuleSetInformation, FixedRuleSetInfo> fixMap)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendLine();
            foreach (var keyValue in fixMap)
            {
                RuleSetInformation ruleSetInfo = keyValue.Key;
                FixedRuleSetInfo   fixInfo     = keyValue.Value;

                builder.AppendFormat(Strings.ConflictFixHeader, ruleSetInfo.RuleSetProjectFullName, CreateCommaSeparatedString(ruleSetInfo.ConfigurationContexts));
                builder.AppendLine();
                WriteSummaryInformation(fixInfo, builder);
            }

            VsShellUtils.WriteToSonarLintOutputPane(this.host, builder.ToString());
        }
        private void AddOrUpdateAggregatedRuleSetInformation(Dictionary <string, RuleSetInformation> projectRuleSetAggregation, string baselineRuleSet, RuleSetDeclaration declaration, string projectRuleSet)
        {
            RuleSetInformation aggregate;

            if (projectRuleSetAggregation.TryGetValue(projectRuleSet, out aggregate))
            {
                aggregate.ConfigurationContexts.Add(declaration.ConfigurationContext);

                if (!aggregate.RuleSetDirectories.SequenceEqual(declaration.RuleSetDirectories))
                {
                    this.WriteWarning(Strings.InconsistentRuleSetDirectoriesWarning,
                                      CombineDirectories(declaration.RuleSetDirectories),
                                      projectRuleSet,
                                      CombineDirectories(aggregate.RuleSetDirectories));
                }
            }
            else
            {
                aggregate = new RuleSetInformation(declaration.RuleSetProjectFullName, baselineRuleSet, projectRuleSet, declaration.RuleSetDirectories);
                aggregate.ConfigurationContexts.Add(declaration.ConfigurationContext);
                projectRuleSetAggregation[projectRuleSet] = aggregate;
            }
        }